Save mConfirmingCredentials state

Fixes: 162486392
Test: Remove all fingerprints/credentials, tap fingerprint settings,
      rotate device when setting credential. Finish credential
      setup and biometric enrollment. Only prompted to set up credential
      once.
Test: 1) Wipe device
      2) Proceed to set up credential in SUW, but pause on first
         credential screen (choose lock)
      3) adb shell cmd uimode night yes // triggers activity recreate
      4) Proceed with credential/biometric setup
      Notice not re-prompted for credentials
Change-Id: I65fc0265acad98b18b152070b85cc4f71693cc68
This commit is contained in:
Kevin Chyn
2020-07-31 12:29:55 -07:00
parent 48b44acaa1
commit ba47b9ae3e

View File

@@ -43,6 +43,8 @@ import com.google.android.setupdesign.span.LinkSpan;
public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
implements LinkSpan.OnClickListener { implements LinkSpan.OnClickListener {
private static final String KEY_CONFIRMING_CREDENTIALS = "confirming_credentials";
private UserManager mUserManager; private UserManager mUserManager;
private boolean mHasPassword; private boolean mHasPassword;
private boolean mBiometricUnlockDisabledByAdmin; private boolean mBiometricUnlockDisabledByAdmin;
@@ -127,6 +129,10 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
mConfirmingCredentials = savedInstanceState.getBoolean(KEY_CONFIRMING_CREDENTIALS);
}
Intent intent = getIntent(); Intent intent = getIntent();
if (intent.getStringExtra(WizardManagerHelper.EXTRA_THEME) == null) { if (intent.getStringExtra(WizardManagerHelper.EXTRA_THEME) == null) {
// Put the theme in the intent so it gets propagated to other activities in the flow // Put the theme in the intent so it gets propagated to other activities in the flow
@@ -149,6 +155,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
mUserManager = UserManager.get(this); mUserManager = UserManager.get(this);
updatePasswordQuality(); updatePasswordQuality();
if (!mConfirmingCredentials) {
if (!mHasPassword) { if (!mHasPassword) {
// No password registered, launch into enrollment wizard. // No password registered, launch into enrollment wizard.
mConfirmingCredentials = true; mConfirmingCredentials = true;
@@ -160,6 +167,7 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
launchConfirmLock(getConfirmLockTitleResId(), getChallenge()); launchConfirmLock(getConfirmLockTitleResId(), getChallenge());
} }
} }
}
@Override @Override
protected void onResume() { protected void onResume() {
@@ -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 @Override
protected boolean shouldFinishWhenBackgrounded() { protected boolean shouldFinishWhenBackgrounded() {
return super.shouldFinishWhenBackgrounded() && !mConfirmingCredentials && !mNextClicked; return super.shouldFinishWhenBackgrounded() && !mConfirmingCredentials && !mNextClicked;