Fix missing KeyguardStatusView after cancelling fps login

FPS login will trigger keyguard fading away. If that is cancelled by
pressing the side button, then the keyguard will instead transition
to AOD. Depending on the timing of the transition, this can leave
keyguard fading away as set, causing any subsequent animation that
doesn't reset it correctly to hide the KeyguardStatusView.

Fixes: 262112441
Test: Manually verified that race doesn't leave keyguard in bad state
Change-Id: Id20a300edfa52433642747dbcdb1ecceeffadba8
This commit is contained in:
Hawkwood Glazier
2023-01-12 21:11:48 +00:00
parent 2f927cffc8
commit 3df40e98cb
2 changed files with 15 additions and 0 deletions

View File

@@ -3772,6 +3772,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
});
} else if (mDozing && !unlocking) {
mScrimController.transitionTo(ScrimState.AOD);
// This will cancel the keyguardFadingAway animation if it is running. We need to do
// this as otherwise it can remain pending and leave keyguard in a weird state.
mUnlockScrimCallback.onCancelled();
} else if (mKeyguardStateController.isShowing() && !isOccluded() && !unlocking) {
mScrimController.transitionTo(ScrimState.KEYGUARD);
} else if (mKeyguardStateController.isShowing() && mKeyguardUpdateMonitor.isDreaming()

View File

@@ -1009,6 +1009,18 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
verify(mScrimController).transitionTo(eq(ScrimState.KEYGUARD));
}
@Test
public void testSetDozingNotUnlocking_transitionToAOD_cancelKeyguardFadingAway() {
setDozing(true);
when(mKeyguardStateController.isShowing()).thenReturn(false);
when(mKeyguardStateController.isKeyguardFadingAway()).thenReturn(true);
mCentralSurfaces.updateScrimController();
verify(mScrimController, times(2)).transitionTo(eq(ScrimState.AOD));
verify(mStatusBarKeyguardViewManager).onKeyguardFadedAway();
}
@Test
public void testShowKeyguardImplementation_setsState() {
when(mLockscreenUserManager.getCurrentProfiles()).thenReturn(new SparseArray<>());