Test when WM needs to be reshown...
... after a keyguard exit animation starts but power manager then says
the device is not interactive. This should show keyguard and tell WM.
Fixes: 301751150
Test: atest KeyguardViewMediatorTest
Flag: N/A
Change-Id: I30b53af60eed2cd2eb000c0413cf38bab3f41461
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 4e6a872..fe9865b 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -2720,9 +2720,7 @@
private void updateActivityLockScreenState(boolean showing, boolean aodShowing) {
mUiBgExecutor.execute(() -> {
- if (DEBUG) {
- Log.d(TAG, "updateActivityLockScreenState(" + showing + ", " + aodShowing + ")");
- }
+ Log.d(TAG, "updateActivityLockScreenState(" + showing + ", " + aodShowing + ")");
if (mFeatureFlags.isEnabled(Flags.KEYGUARD_WM_STATE_REFACTOR)) {
// Handled in WmLockscreenVisibilityManager if flag is enabled.
@@ -3251,10 +3249,10 @@
DejankUtils.postAfterTraversal(() -> {
if (!mPM.isInteractive() && !mPendingLock) {
Log.e(TAG, "exitKeyguardAndFinishSurfaceBehindRemoteAnimation#postAfterTraversal:"
- + "mPM.isInteractive()=" + mPM.isInteractive()
- + "mPendingLock=" + mPendingLock + "."
- + "One of these being false means we re-locked the device during unlock. "
- + "Do not proceed to finish keyguard exit and unlock.");
+ + " mPM.isInteractive()=" + mPM.isInteractive()
+ + " mPendingLock=" + mPendingLock + "."
+ + " One of these being false means we re-locked the device during unlock."
+ + " Do not proceed to finish keyguard exit and unlock.");
doKeyguardLocked(null);
finishSurfaceBehindRemoteAnimation(true /* showKeyguard */);
// Ensure WM is notified that we made a decision to show
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 b16c352..d246f0e 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
@@ -910,6 +910,20 @@
assertATMSAndKeyguardViewMediatorStatesMatch();
}
+ @Test
+ @TestableLooper.RunWithLooper(setAsMainLooper = true)
+ public void testStartKeyguardExitAnimation_whenNotInteractive_doesShowAndUpdatesWM() {
+ // If the exit animation was triggered but the device became non-interactive, make sure
+ // relock happens
+ when(mPowerManager.isInteractive()).thenReturn(false);
+
+ startMockKeyguardExitAnimation();
+ cancelMockKeyguardExitAnimation();
+
+ verify(mStatusBarKeyguardViewManager, atLeast(1)).show(null);
+ assertATMSAndKeyguardViewMediatorStatesMatch();
+ }
+
/**
* Interactions with the ActivityTaskManagerService and others are posted to an executor that
* doesn't use the testable looper. Use this method to ensure those are run as well.