Loading packages/SystemUI/src/com/android/keyguard/KeyguardFingerprintListenModel.kt +4 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ data class KeyguardFingerprintListenModel( var allowOnCurrentOccludingActivity: Boolean = false, var alternateBouncerShowing: Boolean = false, var biometricEnabledForUser: Boolean = false, var biometricPromptShowing: Boolean = false, var bouncerIsOrWillShow: Boolean = false, var canSkipBouncer: Boolean = false, var credentialAttempted: Boolean = false, Loading Loading @@ -61,6 +62,7 @@ data class KeyguardFingerprintListenModel( allowOnCurrentOccludingActivity.toString(), alternateBouncerShowing.toString(), biometricEnabledForUser.toString(), biometricPromptShowing.toString(), bouncerIsOrWillShow.toString(), canSkipBouncer.toString(), credentialAttempted.toString(), Loading Loading @@ -101,6 +103,7 @@ data class KeyguardFingerprintListenModel( allowOnCurrentOccludingActivity = model.allowOnCurrentOccludingActivity alternateBouncerShowing = model.alternateBouncerShowing biometricEnabledForUser = model.biometricEnabledForUser biometricPromptShowing = model.biometricPromptShowing bouncerIsOrWillShow = model.bouncerIsOrWillShow canSkipBouncer = model.canSkipBouncer credentialAttempted = model.credentialAttempted Loading Loading @@ -147,6 +150,7 @@ data class KeyguardFingerprintListenModel( "allowOnCurrentOccludingActivity", "alternateBouncerShowing", "biometricAllowedForUser", "biometricPromptShowing", "bouncerIsOrWillShow", "canSkipBouncer", "credentialAttempted", Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +27 −4 Original line number Diff line number Diff line Loading @@ -380,6 +380,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private boolean mOccludingAppRequestingFace; private boolean mSecureCameraLaunched; private boolean mAllowedDisplayStateWhileAwakeForFaceAuth = true; private boolean mBiometricPromptShowing; @VisibleForTesting protected boolean mTelephonyCapable; private boolean mAllowFingerprintOnCurrentOccludingActivity; Loading Loading @@ -2010,9 +2011,17 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab }; private final FingerprintManager.FingerprintDetectionCallback mFingerprintDetectionCallback = (sensorId, userId, isStrongBiometric) -> { // Trigger the fingerprint detected path so the bouncer can be shown new FingerprintManager.FingerprintDetectionCallback() { @Override public void onDetectionError(int errorMsgId) { handleFingerprintError(errorMsgId, ""); } @Override public void onFingerprintDetected(int sensorId, int userId, boolean isStrongBiometric) { handleBiometricDetected(userId, FINGERPRINT, isStrongBiometric); } }; private final FaceManager.FaceDetectionCallback mFaceDetectionCallback Loading Loading @@ -2641,6 +2650,19 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mainExecutor.execute(() -> updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE, FACE_AUTH_TRIGGERED_ENROLLMENTS_CHANGED)); } @Override public void onBiometricPromptShown() { // SysUI should give priority to the biometric prompt requesting FP instead of // taking over the fingerprint listening state. mBiometricPromptShowing = true; } @Override public void onBiometricPromptDismissed() { mBiometricPromptShowing = false; updateFingerprintListeningState(BIOMETRIC_ACTION_START); } }); if (mConfigFaceAuthSupportedPosture != DEVICE_POSTURE_UNKNOWN) { mPostureController.addCallback(mPostureCallback); Loading Loading @@ -3139,7 +3161,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab boolean shouldListen = shouldListenKeyguardState && shouldListenUserState && shouldListenBouncerState && shouldListenUdfpsState; && shouldListenBouncerState && shouldListenUdfpsState && !mBiometricPromptShowing; logListenerModelData( new KeyguardFingerprintListenModel( System.currentTimeMillis(), Loading @@ -3148,6 +3170,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mAllowFingerprintOnCurrentOccludingActivity, mAlternateBouncerShowing, biometricEnabledForUser, mBiometricPromptShowing, mPrimaryBouncerIsOrWillBeShowing, userCanSkipBouncer, mCredentialAttempted, Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +45 −0 Original line number Diff line number Diff line Loading @@ -869,6 +869,23 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { anyInt(), any(), anyBoolean()); } @Test public void whenDetectFingerprint_detectError() { ArgumentCaptor<FingerprintManager.FingerprintDetectionCallback> fpDetectCallbackCaptor = ArgumentCaptor.forClass(FingerprintManager.FingerprintDetectionCallback.class); givenDetectFingerprintWithClearingFingerprintManagerInvocations(); verify(mFingerprintManager).detectFingerprint( any(), fpDetectCallbackCaptor.capture(), any()); fpDetectCallbackCaptor.getValue().onDetectionError(/* msgId */ 10); // THEN verify keyguardUpdateMonitorCallback receives a biometric error verify(mTestCallback).onBiometricError( eq(10), eq(""), eq(BiometricSourceType.FINGERPRINT)); verify(mTestCallback, never()).onBiometricAuthenticated( anyInt(), any(), anyBoolean()); } @Test public void whenDetectFace_biometricDetectCallback() throws RemoteException { ArgumentCaptor<FaceManager.FaceDetectionCallback> faceDetectCallbackCaptor = Loading Loading @@ -1211,6 +1228,34 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { verifyFingerprintAuthenticateCall(); } @Test public void fpStopsListeningWhenBiometricPromptShows_resumesOnBpHidden() { // verify AuthController.Callback is added: ArgumentCaptor<AuthController.Callback> captor = ArgumentCaptor.forClass( AuthController.Callback.class); verify(mAuthController).addCallback(captor.capture()); AuthController.Callback callback = captor.getValue(); // GIVEN keyguard showing mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON); mKeyguardUpdateMonitor.setKeyguardShowing(true, false); // THEN fingerprint should listen assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); // WHEN biometric prompt is shown callback.onBiometricPromptShown(); // THEN shouldn't listen for fingerprint assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isFalse(); // WHEN biometric prompt is dismissed callback.onBiometricPromptDismissed(); // THEN we should listen for fingerprint assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); } @Test public void testTriesToAuthenticate_whenTrustOnAgentKeyguard_ifBypass() { mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON); Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardFingerprintListenModel.kt +4 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ data class KeyguardFingerprintListenModel( var allowOnCurrentOccludingActivity: Boolean = false, var alternateBouncerShowing: Boolean = false, var biometricEnabledForUser: Boolean = false, var biometricPromptShowing: Boolean = false, var bouncerIsOrWillShow: Boolean = false, var canSkipBouncer: Boolean = false, var credentialAttempted: Boolean = false, Loading Loading @@ -61,6 +62,7 @@ data class KeyguardFingerprintListenModel( allowOnCurrentOccludingActivity.toString(), alternateBouncerShowing.toString(), biometricEnabledForUser.toString(), biometricPromptShowing.toString(), bouncerIsOrWillShow.toString(), canSkipBouncer.toString(), credentialAttempted.toString(), Loading Loading @@ -101,6 +103,7 @@ data class KeyguardFingerprintListenModel( allowOnCurrentOccludingActivity = model.allowOnCurrentOccludingActivity alternateBouncerShowing = model.alternateBouncerShowing biometricEnabledForUser = model.biometricEnabledForUser biometricPromptShowing = model.biometricPromptShowing bouncerIsOrWillShow = model.bouncerIsOrWillShow canSkipBouncer = model.canSkipBouncer credentialAttempted = model.credentialAttempted Loading Loading @@ -147,6 +150,7 @@ data class KeyguardFingerprintListenModel( "allowOnCurrentOccludingActivity", "alternateBouncerShowing", "biometricAllowedForUser", "biometricPromptShowing", "bouncerIsOrWillShow", "canSkipBouncer", "credentialAttempted", Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +27 −4 Original line number Diff line number Diff line Loading @@ -380,6 +380,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private boolean mOccludingAppRequestingFace; private boolean mSecureCameraLaunched; private boolean mAllowedDisplayStateWhileAwakeForFaceAuth = true; private boolean mBiometricPromptShowing; @VisibleForTesting protected boolean mTelephonyCapable; private boolean mAllowFingerprintOnCurrentOccludingActivity; Loading Loading @@ -2010,9 +2011,17 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab }; private final FingerprintManager.FingerprintDetectionCallback mFingerprintDetectionCallback = (sensorId, userId, isStrongBiometric) -> { // Trigger the fingerprint detected path so the bouncer can be shown new FingerprintManager.FingerprintDetectionCallback() { @Override public void onDetectionError(int errorMsgId) { handleFingerprintError(errorMsgId, ""); } @Override public void onFingerprintDetected(int sensorId, int userId, boolean isStrongBiometric) { handleBiometricDetected(userId, FINGERPRINT, isStrongBiometric); } }; private final FaceManager.FaceDetectionCallback mFaceDetectionCallback Loading Loading @@ -2641,6 +2650,19 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mainExecutor.execute(() -> updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE, FACE_AUTH_TRIGGERED_ENROLLMENTS_CHANGED)); } @Override public void onBiometricPromptShown() { // SysUI should give priority to the biometric prompt requesting FP instead of // taking over the fingerprint listening state. mBiometricPromptShowing = true; } @Override public void onBiometricPromptDismissed() { mBiometricPromptShowing = false; updateFingerprintListeningState(BIOMETRIC_ACTION_START); } }); if (mConfigFaceAuthSupportedPosture != DEVICE_POSTURE_UNKNOWN) { mPostureController.addCallback(mPostureCallback); Loading Loading @@ -3139,7 +3161,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab boolean shouldListen = shouldListenKeyguardState && shouldListenUserState && shouldListenBouncerState && shouldListenUdfpsState; && shouldListenBouncerState && shouldListenUdfpsState && !mBiometricPromptShowing; logListenerModelData( new KeyguardFingerprintListenModel( System.currentTimeMillis(), Loading @@ -3148,6 +3170,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mAllowFingerprintOnCurrentOccludingActivity, mAlternateBouncerShowing, biometricEnabledForUser, mBiometricPromptShowing, mPrimaryBouncerIsOrWillBeShowing, userCanSkipBouncer, mCredentialAttempted, Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +45 −0 Original line number Diff line number Diff line Loading @@ -869,6 +869,23 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { anyInt(), any(), anyBoolean()); } @Test public void whenDetectFingerprint_detectError() { ArgumentCaptor<FingerprintManager.FingerprintDetectionCallback> fpDetectCallbackCaptor = ArgumentCaptor.forClass(FingerprintManager.FingerprintDetectionCallback.class); givenDetectFingerprintWithClearingFingerprintManagerInvocations(); verify(mFingerprintManager).detectFingerprint( any(), fpDetectCallbackCaptor.capture(), any()); fpDetectCallbackCaptor.getValue().onDetectionError(/* msgId */ 10); // THEN verify keyguardUpdateMonitorCallback receives a biometric error verify(mTestCallback).onBiometricError( eq(10), eq(""), eq(BiometricSourceType.FINGERPRINT)); verify(mTestCallback, never()).onBiometricAuthenticated( anyInt(), any(), anyBoolean()); } @Test public void whenDetectFace_biometricDetectCallback() throws RemoteException { ArgumentCaptor<FaceManager.FaceDetectionCallback> faceDetectCallbackCaptor = Loading Loading @@ -1211,6 +1228,34 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { verifyFingerprintAuthenticateCall(); } @Test public void fpStopsListeningWhenBiometricPromptShows_resumesOnBpHidden() { // verify AuthController.Callback is added: ArgumentCaptor<AuthController.Callback> captor = ArgumentCaptor.forClass( AuthController.Callback.class); verify(mAuthController).addCallback(captor.capture()); AuthController.Callback callback = captor.getValue(); // GIVEN keyguard showing mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON); mKeyguardUpdateMonitor.setKeyguardShowing(true, false); // THEN fingerprint should listen assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); // WHEN biometric prompt is shown callback.onBiometricPromptShown(); // THEN shouldn't listen for fingerprint assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isFalse(); // WHEN biometric prompt is dismissed callback.onBiometricPromptDismissed(); // THEN we should listen for fingerprint assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(false)).isTrue(); } @Test public void testTriesToAuthenticate_whenTrustOnAgentKeyguard_ifBypass() { mKeyguardUpdateMonitor.dispatchStartedWakingUp(PowerManager.WAKE_REASON_POWER_BUTTON); Loading