From 757317e2e2aef1284c8ebbbe8d81d45c88fcc307 Mon Sep 17 00:00:00 2001 From: Josh Tsuji Date: Mon, 13 Dec 2021 18:18:41 -0500 Subject: [PATCH] Don't reset the keyguard if it's going away. If we re-lock the keyguard *while* it's unlocking, we end up in a state where the AOD UI is visible, but we are not actually locked and can unlock the device with no authentication. This is possible with and without remote animations enabled, but is easier to trigger when they're enabled. "Keyguard reset" is done if we go to sleep while the keyguard is showing, and causes the keyguard views to be reset. This is not sufficient if the keyguard is going away as it should be re-shown instead of only reset. Fixes: 210705299 Test: atest SystemUITests Test: interrupt unlock by locking again, verify the device is actually locked Change-Id: Ie7aeab50cdd8fb6e3a79f6ef1e0cb21ca61d665d --- .../com/android/systemui/keyguard/KeyguardViewMediator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 8d07336451175..35e0458e91e88 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1025,7 +1025,10 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable, if (!mExternallyEnabled) { hideLocked(); } - } else if (mShowing) { + } else if (mShowing && !mKeyguardStateController.isKeyguardGoingAway()) { + // If we are going to sleep but the keyguard is showing (and will continue to be + // showing, not in the process of going away) then reset its state. Otherwise, let + // this fall through and explicitly re-lock the keyguard. mPendingReset = true; } else if ( (offReason == WindowManagerPolicyConstants.OFF_BECAUSE_OF_TIMEOUT