From 149a06cfdf613207ef837b8d0e777d706e344283 Mon Sep 17 00:00:00 2001 From: josephpv Date: Tue, 16 Jan 2024 00:16:38 +0000 Subject: [PATCH] Add biometric enrollment support for private profile During a new lock setup for profile whose credential is shareable with its parent first the user is authenticated with device lock after which an activity having options of Pin/Pattern/Password with fingerprint and face combinations is shown. On choosing any option which has combination to set LSFK and biometric it is expected that after setting LSKF the Biometric enroll activity is started but currently this does not work as expected as the ChooseLockGeneric activity is finished after adding LSKF and it does not start the biometric enrollment for the profile. The issue also exists with non-profile users using this workflow through SET_NEW_PASSWORD intent and if already have LSKF assigned. This change adds a new boolean which takes care to not finish the activity till the Biometric enrollment is started. Below conditions are taken care with this change - For new lock setup when device lock already exists then after authentication of current device lock make sure the activity is not finished untill the biometrics enrollment activity is started. - On choosing continue without fingerprint or face option the biometrics enrollment is not started screen recordings uploaded to buganizer - b/316109077 Bug: 316109077 Test: Manual Change-Id: Ifcbaa7d89195d87d432fc848092f2301752c3c22 --- src/com/android/settings/password/ChooseLockGeneric.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/password/ChooseLockGeneric.java b/src/com/android/settings/password/ChooseLockGeneric.java index 663b4e5d090..db031e7bb6a 100644 --- a/src/com/android/settings/password/ChooseLockGeneric.java +++ b/src/com/android/settings/password/ChooseLockGeneric.java @@ -203,6 +203,7 @@ public class ChooseLockGeneric extends SettingsActivity { private boolean mOnlyEnforceDevicePasswordRequirement = false; private int mExtraLockScreenTitleResId; private int mExtraLockScreenDescriptionResId; + private boolean mWaitingForBiometricEnrollment = false; @Override public int getMetricsCategory() { @@ -250,6 +251,7 @@ public class ChooseLockGeneric extends SettingsActivity { ChooseLockSettingsHelper.EXTRA_KEY_FOR_FACE, false); mForBiometrics = intent.getBooleanExtra( ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, false); + mWaitingForBiometricEnrollment = mForBiometrics || mForFingerprint || mForFace; mExtraLockScreenTitleResId = intent.getIntExtra(EXTRA_KEY_CHOOSE_LOCK_SCREEN_TITLE, -1); mExtraLockScreenDescriptionResId = @@ -440,6 +442,7 @@ public class ChooseLockGeneric extends SettingsActivity { return true; } else if (KEY_SKIP_FINGERPRINT.equals(key) || KEY_SKIP_FACE.equals(key) || KEY_SKIP_BIOMETRICS.equals(key)) { + mWaitingForBiometricEnrollment = false; Intent chooseLockGenericIntent = new Intent(getActivity(), getInternalActivityClass()); chooseLockGenericIntent.setAction(getIntent().getAction()); @@ -493,6 +496,7 @@ public class ChooseLockGeneric extends SettingsActivity { finish(); } else if (requestCode == CHOOSE_LOCK_BEFORE_BIOMETRIC_REQUEST && resultCode == BiometricEnrollBase.RESULT_FINISHED) { + mWaitingForBiometricEnrollment = false; Intent intent = getBiometricEnrollIntent(getActivity()); if (data != null) { // ChooseLockGeneric should have requested for a Gatekeeper Password Handle to @@ -873,7 +877,8 @@ public class ChooseLockGeneric extends SettingsActivity { // Otherwise, bugs would be caused. (e.g. b/278488549, b/278530059) final boolean hasCredential = mLockPatternUtils.isSecure(mUserId); if (!getActivity().isChangingConfigurations() - && !mWaitingForConfirmation && !mWaitingForActivityResult && hasCredential) { + && !mWaitingForConfirmation && !mWaitingForActivityResult && hasCredential + && !mWaitingForBiometricEnrollment) { getActivity().finish(); } }