Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +3 −7 Original line number Diff line number Diff line Loading @@ -1394,16 +1394,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab && !mFingerprintLockedOut; } private boolean isUnlockingWithFaceAllowed() { return mStrongAuthTracker.isUnlockingWithBiometricAllowed(false); } /** * Whether fingerprint is allowed ot be used for unlocking based on the strongAuthTracker * and temporary lockout state (tracked by FingerprintManager via error codes). */ public boolean isUnlockingWithFingerprintAllowed() { return isUnlockingWithBiometricAllowed(true); return isUnlockingWithBiometricAllowed(FINGERPRINT); } /** Loading @@ -1413,9 +1409,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab @NonNull BiometricSourceType biometricSourceType) { switch (biometricSourceType) { case FINGERPRINT: return isUnlockingWithFingerprintAllowed(); return isUnlockingWithBiometricAllowed(true); case FACE: return isUnlockingWithFaceAllowed(); return isUnlockingWithBiometricAllowed(false); default: return false; } Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +58 −0 Original line number Diff line number Diff line Loading @@ -608,6 +608,64 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { verify(mFingerprintManager).detectFingerprint(any(), any(), anyInt()); } @Test public void testUnlockingWithFaceAllowed_strongAuthTrackerUnlockingWithBiometricAllowed() { // GIVEN unlocking with biometric is allowed when(mStrongAuthTracker.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true); // THEN unlocking with face and fp is allowed Assert.assertTrue(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( BiometricSourceType.FACE)); Assert.assertTrue(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( BiometricSourceType.FINGERPRINT)); } @Test public void testUnlockingWithFaceAllowed_strongAuthTrackerUnlockingWithBiometricNotAllowed() { // GIVEN unlocking with biometric is not allowed when(mStrongAuthTracker.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(false); // THEN unlocking with face is not allowed Assert.assertFalse(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( BiometricSourceType.FACE)); } @Test public void testUnlockingWithFaceAllowed_fingerprintLockout() { // GIVEN unlocking with biometric is allowed when(mStrongAuthTracker.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true); // WHEN fingerprint is locked out fingerprintErrorLockedOut(); // THEN unlocking with face is not allowed Assert.assertFalse(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( BiometricSourceType.FACE)); } @Test public void testUnlockingWithFpAllowed_strongAuthTrackerUnlockingWithBiometricNotAllowed() { // GIVEN unlocking with biometric is not allowed when(mStrongAuthTracker.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(false); // THEN unlocking with fingerprint is not allowed Assert.assertFalse(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( BiometricSourceType.FINGERPRINT)); } @Test public void testUnlockingWithFpAllowed_fingerprintLockout() { // GIVEN unlocking with biometric is allowed when(mStrongAuthTracker.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true); // WHEN fingerprint is locked out fingerprintErrorLockedOut(); // THEN unlocking with fingeprint is not allowed Assert.assertFalse(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( BiometricSourceType.FINGERPRINT)); } @Test public void testTriesToAuthenticate_whenBouncer() { setKeyguardBouncerVisibility(true); Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +3 −7 Original line number Diff line number Diff line Loading @@ -1394,16 +1394,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab && !mFingerprintLockedOut; } private boolean isUnlockingWithFaceAllowed() { return mStrongAuthTracker.isUnlockingWithBiometricAllowed(false); } /** * Whether fingerprint is allowed ot be used for unlocking based on the strongAuthTracker * and temporary lockout state (tracked by FingerprintManager via error codes). */ public boolean isUnlockingWithFingerprintAllowed() { return isUnlockingWithBiometricAllowed(true); return isUnlockingWithBiometricAllowed(FINGERPRINT); } /** Loading @@ -1413,9 +1409,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab @NonNull BiometricSourceType biometricSourceType) { switch (biometricSourceType) { case FINGERPRINT: return isUnlockingWithFingerprintAllowed(); return isUnlockingWithBiometricAllowed(true); case FACE: return isUnlockingWithFaceAllowed(); return isUnlockingWithBiometricAllowed(false); default: return false; } Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +58 −0 Original line number Diff line number Diff line Loading @@ -608,6 +608,64 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { verify(mFingerprintManager).detectFingerprint(any(), any(), anyInt()); } @Test public void testUnlockingWithFaceAllowed_strongAuthTrackerUnlockingWithBiometricAllowed() { // GIVEN unlocking with biometric is allowed when(mStrongAuthTracker.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true); // THEN unlocking with face and fp is allowed Assert.assertTrue(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( BiometricSourceType.FACE)); Assert.assertTrue(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( BiometricSourceType.FINGERPRINT)); } @Test public void testUnlockingWithFaceAllowed_strongAuthTrackerUnlockingWithBiometricNotAllowed() { // GIVEN unlocking with biometric is not allowed when(mStrongAuthTracker.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(false); // THEN unlocking with face is not allowed Assert.assertFalse(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( BiometricSourceType.FACE)); } @Test public void testUnlockingWithFaceAllowed_fingerprintLockout() { // GIVEN unlocking with biometric is allowed when(mStrongAuthTracker.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true); // WHEN fingerprint is locked out fingerprintErrorLockedOut(); // THEN unlocking with face is not allowed Assert.assertFalse(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( BiometricSourceType.FACE)); } @Test public void testUnlockingWithFpAllowed_strongAuthTrackerUnlockingWithBiometricNotAllowed() { // GIVEN unlocking with biometric is not allowed when(mStrongAuthTracker.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(false); // THEN unlocking with fingerprint is not allowed Assert.assertFalse(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( BiometricSourceType.FINGERPRINT)); } @Test public void testUnlockingWithFpAllowed_fingerprintLockout() { // GIVEN unlocking with biometric is allowed when(mStrongAuthTracker.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true); // WHEN fingerprint is locked out fingerprintErrorLockedOut(); // THEN unlocking with fingeprint is not allowed Assert.assertFalse(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed( BiometricSourceType.FINGERPRINT)); } @Test public void testTriesToAuthenticate_whenBouncer() { setKeyguardBouncerVisibility(true); Loading