Loading core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java +7 −2 Original line number Diff line number Diff line Loading @@ -121,15 +121,20 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna /** * Returns if sensor type is ultrasonic Udfps * @return true if sensor is ultrasonic Udfps, false otherwise */ public boolean isUltrasonicUdfps() { return sensorType == TYPE_UDFPS_ULTRASONIC; } /** * Returns if sensor type is optical Udfps */ public boolean isOpticalUdfps() { return sensorType == TYPE_UDFPS_OPTICAL; } /** * Returns if sensor type is side-FPS * @return true if sensor is side-fps, false otherwise */ public boolean isAnySidefpsType() { switch (sensorType) { Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java +23 −3 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.hardware.biometrics.BiometricSourceType; import android.hardware.fingerprint.FingerprintManager; import android.os.Handler; import android.os.PowerManager; import android.os.UserHandle; Loading Loading @@ -431,9 +432,9 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { } @Test public void onUdfpsConsecutivelyFailedThreeTimes_showPrimaryBouncer() { // GIVEN UDFPS is supported when(mUpdateMonitor.isUdfpsSupported()).thenReturn(true); public void onOpticalUdfpsConsecutivelyFailedThreeTimes_showPrimaryBouncer() { // GIVEN optical UDFPS is supported when(mUpdateMonitor.isOpticalUdfpsSupported()).thenReturn(true); // WHEN udfps fails once - then don't show the bouncer yet mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT); Loading @@ -450,6 +451,25 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { verify(mStatusBarKeyguardViewManager).showPrimaryBouncer(true); } @Test public void onUltrasonicUdfpsLockout_showPrimaryBouncer() { // GIVEN ultrasonic UDFPS is supported when(mUpdateMonitor.isOpticalUdfpsSupported()).thenReturn(false); // WHEN udfps fails three times, don't show bouncer mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT); mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT); mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT); verify(mStatusBarKeyguardViewManager, never()).showPrimaryBouncer(anyBoolean()); // WHEN lockout is received mBiometricUnlockController.onBiometricError(FingerprintManager.FINGERPRINT_ERROR_LOCKOUT, "Lockout", BiometricSourceType.FINGERPRINT); // THEN show bouncer verify(mStatusBarKeyguardViewManager).showPrimaryBouncer(true); } @Test public void onFinishedGoingToSleep_authenticatesWhenPending() { when(mUpdateMonitor.isGoingToSleep()).thenReturn(true); Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +9 −0 Original line number Diff line number Diff line Loading @@ -2590,6 +2590,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab return mAuthController.isUdfpsSupported(); } /** * @return true if optical udfps HW is supported on this device. Can return true even if the * user has not enrolled udfps. This may be false if called before * onAllAuthenticatorsRegistered. */ public boolean isOpticalUdfpsSupported() { return mAuthController.isOpticalUdfpsSupported(); } /** * @return true if there's at least one sfps enrollment for the current user. */ Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +10 −0 Original line number Diff line number Diff line Loading @@ -1010,6 +1010,16 @@ public class AuthController implements return getUdfpsProps() != null && !getUdfpsProps().isEmpty(); } /** * @return true if optical udfps HW is supported on this device. Can return true even if * the user has not enrolled udfps. This may be false if called before * onAllAuthenticatorsRegistered. */ public boolean isOpticalUdfpsSupported() { return getUdfpsProps() != null && !getUdfpsProps().isEmpty() && getUdfpsProps() .get(0).isOpticalUdfps(); } /** * @return true if ultrasonic udfps HW is supported on this device. Can return true even if * the user has not enrolled udfps. This may be false if called before Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +1 −1 Original line number Diff line number Diff line Loading @@ -750,7 +750,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp BiometricUnlockSource.Companion.fromBiometricSourceType(biometricSourceType) ); } else if (biometricSourceType == BiometricSourceType.FINGERPRINT && mUpdateMonitor.isUdfpsSupported()) { && mUpdateMonitor.isOpticalUdfpsSupported()) { long currUptimeMillis = mSystemClock.uptimeMillis(); if (currUptimeMillis - mLastFpFailureUptimeMillis < mConsecutiveFpFailureThreshold) { mNumConsecutiveFpFailures += 1; Loading Loading
core/java/android/hardware/fingerprint/FingerprintSensorPropertiesInternal.java +7 −2 Original line number Diff line number Diff line Loading @@ -121,15 +121,20 @@ public class FingerprintSensorPropertiesInternal extends SensorPropertiesInterna /** * Returns if sensor type is ultrasonic Udfps * @return true if sensor is ultrasonic Udfps, false otherwise */ public boolean isUltrasonicUdfps() { return sensorType == TYPE_UDFPS_ULTRASONIC; } /** * Returns if sensor type is optical Udfps */ public boolean isOpticalUdfps() { return sensorType == TYPE_UDFPS_OPTICAL; } /** * Returns if sensor type is side-FPS * @return true if sensor is side-fps, false otherwise */ public boolean isAnySidefpsType() { switch (sensorType) { Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java +23 −3 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.hardware.biometrics.BiometricSourceType; import android.hardware.fingerprint.FingerprintManager; import android.os.Handler; import android.os.PowerManager; import android.os.UserHandle; Loading Loading @@ -431,9 +432,9 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { } @Test public void onUdfpsConsecutivelyFailedThreeTimes_showPrimaryBouncer() { // GIVEN UDFPS is supported when(mUpdateMonitor.isUdfpsSupported()).thenReturn(true); public void onOpticalUdfpsConsecutivelyFailedThreeTimes_showPrimaryBouncer() { // GIVEN optical UDFPS is supported when(mUpdateMonitor.isOpticalUdfpsSupported()).thenReturn(true); // WHEN udfps fails once - then don't show the bouncer yet mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT); Loading @@ -450,6 +451,25 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { verify(mStatusBarKeyguardViewManager).showPrimaryBouncer(true); } @Test public void onUltrasonicUdfpsLockout_showPrimaryBouncer() { // GIVEN ultrasonic UDFPS is supported when(mUpdateMonitor.isOpticalUdfpsSupported()).thenReturn(false); // WHEN udfps fails three times, don't show bouncer mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT); mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT); mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT); verify(mStatusBarKeyguardViewManager, never()).showPrimaryBouncer(anyBoolean()); // WHEN lockout is received mBiometricUnlockController.onBiometricError(FingerprintManager.FINGERPRINT_ERROR_LOCKOUT, "Lockout", BiometricSourceType.FINGERPRINT); // THEN show bouncer verify(mStatusBarKeyguardViewManager).showPrimaryBouncer(true); } @Test public void onFinishedGoingToSleep_authenticatesWhenPending() { when(mUpdateMonitor.isGoingToSleep()).thenReturn(true); Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +9 −0 Original line number Diff line number Diff line Loading @@ -2590,6 +2590,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab return mAuthController.isUdfpsSupported(); } /** * @return true if optical udfps HW is supported on this device. Can return true even if the * user has not enrolled udfps. This may be false if called before * onAllAuthenticatorsRegistered. */ public boolean isOpticalUdfpsSupported() { return mAuthController.isOpticalUdfpsSupported(); } /** * @return true if there's at least one sfps enrollment for the current user. */ Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java +10 −0 Original line number Diff line number Diff line Loading @@ -1010,6 +1010,16 @@ public class AuthController implements return getUdfpsProps() != null && !getUdfpsProps().isEmpty(); } /** * @return true if optical udfps HW is supported on this device. Can return true even if * the user has not enrolled udfps. This may be false if called before * onAllAuthenticatorsRegistered. */ public boolean isOpticalUdfpsSupported() { return getUdfpsProps() != null && !getUdfpsProps().isEmpty() && getUdfpsProps() .get(0).isOpticalUdfps(); } /** * @return true if ultrasonic udfps HW is supported on this device. Can return true even if * the user has not enrolled udfps. This may be false if called before Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +1 −1 Original line number Diff line number Diff line Loading @@ -750,7 +750,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp BiometricUnlockSource.Companion.fromBiometricSourceType(biometricSourceType) ); } else if (biometricSourceType == BiometricSourceType.FINGERPRINT && mUpdateMonitor.isUdfpsSupported()) { && mUpdateMonitor.isOpticalUdfpsSupported()) { long currUptimeMillis = mSystemClock.uptimeMillis(); if (currUptimeMillis - mLastFpFailureUptimeMillis < mConsecutiveFpFailureThreshold) { mNumConsecutiveFpFailures += 1; Loading