No face auth bouncer delay if posture unsupported

Test: atest PrimaryBouncerInteractorTest
Test: manually check the open posture on foldable doesn't trigger
bouncer delay when the flag is enabled & face is enrolled
Fixes: 286089157

Change-Id: I76694a11ec95fa2eb8d209d771b832147123c754
This commit is contained in:
Beverly
2023-06-07 19:46:23 +00:00
parent e77973b4b1
commit 6862627793
3 changed files with 29 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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()

View File

@@ -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)
@@ -423,6 +424,25 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
verify(repository).setPrimaryShowingSoon(false)
}
@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 {