summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Selim Cinek <cinek@google.com> 2022-12-13 21:12:35 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2022-12-13 21:12:35 +0000
commit3d0e4a42a904c8502285f44e81cb8de2d2ecf40e (patch)
tree0af6b0bb4520ac09daf03223dfd2bf98e883c29a
parentfc2290ec40e60e9e15543a9d908699468e1512dc (diff)
parent4d26393bce9ec59d925895b8a606c4a9bc56e889 (diff)
Merge "Don't re-lock if we're wake and unlocking." into tm-qpr-dev am: 5bd31e0391 am: 4d26393bce
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20650080 Change-Id: I3d2f85c1190556ebca26cd3b2bbbc5577e34cc45 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java39
2 files changed, 40 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 36c939d1156e..d6418d0829a3 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -1614,7 +1614,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;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
index 798839dcc1f6..804960dc3b18 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
@@ -168,6 +168,45 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
}
@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);
verify(mStatusBarKeyguardViewManager, never()).setKeyguardGoingAwayState(anyBoolean());