Refactor BiometricEnrollBase::onStop()
During BiometricEnrollBase::onStop(), it judeges activity result and determine finishing self or not by a common rule. And it causes some problems. 1. It may override original setResult() which was set by its child activity. 2. If we change the judgmental rule in BiometricEnollBase, we need to manully test all override class cases to make sure everything works well. It makes us hard to change the criteria here. Move code in BiometricEnrollBase::onStop() to its extended class to have more flexiable. Bug: 197717071 Test: Run ROBOTEST for SetupFingerprintEnrollIntroductionTest SetupFingerprintEnrollFinishTest FingerprintEnrollEnrollingTest FingerprintEnrollFindSensorTest FingerprintEnrollIntroductionTest SetupFingerprintEnrollFindSensorTest Test: Manully test fingerprint/faceauth flow in settings or SUW Change-Id: I5d6c63cf537c0146bc03bd2b36ee3e1d68918a19
This commit is contained in:
@@ -181,16 +181,6 @@ public abstract class BiometricEnrollBase extends InstrumentedActivity {
|
|||||||
getWindow().setStatusBarColor(getBackgroundColor());
|
getWindow().setStatusBarColor(getBackgroundColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStop() {
|
|
||||||
super.onStop();
|
|
||||||
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
|
||||||
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
|
||||||
setResult(RESULT_TIMEOUT);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean shouldFinishWhenBackgrounded() {
|
protected boolean shouldFinishWhenBackgrounded() {
|
||||||
return !WizardManagerHelper.isAnySetupWizard(getIntent());
|
return !WizardManagerHelper.isAnySetupWizard(getIntent());
|
||||||
}
|
}
|
||||||
|
@@ -241,6 +241,16 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||||
|
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||||
|
setResult(RESULT_TIMEOUT);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
|
@@ -49,6 +49,16 @@ public class BiometricHandoffActivity extends BiometricEnrollBase {
|
|||||||
mFooterBarMixin.setPrimaryButton(getPrimaryFooterButton());
|
mFooterBarMixin.setPrimaryButton(getPrimaryFooterButton());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||||
|
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||||
|
setResult(RESULT_TIMEOUT);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
protected FooterButton getPrimaryFooterButton() {
|
protected FooterButton getPrimaryFooterButton() {
|
||||||
if (mPrimaryFooterButton == null) {
|
if (mPrimaryFooterButton == null) {
|
||||||
|
@@ -62,7 +62,11 @@ public abstract class BiometricsEnrollEnrolling extends BiometricEnrollBase
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||||
|
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||||
|
setResult(RESULT_TIMEOUT);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
if (mSidecar != null) {
|
if (mSidecar != null) {
|
||||||
mSidecar.setListener(null);
|
mSidecar.setListener(null);
|
||||||
@@ -80,6 +84,7 @@ public abstract class BiometricsEnrollEnrolling extends BiometricEnrollBase
|
|||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -170,6 +170,16 @@ public class FaceEnrollEducation extends BiometricEnrollBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||||
|
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||||
|
setResult(RESULT_TIMEOUT);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean shouldFinishWhenBackgrounded() {
|
protected boolean shouldFinishWhenBackgrounded() {
|
||||||
return super.shouldFinishWhenBackgrounded() && !mNextClicked;
|
return super.shouldFinishWhenBackgrounded() && !mNextClicked;
|
||||||
|
@@ -22,6 +22,7 @@ import android.view.View;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.biometrics.BiometricEnrollBase;
|
import com.android.settings.biometrics.BiometricEnrollBase;
|
||||||
|
import com.android.settings.biometrics.BiometricUtils;
|
||||||
|
|
||||||
import com.google.android.setupcompat.template.FooterBarMixin;
|
import com.google.android.setupcompat.template.FooterBarMixin;
|
||||||
import com.google.android.setupcompat.template.FooterButton;
|
import com.google.android.setupcompat.template.FooterButton;
|
||||||
@@ -48,6 +49,16 @@ public class FaceEnrollFinish extends BiometricEnrollBase {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||||
|
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||||
|
setResult(RESULT_TIMEOUT);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return SettingsEnums.FACE_ENROLL_FINISHED;
|
return SettingsEnums.FACE_ENROLL_FINISHED;
|
||||||
|
@@ -249,10 +249,15 @@ public class FingerprintEnrollFindSensor extends BiometricEnrollBase implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
|
||||||
if (mAnimation != null) {
|
if (mAnimation != null) {
|
||||||
mAnimation.pauseAnimation();
|
mAnimation.pauseAnimation();
|
||||||
}
|
}
|
||||||
|
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||||
|
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||||
|
setResult(RESULT_TIMEOUT);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -108,6 +108,16 @@ public class FingerprintEnrollFinish extends BiometricEnrollBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
if (!isChangingConfigurations() && shouldFinishWhenBackgrounded()
|
||||||
|
&& !BiometricUtils.isAnyMultiBiometricFlow(this)) {
|
||||||
|
setResult(RESULT_TIMEOUT);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
super.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onNextButtonClick(View view) {
|
protected void onNextButtonClick(View view) {
|
||||||
updateFingerprintSuggestionEnableState();
|
updateFingerprintSuggestionEnableState();
|
||||||
|
Reference in New Issue
Block a user