Merge "Run unlock animation on MODE_ONLY_WAKE" into tm-dev

This commit is contained in:
TreeHugger Robot
2022-05-25 23:03:07 +00:00
committed by Android (Google) Code Review
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"); * Receive a wake event from outside this class (most likely bio auth).
mWakeAndUnlocking = true; */
public void onWake(boolean withUnlock) {
Trace.beginSection("KeyguardViewMediator#onWake");
mWakeAndUnlocking = withUnlock;
keyguardDone(); keyguardDone();
Trace.endSection(); Trace.endSection();

View File

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

View File

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