Merge "Don't re-lock if we're wake and unlocking." into tm-qpr-dev am: 5bd31e0391

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20650080

Change-Id: I4750fb47cd73509bec5adbe6cb5611dfcc4039af
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Selim Cinek
2022-12-13 20:30:29 +00:00
committed by Automerger Merge Worker
2 changed files with 40 additions and 1 deletions

View File

@@ -1613,7 +1613,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
// TODO: Rename all screen off/on references to interactive/sleeping
synchronized (this) {
mDeviceInteractive = true;
if (mPendingLock && !cameraGestureTriggered) {
if (mPendingLock && !cameraGestureTriggered && !mWakeAndUnlocking) {
doKeyguardLocked(null);
}
mAnimatingScreenOff = false;

View File

@@ -167,6 +167,45 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
verify(mStatusBarKeyguardViewManager, never()).setKeyguardGoingAwayState(anyBoolean());
}
@Test
@TestableLooper.RunWithLooper(setAsMainLooper = true)
public void testOnStartedWakingUp_whileSleeping_ifWakeAndUnlocking_doesNotShowKeyguard() {
when(mLockPatternUtils.isLockScreenDisabled(anyInt())).thenReturn(false);
when(mLockPatternUtils.getPowerButtonInstantlyLocks(anyInt())).thenReturn(true);
mViewMediator.onSystemReady();
TestableLooper.get(this).processAllMessages();
mViewMediator.setShowingLocked(false);
TestableLooper.get(this).processAllMessages();
mViewMediator.onStartedGoingToSleep(OFF_BECAUSE_OF_USER);
mViewMediator.onWakeAndUnlocking();
mViewMediator.onStartedWakingUp(OFF_BECAUSE_OF_USER, false);
TestableLooper.get(this).processAllMessages();
assertFalse(mViewMediator.isShowingAndNotOccluded());
verify(mKeyguardStateController, never()).notifyKeyguardState(eq(true), anyBoolean());
}
@Test
@TestableLooper.RunWithLooper(setAsMainLooper = true)
public void testOnStartedWakingUp_whileSleeping_ifNotWakeAndUnlocking_showsKeyguard() {
when(mLockPatternUtils.isLockScreenDisabled(anyInt())).thenReturn(false);
when(mLockPatternUtils.getPowerButtonInstantlyLocks(anyInt())).thenReturn(true);
mViewMediator.onSystemReady();
TestableLooper.get(this).processAllMessages();
mViewMediator.setShowingLocked(false);
TestableLooper.get(this).processAllMessages();
mViewMediator.onStartedGoingToSleep(OFF_BECAUSE_OF_USER);
mViewMediator.onStartedWakingUp(OFF_BECAUSE_OF_USER, false);
TestableLooper.get(this).processAllMessages();
assertTrue(mViewMediator.isShowingAndNotOccluded());
}
@Test
public void testRegisterDumpable() {
verify(mDumpManager).registerDumpable(KeyguardViewMediator.class.getName(), mViewMediator);