Loading services/core/java/com/android/server/biometrics/PreAuthInfo.java +7 −3 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.os.UserManager; import android.util.Pair; import android.util.Slog; import com.android.internal.R; import com.android.server.biometrics.sensors.LockoutTracker; import java.lang.annotation.Retention; Loading Loading @@ -129,6 +130,11 @@ class PreAuthInfo { updateAuthenticatorsIfIdentityCheckIsActive(promptInfo, effectiveUserId, trustManager, settingObserver); if (!Flags.bpFallbackOptions() && isMandatoryBiometricsAuthentication && promptInfo.getNegativeButtonText() == null) { promptInfo.setNegativeButtonText(context.getString(R.string.cancel)); } final boolean biometricRequested = Utils.isBiometricRequested(promptInfo); final int requestedStrength = Utils.getPublicBiometricStrength(promptInfo); final boolean credentialRequested = Utils.isCredentialRequested(promptInfo); Loading Loading @@ -189,16 +195,14 @@ class PreAuthInfo { effectiveUserId), trustManager)) { promptInfo.setAuthenticators(BiometricManager.Authenticators.BIOMETRIC_STRONG); promptInfo.setIdentityCheckActive(true); return true; } else if (Flags.identityCheckTestApi() && Utils.shouldApplyIdentityCheck(promptInfo.getAuthenticators()) && settingObserver.isIdentityCheckActive(effectiveUserId)) { promptInfo.setAuthenticators(BiometricManager.Authenticators.BIOMETRIC_STRONG); promptInfo.setIdentityCheckActive(true); return true; } return false; return promptInfo.isIdentityCheckActive(); } private static boolean dropCredentialFallback(int authenticators, Loading services/tests/servicestests/src/com/android/server/biometrics/PreAuthInfoTest.java +21 −2 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.hardware.biometrics.PromptInfo; import android.os.RemoteException; import android.os.UserManager; import android.platform.test.annotations.Presubmit; import android.platform.test.annotations.RequiresFlagsDisabled; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; Loading Loading @@ -362,9 +363,27 @@ public class PreAuthInfoTest { assertThat(promptInfo.getNegativeButtonText()).isEqualTo(TEST_PACKAGE_NAME); } @Test @RequiresFlagsEnabled({Flags.FLAG_IDENTITY_CHECK_TEST_API, Flags.FLAG_BP_FALLBACK_OPTIONS}) public void testMandatoryBiometricsNegativeButtonText_shouldNotBeSet() throws Exception { when(mSettingObserver.isIdentityCheckActive(anyInt())).thenReturn(true); final BiometricSensor sensor = getFaceSensor(); final PromptInfo promptInfo = new PromptInfo(); promptInfo.setAuthenticators(BiometricManager.Authenticators.IDENTITY_CHECK); final PreAuthInfo preAuthInfo = PreAuthInfo.create(mTrustManager, mDevicePolicyManager, mSettingObserver, List.of(sensor), USER_ID, promptInfo, TEST_PACKAGE_NAME, false /* checkDevicePolicyManager */, mContext, mBiometricCameraManager, mUserManager); assertThat(preAuthInfo.getIsMandatoryBiometricsAuthentication()).isTrue(); assertThat(promptInfo.getNegativeButtonText()).isNull(); } @Test @RequiresFlagsEnabled(Flags.FLAG_IDENTITY_CHECK_TEST_API) public void testMandatoryBiometricsNegativeButtonText_whenNotSet() @RequiresFlagsDisabled(Flags.FLAG_BP_FALLBACK_OPTIONS) public void testMandatoryBiometricsNegativeButtonText_shouldBeSet() throws Exception { when(mSettingObserver.isIdentityCheckActive(anyInt())).thenReturn(true); Loading @@ -376,7 +395,7 @@ public class PreAuthInfoTest { false /* checkDevicePolicyManager */, mContext, mBiometricCameraManager, mUserManager); assertThat(preAuthInfo.getIsMandatoryBiometricsAuthentication()).isTrue(); assertThat(promptInfo.getNegativeButtonText()).isEqualTo(null); assertThat(promptInfo.getNegativeButtonText()).isNotNull(); } @Test Loading Loading
services/core/java/com/android/server/biometrics/PreAuthInfo.java +7 −3 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.os.UserManager; import android.util.Pair; import android.util.Slog; import com.android.internal.R; import com.android.server.biometrics.sensors.LockoutTracker; import java.lang.annotation.Retention; Loading Loading @@ -129,6 +130,11 @@ class PreAuthInfo { updateAuthenticatorsIfIdentityCheckIsActive(promptInfo, effectiveUserId, trustManager, settingObserver); if (!Flags.bpFallbackOptions() && isMandatoryBiometricsAuthentication && promptInfo.getNegativeButtonText() == null) { promptInfo.setNegativeButtonText(context.getString(R.string.cancel)); } final boolean biometricRequested = Utils.isBiometricRequested(promptInfo); final int requestedStrength = Utils.getPublicBiometricStrength(promptInfo); final boolean credentialRequested = Utils.isCredentialRequested(promptInfo); Loading Loading @@ -189,16 +195,14 @@ class PreAuthInfo { effectiveUserId), trustManager)) { promptInfo.setAuthenticators(BiometricManager.Authenticators.BIOMETRIC_STRONG); promptInfo.setIdentityCheckActive(true); return true; } else if (Flags.identityCheckTestApi() && Utils.shouldApplyIdentityCheck(promptInfo.getAuthenticators()) && settingObserver.isIdentityCheckActive(effectiveUserId)) { promptInfo.setAuthenticators(BiometricManager.Authenticators.BIOMETRIC_STRONG); promptInfo.setIdentityCheckActive(true); return true; } return false; return promptInfo.isIdentityCheckActive(); } private static boolean dropCredentialFallback(int authenticators, Loading
services/tests/servicestests/src/com/android/server/biometrics/PreAuthInfoTest.java +21 −2 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.hardware.biometrics.PromptInfo; import android.os.RemoteException; import android.os.UserManager; import android.platform.test.annotations.Presubmit; import android.platform.test.annotations.RequiresFlagsDisabled; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; Loading Loading @@ -362,9 +363,27 @@ public class PreAuthInfoTest { assertThat(promptInfo.getNegativeButtonText()).isEqualTo(TEST_PACKAGE_NAME); } @Test @RequiresFlagsEnabled({Flags.FLAG_IDENTITY_CHECK_TEST_API, Flags.FLAG_BP_FALLBACK_OPTIONS}) public void testMandatoryBiometricsNegativeButtonText_shouldNotBeSet() throws Exception { when(mSettingObserver.isIdentityCheckActive(anyInt())).thenReturn(true); final BiometricSensor sensor = getFaceSensor(); final PromptInfo promptInfo = new PromptInfo(); promptInfo.setAuthenticators(BiometricManager.Authenticators.IDENTITY_CHECK); final PreAuthInfo preAuthInfo = PreAuthInfo.create(mTrustManager, mDevicePolicyManager, mSettingObserver, List.of(sensor), USER_ID, promptInfo, TEST_PACKAGE_NAME, false /* checkDevicePolicyManager */, mContext, mBiometricCameraManager, mUserManager); assertThat(preAuthInfo.getIsMandatoryBiometricsAuthentication()).isTrue(); assertThat(promptInfo.getNegativeButtonText()).isNull(); } @Test @RequiresFlagsEnabled(Flags.FLAG_IDENTITY_CHECK_TEST_API) public void testMandatoryBiometricsNegativeButtonText_whenNotSet() @RequiresFlagsDisabled(Flags.FLAG_BP_FALLBACK_OPTIONS) public void testMandatoryBiometricsNegativeButtonText_shouldBeSet() throws Exception { when(mSettingObserver.isIdentityCheckActive(anyInt())).thenReturn(true); Loading @@ -376,7 +395,7 @@ public class PreAuthInfoTest { false /* checkDevicePolicyManager */, mContext, mBiometricCameraManager, mUserManager); assertThat(preAuthInfo.getIsMandatoryBiometricsAuthentication()).isTrue(); assertThat(promptInfo.getNegativeButtonText()).isEqualTo(null); assertThat(promptInfo.getNegativeButtonText()).isNotNull(); } @Test Loading