From 785203d51a9ce42c6c7d98e3236529ab45688797 Mon Sep 17 00:00:00 2001 From: Joshua Mccloskey Date: Mon, 14 Jun 2021 19:50:29 -0700 Subject: [PATCH] Update multi biometric flow for SUW Currently, if a user has completed a fingerprint/face enrollment in SUW and they press the back button, we show the UI for each, and it fails with no error. This change makes it so that if a user completes 1 fingerprint or 1 face enrollment, it will no longer try and enroll them again if they have failed. Test: Manual Bug: 191073296 Change-Id: I020c423b5d34797cd7c8be66a2e24051135c9be0 --- .../biometrics/BiometricEnrollActivity.java | 41 ++++++++++++------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/src/com/android/settings/biometrics/BiometricEnrollActivity.java b/src/com/android/settings/biometrics/BiometricEnrollActivity.java index 11313fd52d4..ef01a4bfb7e 100644 --- a/src/com/android/settings/biometrics/BiometricEnrollActivity.java +++ b/src/com/android/settings/biometrics/BiometricEnrollActivity.java @@ -258,21 +258,6 @@ public class BiometricEnrollActivity extends InstrumentedActivity { } private void setupForMultiBiometricEnroll() { - final FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class); - final FaceManager faceManager = getSystemService(FaceManager.class); - final List fpProperties = - fingerprintManager.getSensorPropertiesInternal(); - final List faceProperties = - faceManager.getSensorPropertiesInternal(); - - // This would need to be updated for devices with multiple sensors of the same modality - mIsFaceEnrollable = !faceProperties.isEmpty() && - faceManager.getEnrolledFaces(mUserId).size() - < faceProperties.get(0).maxEnrollmentsPerUser; - mIsFingerprintEnrollable = !fpProperties.isEmpty() && - fingerprintManager.getEnrolledFingerprints(mUserId).size() - < fpProperties.get(0).maxEnrollmentsPerUser; - if (!mConfirmingCredentials) { mConfirmingCredentials = true; if (!userHasPassword(mUserId)) { @@ -284,7 +269,33 @@ public class BiometricEnrollActivity extends InstrumentedActivity { } private void startMultiBiometricEnroll(Intent data) { + final boolean isSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent()); + final FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class); + final FaceManager faceManager = getSystemService(FaceManager.class); + final List fpProperties = + fingerprintManager.getSensorPropertiesInternal(); + final List faceProperties = + faceManager.getSensorPropertiesInternal(); + mGkPwHandle = BiometricUtils.getGatekeeperPasswordHandle(data); + + if (isSetupWizard) { + // This would need to be updated for devices with multiple sensors of the same modality + mIsFaceEnrollable = !faceProperties.isEmpty() + && faceManager.getEnrolledFaces(mUserId).size() == 0; + mIsFingerprintEnrollable = !fpProperties.isEmpty() + && fingerprintManager.getEnrolledFingerprints(mUserId).size() == 0; + } else { + // This would need to be updated for devices with multiple sensors of the same modality + mIsFaceEnrollable = !faceProperties.isEmpty() + && faceManager.getEnrolledFaces(mUserId).size() + < faceProperties.get(0).maxEnrollmentsPerUser; + mIsFingerprintEnrollable = !fpProperties.isEmpty() + && fingerprintManager.getEnrolledFingerprints(mUserId).size() + < fpProperties.get(0).maxEnrollmentsPerUser; + + } + mMultiBiometricEnrollHelper = new MultiBiometricEnrollHelper(this, mUserId, mIsFaceEnrollable, mIsFingerprintEnrollable, mGkPwHandle); mMultiBiometricEnrollHelper.startNextStep();