Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 785203d5 authored by Joshua Mccloskey's avatar Joshua Mccloskey
Browse files

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
parent 35e1f0d1
Loading
Loading
Loading
Loading
+26 −15
Original line number Diff line number Diff line
@@ -258,6 +258,18 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
    }

    private void setupForMultiBiometricEnroll() {
        if (!mConfirmingCredentials) {
            mConfirmingCredentials = true;
            if (!userHasPassword(mUserId)) {
                launchChooseLock();
            } else {
                launchConfirmLock();
            }
        }
    }

    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<FingerprintSensorPropertiesInternal> fpProperties =
@@ -265,26 +277,25 @@ public class BiometricEnrollActivity extends InstrumentedActivity {
        final List<FaceSensorPropertiesInternal> 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()
            mIsFaceEnrollable = !faceProperties.isEmpty()
                    && faceManager.getEnrolledFaces(mUserId).size()
                    < faceProperties.get(0).maxEnrollmentsPerUser;
        mIsFingerprintEnrollable = !fpProperties.isEmpty() &&
                fingerprintManager.getEnrolledFingerprints(mUserId).size()
            mIsFingerprintEnrollable = !fpProperties.isEmpty()
                    && fingerprintManager.getEnrolledFingerprints(mUserId).size()
                    < fpProperties.get(0).maxEnrollmentsPerUser;

        if (!mConfirmingCredentials) {
            mConfirmingCredentials = true;
            if (!userHasPassword(mUserId)) {
                launchChooseLock();
            } else {
                launchConfirmLock();
            }
        }
        }

    private void startMultiBiometricEnroll(Intent data) {
        mGkPwHandle = BiometricUtils.getGatekeeperPasswordHandle(data);
        mMultiBiometricEnrollHelper = new MultiBiometricEnrollHelper(this, mUserId,
                mIsFaceEnrollable, mIsFingerprintEnrollable, mGkPwHandle);
        mMultiBiometricEnrollHelper.startNextStep();