Merge "Fix enrolled pages not hide during SUW" into udc-dev am: 019e8ceb72

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/22613578

Change-Id: I44a659148fe12da3505564dba64317e8ad90fea3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-04-17 06:00:45 +00:00
committed by Automerger Merge Worker

View File

@@ -237,20 +237,7 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
} }
} }
} }
if (mHasFeatureFingerprint) { updateFingerprintEnrollable(isSetupWizard);
final FingerprintManager fpManager = getSystemService(FingerprintManager.class);
final List<FingerprintSensorPropertiesInternal> fpProperties =
fpManager.getSensorPropertiesInternal();
final int maxFingerprintsEnrollableIfSUW = getApplicationContext().getResources()
.getInteger(R.integer.suw_max_fingerprints_enrollable);
if (!fpProperties.isEmpty()) {
final int maxEnrolls =
isSetupWizard ? maxFingerprintsEnrollableIfSUW
: fpProperties.get(0).maxEnrollmentsPerUser;
mIsFingerprintEnrollable =
fpManager.getEnrolledFingerprints(mUserId).size() < maxEnrolls;
}
}
// TODO(b/195128094): remove this restriction // TODO(b/195128094): remove this restriction
// Consent can only be recorded when this activity is launched directly from the kids // Consent can only be recorded when this activity is launched directly from the kids
@@ -289,6 +276,23 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
} }
} }
private void updateFingerprintEnrollable(boolean isSetupWizard) {
if (mHasFeatureFingerprint) {
final FingerprintManager fpManager = getSystemService(FingerprintManager.class);
final List<FingerprintSensorPropertiesInternal> fpProperties =
fpManager.getSensorPropertiesInternal();
final int maxFingerprintsEnrollableIfSUW = getApplicationContext().getResources()
.getInteger(R.integer.suw_max_fingerprints_enrollable);
if (!fpProperties.isEmpty()) {
final int maxEnrolls =
isSetupWizard ? maxFingerprintsEnrollableIfSUW
: fpProperties.get(0).maxEnrollmentsPerUser;
mIsFingerprintEnrollable =
fpManager.getEnrolledFingerprints(mUserId).size() < maxEnrolls;
}
}
}
private void startEnrollWith(@Authenticators.Types int authenticators, boolean setupWizard) { private void startEnrollWith(@Authenticators.Types int authenticators, boolean setupWizard) {
// If the caller is not setup wizard, and the user has something enrolled, finish. // If the caller is not setup wizard, and the user has something enrolled, finish.
// Allow parental consent flow to skip this check, since one modality could be consented // Allow parental consent flow to skip this check, since one modality could be consented
@@ -464,12 +468,12 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
mConfirmingCredentials = false; mConfirmingCredentials = false;
final boolean isOk = final boolean isOk =
isSuccessfulConfirmOrChooseCredential(requestCode, resultCode); isSuccessfulConfirmOrChooseCredential(requestCode, resultCode);
if (isOk && (mHasFeatureFace || mHasFeatureFingerprint)) { if (isOk && (mIsFaceEnrollable || mIsFingerprintEnrollable)) {
// Apply forward animation during the transition from ChooseLock/ConfirmLock to // Apply forward animation during the transition from ChooseLock/ConfirmLock to
// SetupFingerprintEnrollIntroduction/FingerprintEnrollmentActivity // SetupFingerprintEnrollIntroduction/FingerprintEnrollmentActivity
TransitionHelper.applyForwardTransition(this, TRANSITION_FADE_THROUGH); TransitionHelper.applyForwardTransition(this, TRANSITION_FADE_THROUGH);
updateGatekeeperPasswordHandle(data); updateGatekeeperPasswordHandle(data);
if (mHasFeatureFingerprint) { if (mIsFingerprintEnrollable) {
launchFingerprintOnlyEnroll(); launchFingerprintOnlyEnroll();
} else { } else {
launchFaceOnlyEnroll(); launchFaceOnlyEnroll();
@@ -482,8 +486,15 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
break; break;
case REQUEST_SINGLE_ENROLL_FINGERPRINT: case REQUEST_SINGLE_ENROLL_FINGERPRINT:
mIsSingleEnrolling = false; mIsSingleEnrolling = false;
if (resultCode == BiometricEnrollBase.RESULT_FINISHED) {
// FingerprintEnrollIntroduction's visibility is determined by
// mIsFingerprintEnrollable. Keep this value up-to-date after a successful
// enrollment.
updateFingerprintEnrollable(WizardManagerHelper.isAnySetupWizard(getIntent()));
}
if ((resultCode == BiometricEnrollBase.RESULT_SKIP if ((resultCode == BiometricEnrollBase.RESULT_SKIP
|| resultCode == BiometricEnrollBase.RESULT_FINISHED) && mHasFeatureFace) { || resultCode == BiometricEnrollBase.RESULT_FINISHED)
&& mIsFaceEnrollable) {
// Apply forward animation during the transition from // Apply forward animation during the transition from
// SetupFingerprintEnroll*/FingerprintEnrollmentActivity to // SetupFingerprintEnroll*/FingerprintEnrollmentActivity to
// SetupFaceEnrollIntroduction // SetupFaceEnrollIntroduction
@@ -495,7 +506,7 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
break; break;
case REQUEST_SINGLE_ENROLL_FACE: case REQUEST_SINGLE_ENROLL_FACE:
mIsSingleEnrolling = false; mIsSingleEnrolling = false;
if (resultCode == Activity.RESULT_CANCELED && mHasFeatureFingerprint) { if (resultCode == Activity.RESULT_CANCELED && mIsFingerprintEnrollable) {
launchFingerprintOnlyEnroll(); launchFingerprintOnlyEnroll();
} else { } else {
finishOrLaunchHandToParent(resultCode); finishOrLaunchHandToParent(resultCode);