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

Commit e4881b18 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add check for mandatory biometric flag" into main

parents e2f665b7 5a867c04
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -253,9 +253,15 @@ public class Utils {

        // Check if any of the non-biometric and non-credential bits are set. If so, this is
        // invalid.
        final int testBits = ~(Authenticators.DEVICE_CREDENTIAL
        final int testBits;
        if (Flags.mandatoryBiometrics()) {
            testBits = ~(Authenticators.DEVICE_CREDENTIAL
                    | Authenticators.BIOMETRIC_MIN_STRENGTH
                    | Authenticators.MANDATORY_BIOMETRICS);
        } else {
            testBits = ~(Authenticators.DEVICE_CREDENTIAL
                    | Authenticators.BIOMETRIC_MIN_STRENGTH);
        }
        if ((authenticators & testBits) != 0) {
            Slog.e(BiometricService.TAG, "Non-biometric, non-credential bits found."
                    + " Authenticators: " + authenticators);
+7 −1
Original line number Diff line number Diff line
@@ -217,7 +217,13 @@ public class UtilsTest {
        doNothing().when(mContext).enforceCallingOrSelfPermission(
                eq(SET_BIOMETRIC_DIALOG_ADVANCED), any());

        assertTrue(Utils.isValidAuthenticatorConfig(mContext, Authenticators.MANDATORY_BIOMETRICS));
        if (Flags.mandatoryBiometrics()) {
            assertTrue(Utils.isValidAuthenticatorConfig(mContext,
                    Authenticators.MANDATORY_BIOMETRICS));
        } else {
            assertFalse(Utils.isValidAuthenticatorConfig(mContext,
                    Authenticators.MANDATORY_BIOMETRICS));
        }

        // The rest of the bits are not allowed to integrate with the public APIs
        for (int i = 8; i < 32; i++) {