Run unlock animation on MODE_ONLY_WAKE

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 bio auth, MODE_ONLY_WAKE is used but the
keyguard is not properly dismissed. Issue a call to keyguardDone so
that the correct animation is shown.

Fixes: 231553219
Test: atest BiometricsUnlockControllerTest

Change-Id: Ib3fa05f2a1054b122a80ca5d27b0a99d12dd27f2
This commit is contained in:
Matt Pietal
2022-05-25 10:01:52 -04:00
parent 0b2c39c7b2
commit 5481291dca
3 changed files with 27 additions and 5 deletions

View File

@@ -2816,9 +2816,12 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
}
}
public void onWakeAndUnlocking() {
Trace.beginSection("KeyguardViewMediator#onWakeAndUnlocking");
mWakeAndUnlocking = true;
/**
* Receive a wake event from outside this class (most likely bio auth).
*/
public void onWake(boolean withUnlock) {
Trace.beginSection("KeyguardViewMediator#onWake");
mWakeAndUnlocking = withUnlock;
keyguardDone();
Trace.endSection();

View File

@@ -500,10 +500,12 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mUpdateMonitor.awakenFromDream();
}
mNotificationShadeWindowController.setNotificationShadeFocusable(false);
mKeyguardViewMediator.onWakeAndUnlocking();
mKeyguardViewMediator.onWake(true /* withUnlock */);
Trace.endSection();
break;
case MODE_ONLY_WAKE:
mKeyguardViewMediator.onWake(false /* withUnlock */);
break;
case MODE_NONE:
break;
}

View File

@@ -180,11 +180,28 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
BiometricSourceType.FINGERPRINT, true /* isStrongBiometric */);
verify(mKeyguardViewMediator).onWakeAndUnlocking();
verify(mKeyguardViewMediator).onWake(true /* withUnlock */);
assertThat(mBiometricUnlockController.getMode())
.isEqualTo(BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING);
}
@Test
public void onBiometricAuthenticated_whenFingerprintAndInteractive_wakeWithoutUnlock() {
reset(mUpdateMonitor);
reset(mStatusBarKeyguardViewManager);
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
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).onWake(false /* withUnlock */);
assertThat(mBiometricUnlockController.getMode())
.isEqualTo(BiometricUnlockController.MODE_ONLY_WAKE);
}
@Test
public void onBiometricAuthenticated_whenFingerprint_notifyKeyguardAuthenticated() {
when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);