Loading packages/SystemUI/src/com/android/keyguard/KeyguardListenModel.kt +4 −3 Original line number Diff line number Diff line Loading @@ -50,10 +50,9 @@ data class KeyguardFaceListenModel( override val listening: Boolean, // keep sorted val authInterruptActive: Boolean, val becauseCannotSkipBouncer: Boolean, val biometricSettingEnabledForUser: Boolean, val bouncerFullyShown: Boolean, val faceAuthenticated: Boolean, val faceAndFpNotAuthenticated: Boolean, val faceDisabled: Boolean, val faceLockedOut: Boolean, val fpLockedOut: Boolean, Loading @@ -67,6 +66,8 @@ data class KeyguardFaceListenModel( val secureCameraLaunched: Boolean, val switchingUser: Boolean, val udfpsBouncerShowing: Boolean, val udfpsFingerDown: Boolean, val userNotTrustedOrDetectionIsNeeded: Boolean, ) : KeyguardListenModel() /** * Verbose debug information associated with [KeyguardUpdateMonitor.shouldTriggerActiveUnlock]. Loading packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +14 −12 Original line number Diff line number Diff line Loading @@ -810,9 +810,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab } // Don't send cancel if authentication succeeds mFingerprintCancelSignal = null; mLogger.logFingerprintSuccess(userId, isStrongBiometric); updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE, FACE_AUTH_UPDATED_FP_AUTHENTICATED); mLogger.logFingerprintSuccess(userId, isStrongBiometric); for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { Loading Loading @@ -2726,9 +2726,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab final boolean canBypass = mKeyguardBypassController != null && mKeyguardBypassController.canBypass(); // There's no reason to ask the HAL for authentication when the user can dismiss the // bouncer, unless we're bypassing and need to auto-dismiss the lock screen even when // TrustAgents or biometrics are keeping the device unlocked. final boolean becauseCannotSkipBouncer = !getUserCanSkipBouncer(user) || canBypass; // bouncer because the user is trusted, unless we're bypassing and need to auto-dismiss // the lock screen even when TrustAgents are keeping the device unlocked. final boolean userNotTrustedOrDetectionIsNeeded = !getUserHasTrust(user) || canBypass; // Scan even when encrypted or timeout to show a preemptive bouncer when bypassing. // Lock-down mode shouldn't scan, since it is more explicit. Loading @@ -2745,11 +2745,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab strongAuthAllowsScanning = false; } // If the face has recently been authenticated do not attempt to authenticate again. final boolean faceAuthenticated = getIsFaceAuthenticated(); // If the face or fp has recently been authenticated do not attempt to authenticate again. final boolean faceAndFpNotAuthenticated = !getUserUnlockedWithBiometric(user); final boolean faceDisabledForUser = isFaceDisabled(user); final boolean biometricEnabledForUser = mBiometricEnabledForUser.get(user); final boolean shouldListenForFaceAssistant = shouldListenForFaceAssistant(); final boolean isUdfpsFingerDown = mAuthController.isUdfpsFingerDown(); // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware. Loading @@ -2759,13 +2760,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab || mOccludingAppRequestingFace || awakeKeyguard || shouldListenForFaceAssistant || mAuthController.isUdfpsFingerDown() || isUdfpsFingerDown || mUdfpsBouncerShowing) && !mSwitchingUser && !faceDisabledForUser && becauseCannotSkipBouncer && !mSwitchingUser && !faceDisabledForUser && userNotTrustedOrDetectionIsNeeded && !mKeyguardGoingAway && biometricEnabledForUser && strongAuthAllowsScanning && mIsPrimaryUser && (!mSecureCameraLaunched || mOccludingAppRequestingFace) && !faceAuthenticated && faceAndFpNotAuthenticated && !mGoingToSleep // We only care about fp locked out state and not face because we still trigger // face auth even when face is locked out to show the user a message that face Loading @@ -2779,10 +2780,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab user, shouldListen, mAuthInterruptActive, becauseCannotSkipBouncer, biometricEnabledForUser, mPrimaryBouncerFullyShown, faceAuthenticated, faceAndFpNotAuthenticated, faceDisabledForUser, isFaceLockedOut(), fpLockedOut, Loading @@ -2795,7 +2795,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab strongAuthAllowsScanning, mSecureCameraLaunched, mSwitchingUser, mUdfpsBouncerShowing)); mUdfpsBouncerShowing, isUdfpsFingerDown, userNotTrustedOrDetectionIsNeeded)); return shouldListen; } Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardListenQueueTest.kt +3 −2 Original line number Diff line number Diff line Loading @@ -84,10 +84,9 @@ private fun faceModel(user: Int) = KeyguardFaceListenModel( userId = user, listening = false, authInterruptActive = false, becauseCannotSkipBouncer = false, biometricSettingEnabledForUser = false, bouncerFullyShown = false, faceAuthenticated = false, faceAndFpNotAuthenticated = false, faceDisabled = false, faceLockedOut = false, fpLockedOut = false, Loading @@ -101,4 +100,6 @@ private fun faceModel(user: Int) = KeyguardFaceListenModel( secureCameraLaunched = false, switchingUser = false, udfpsBouncerShowing = false, udfpsFingerDown = false, userNotTrustedOrDetectionIsNeeded = false ) packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +32 −0 Original line number Diff line number Diff line Loading @@ -1381,6 +1381,29 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse(); } @Test public void testShouldListenForFace_whenFpIsAlreadyAuthenticated_returnsFalse() throws RemoteException { // Face auth should run when the following is true. bouncerFullyVisibleAndNotGoingToSleep(); keyguardNotGoingAway(); currentUserIsPrimary(); strongAuthNotRequired(); biometricsEnabledForCurrentUser(); currentUserDoesNotHaveTrust(); biometricsNotDisabledThroughDevicePolicyManager(); userNotCurrentlySwitching(); mTestableLooper.processAllMessages(); assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue(); successfulFingerprintAuth(); mTestableLooper.processAllMessages(); assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse(); } @Test public void testShouldListenForFace_whenUserIsNotPrimary_returnsFalse() throws RemoteException { cleanupKeyguardUpdateMonitor(); Loading Loading @@ -1935,6 +1958,15 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { .onAuthenticationAcquired(FINGERPRINT_ACQUIRED_START); } private void successfulFingerprintAuth() { mKeyguardUpdateMonitor.mFingerprintAuthenticationCallback .onAuthenticationSucceeded( new FingerprintManager.AuthenticationResult(null, null, mCurrentUserId, true)); } private void triggerSuccessfulFaceAuth() { mKeyguardUpdateMonitor.requestFaceAuth(FaceAuthApiRequestReason.UDFPS_POINTER_DOWN); verify(mFaceManager).authenticate(any(), Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardListenModel.kt +4 −3 Original line number Diff line number Diff line Loading @@ -50,10 +50,9 @@ data class KeyguardFaceListenModel( override val listening: Boolean, // keep sorted val authInterruptActive: Boolean, val becauseCannotSkipBouncer: Boolean, val biometricSettingEnabledForUser: Boolean, val bouncerFullyShown: Boolean, val faceAuthenticated: Boolean, val faceAndFpNotAuthenticated: Boolean, val faceDisabled: Boolean, val faceLockedOut: Boolean, val fpLockedOut: Boolean, Loading @@ -67,6 +66,8 @@ data class KeyguardFaceListenModel( val secureCameraLaunched: Boolean, val switchingUser: Boolean, val udfpsBouncerShowing: Boolean, val udfpsFingerDown: Boolean, val userNotTrustedOrDetectionIsNeeded: Boolean, ) : KeyguardListenModel() /** * Verbose debug information associated with [KeyguardUpdateMonitor.shouldTriggerActiveUnlock]. Loading
packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +14 −12 Original line number Diff line number Diff line Loading @@ -810,9 +810,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab } // Don't send cancel if authentication succeeds mFingerprintCancelSignal = null; mLogger.logFingerprintSuccess(userId, isStrongBiometric); updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE, FACE_AUTH_UPDATED_FP_AUTHENTICATED); mLogger.logFingerprintSuccess(userId, isStrongBiometric); for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { Loading Loading @@ -2726,9 +2726,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab final boolean canBypass = mKeyguardBypassController != null && mKeyguardBypassController.canBypass(); // There's no reason to ask the HAL for authentication when the user can dismiss the // bouncer, unless we're bypassing and need to auto-dismiss the lock screen even when // TrustAgents or biometrics are keeping the device unlocked. final boolean becauseCannotSkipBouncer = !getUserCanSkipBouncer(user) || canBypass; // bouncer because the user is trusted, unless we're bypassing and need to auto-dismiss // the lock screen even when TrustAgents are keeping the device unlocked. final boolean userNotTrustedOrDetectionIsNeeded = !getUserHasTrust(user) || canBypass; // Scan even when encrypted or timeout to show a preemptive bouncer when bypassing. // Lock-down mode shouldn't scan, since it is more explicit. Loading @@ -2745,11 +2745,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab strongAuthAllowsScanning = false; } // If the face has recently been authenticated do not attempt to authenticate again. final boolean faceAuthenticated = getIsFaceAuthenticated(); // If the face or fp has recently been authenticated do not attempt to authenticate again. final boolean faceAndFpNotAuthenticated = !getUserUnlockedWithBiometric(user); final boolean faceDisabledForUser = isFaceDisabled(user); final boolean biometricEnabledForUser = mBiometricEnabledForUser.get(user); final boolean shouldListenForFaceAssistant = shouldListenForFaceAssistant(); final boolean isUdfpsFingerDown = mAuthController.isUdfpsFingerDown(); // Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an // instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware. Loading @@ -2759,13 +2760,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab || mOccludingAppRequestingFace || awakeKeyguard || shouldListenForFaceAssistant || mAuthController.isUdfpsFingerDown() || isUdfpsFingerDown || mUdfpsBouncerShowing) && !mSwitchingUser && !faceDisabledForUser && becauseCannotSkipBouncer && !mSwitchingUser && !faceDisabledForUser && userNotTrustedOrDetectionIsNeeded && !mKeyguardGoingAway && biometricEnabledForUser && strongAuthAllowsScanning && mIsPrimaryUser && (!mSecureCameraLaunched || mOccludingAppRequestingFace) && !faceAuthenticated && faceAndFpNotAuthenticated && !mGoingToSleep // We only care about fp locked out state and not face because we still trigger // face auth even when face is locked out to show the user a message that face Loading @@ -2779,10 +2780,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab user, shouldListen, mAuthInterruptActive, becauseCannotSkipBouncer, biometricEnabledForUser, mPrimaryBouncerFullyShown, faceAuthenticated, faceAndFpNotAuthenticated, faceDisabledForUser, isFaceLockedOut(), fpLockedOut, Loading @@ -2795,7 +2795,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab strongAuthAllowsScanning, mSecureCameraLaunched, mSwitchingUser, mUdfpsBouncerShowing)); mUdfpsBouncerShowing, isUdfpsFingerDown, userNotTrustedOrDetectionIsNeeded)); return shouldListen; } Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardListenQueueTest.kt +3 −2 Original line number Diff line number Diff line Loading @@ -84,10 +84,9 @@ private fun faceModel(user: Int) = KeyguardFaceListenModel( userId = user, listening = false, authInterruptActive = false, becauseCannotSkipBouncer = false, biometricSettingEnabledForUser = false, bouncerFullyShown = false, faceAuthenticated = false, faceAndFpNotAuthenticated = false, faceDisabled = false, faceLockedOut = false, fpLockedOut = false, Loading @@ -101,4 +100,6 @@ private fun faceModel(user: Int) = KeyguardFaceListenModel( secureCameraLaunched = false, switchingUser = false, udfpsBouncerShowing = false, udfpsFingerDown = false, userNotTrustedOrDetectionIsNeeded = false )
packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +32 −0 Original line number Diff line number Diff line Loading @@ -1381,6 +1381,29 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse(); } @Test public void testShouldListenForFace_whenFpIsAlreadyAuthenticated_returnsFalse() throws RemoteException { // Face auth should run when the following is true. bouncerFullyVisibleAndNotGoingToSleep(); keyguardNotGoingAway(); currentUserIsPrimary(); strongAuthNotRequired(); biometricsEnabledForCurrentUser(); currentUserDoesNotHaveTrust(); biometricsNotDisabledThroughDevicePolicyManager(); userNotCurrentlySwitching(); mTestableLooper.processAllMessages(); assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue(); successfulFingerprintAuth(); mTestableLooper.processAllMessages(); assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse(); } @Test public void testShouldListenForFace_whenUserIsNotPrimary_returnsFalse() throws RemoteException { cleanupKeyguardUpdateMonitor(); Loading Loading @@ -1935,6 +1958,15 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { .onAuthenticationAcquired(FINGERPRINT_ACQUIRED_START); } private void successfulFingerprintAuth() { mKeyguardUpdateMonitor.mFingerprintAuthenticationCallback .onAuthenticationSucceeded( new FingerprintManager.AuthenticationResult(null, null, mCurrentUserId, true)); } private void triggerSuccessfulFaceAuth() { mKeyguardUpdateMonitor.requestFaceAuth(FaceAuthApiRequestReason.UDFPS_POINTER_DOWN); verify(mFaceManager).authenticate(any(), Loading