Merge "Save mConfirmingCredentials state"

This commit is contained in:
Kevin Chyn
2020-08-04 17:37:32 +00:00
committed by Android (Google) Code Review

View File

@@ -43,6 +43,8 @@ import com.google.android.setupdesign.span.LinkSpan;
public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
implements LinkSpan.OnClickListener {
private static final String KEY_CONFIRMING_CREDENTIALS = "confirming_credentials";
private UserManager mUserManager;
private boolean mHasPassword;
private boolean mBiometricUnlockDisabledByAdmin;
@@ -127,6 +129,10 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
mConfirmingCredentials = savedInstanceState.getBoolean(KEY_CONFIRMING_CREDENTIALS);
}
Intent intent = getIntent();
if (intent.getStringExtra(WizardManagerHelper.EXTRA_THEME) == null) {
// Put the theme in the intent so it gets propagated to other activities in the flow
@@ -149,15 +155,17 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
mUserManager = UserManager.get(this);
updatePasswordQuality();
if (!mHasPassword) {
// No password registered, launch into enrollment wizard.
mConfirmingCredentials = true;
launchChooseLock();
} else if (mToken == null) {
// It's possible to have a token but mLaunchedConfirmLock == false, since
// ChooseLockGeneric can pass us a token.
mConfirmingCredentials = true;
launchConfirmLock(getConfirmLockTitleResId(), getChallenge());
if (!mConfirmingCredentials) {
if (!mHasPassword) {
// No password registered, launch into enrollment wizard.
mConfirmingCredentials = true;
launchChooseLock();
} else if (mToken == null) {
// It's possible to have a token but mLaunchedConfirmLock == false, since
// ChooseLockGeneric can pass us a token.
mConfirmingCredentials = true;
launchConfirmLock(getConfirmLockTitleResId(), getChallenge());
}
}
}
@@ -178,6 +186,12 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(KEY_CONFIRMING_CREDENTIALS, mConfirmingCredentials);
}
@Override
protected boolean shouldFinishWhenBackgrounded() {
return super.shouldFinishWhenBackgrounded() && !mConfirmingCredentials && !mNextClicked;