diff options
3 files changed, 29 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index f5b98e36453f..80080e6cb834 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -3168,6 +3168,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab || (posture == mConfigFaceAuthSupportedPosture); } + /** + * If the current device posture allows face auth to run. + */ + public boolean doesCurrentPostureAllowFaceAuth() { + return doesPostureAllowFaceAuth(mPostureState); + } + private void logListenerModelData(@NonNull KeyguardListenModel model) { mLogger.logKeyguardListenerModel(model); if (model instanceof KeyguardFingerprintListenModel) { diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/PrimaryBouncerInteractor.kt b/packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/PrimaryBouncerInteractor.kt index e1545a4d432e..7c90735fc0fc 100644 --- a/packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/PrimaryBouncerInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/bouncer/domain/interactor/PrimaryBouncerInteractor.kt @@ -391,7 +391,8 @@ constructor( private fun usePrimaryBouncerPassiveAuthDelay(): Boolean { val canRunFaceAuth = keyguardStateController.isFaceAuthEnabled && - keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(BiometricSourceType.FACE) + keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(BiometricSourceType.FACE) && + keyguardUpdateMonitor.doesCurrentPostureAllowFaceAuth() val canRunActiveUnlock = currentUserActiveUnlockRunning && keyguardUpdateMonitor.canTriggerActiveUnlockBasedOnDeviceState() diff --git a/packages/SystemUI/tests/src/com/android/systemui/bouncer/domain/interactor/PrimaryBouncerInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/bouncer/domain/interactor/PrimaryBouncerInteractorTest.kt index 820f863b19ef..f892453b3a57 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/bouncer/domain/interactor/PrimaryBouncerInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/bouncer/domain/interactor/PrimaryBouncerInteractorTest.kt @@ -407,6 +407,7 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() { whenever(keyguardStateController.isFaceAuthEnabled).thenReturn(true) whenever(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(BiometricSourceType.FACE)) .thenReturn(true) + whenever(keyguardUpdateMonitor.doesCurrentPostureAllowFaceAuth()).thenReturn(true) // WHEN bouncer show is requested underTest.show(true) @@ -424,6 +425,25 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() { } @Test + fun noDelayBouncer_biometricsAllowed_postureDoesNotAllowFaceAuth() { + mainHandler.setMode(FakeHandler.Mode.QUEUEING) + + // GIVEN bouncer should not be delayed because device isn't in the right posture for + // face auth + whenever(keyguardStateController.isFaceAuthEnabled).thenReturn(true) + whenever(keyguardUpdateMonitor.isUnlockingWithBiometricAllowed(BiometricSourceType.FACE)) + .thenReturn(true) + whenever(keyguardUpdateMonitor.doesCurrentPostureAllowFaceAuth()).thenReturn(false) + + // WHEN bouncer show is requested + underTest.show(true) + + // THEN primary show & primary showing soon are updated immediately + verify(repository).setPrimaryShow(true) + verify(repository).setPrimaryShowingSoon(false) + } + + @Test fun delayBouncerWhenActiveUnlockPossible() { testScope.run { mainHandler.setMode(FakeHandler.Mode.QUEUEING) |