Run unlock animation when device is already unlocked

When the screen times out, the device may not immediately lock based
upon a user setting. In this case, keyguard is visible but not fully
locked. If the user uses finger auth, MODE_ONLY_WAKE is used but the
keyguard is not properly dismissed. Use MODE_WAKE_AND_UNLOCK to run
all animations.

Fixes: 231553219
Test: atest BiometricsUnlockControllerTest
Change-Id: I8ff2c2f983b64c7f62d7025fce227a2dd9eabf04
This commit is contained in:
Matt Pietal
2022-05-31 16:08:40 -04:00
parent eb700c0090
commit ea5a86dcd4
2 changed files with 22 additions and 0 deletions

View File

@@ -558,6 +558,9 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
if (!mUpdateMonitor.isDeviceInteractive()) {
if (!mKeyguardViewController.isShowing()
&& !mScreenOffAnimationController.isKeyguardShowDelayed()) {
if (mKeyguardStateController.isUnlocked()) {
return MODE_WAKE_AND_UNLOCK;
}
return MODE_ONLY_WAKE;
} else if (mDozeScrimController.isPulsing() && unlockingAllowed) {
return MODE_WAKE_AND_UNLOCK_PULSING;

View File

@@ -124,6 +124,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true);
when(mKeyguardStateController.isUnlocked()).thenReturn(false);
when(mKeyguardBypassController.onBiometricAuthenticated(any(), anyBoolean()))
.thenReturn(true);
when(mAuthController.isUdfpsFingerDown()).thenReturn(false);
@@ -185,6 +186,24 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
.isEqualTo(BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING);
}
@Test
public void onBiometricAuthenticated_whenDeviceIsAlreadyUnlocked_wakeAndUnlock() {
reset(mUpdateMonitor);
reset(mStatusBarKeyguardViewManager);
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
when(mKeyguardStateController.isUnlocked()).thenReturn(true);
when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);
when(mDozeScrimController.isPulsing()).thenReturn(false);
// the value of isStrongBiometric doesn't matter here since we only care about the returned
// value of isUnlockingWithBiometricAllowed()
mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
BiometricSourceType.FINGERPRINT, true /* isStrongBiometric */);
verify(mKeyguardViewMediator).onWakeAndUnlocking();
assertThat(mBiometricUnlockController.getMode())
.isEqualTo(BiometricUnlockController.MODE_WAKE_AND_UNLOCK);
}
@Test
public void onBiometricAuthenticated_whenFingerprint_notifyKeyguardAuthenticated() {
when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);