From aa4bf788f22a3728a31733f21648632a2819f57e Mon Sep 17 00:00:00 2001 From: Chris Li Date: Tue, 24 Mar 2020 20:33:21 -0700 Subject: [PATCH] Fix locked second screen on boot Before, when hid and showed a different keyguard presentation, the onDismissListener would remove the newly added one, which caused the later presentation existence check to return the incorrect value. Now, we add a check to only remove the dismissed presentation. Bug: 152253158 Test: MultiDisplayKeyguardTests#testUnlockScreen_secondDisplayChanged_dismissesKeyguardOnUnlock MultiDisplayKeyguardTests#testUnlockScreen_decoredSystemDisplayChanged_dismissesKeyguardOnUnlock Change-Id: I9dabc15e1228cc9417ed24981b332b8f1af818c8 --- .../src/com/android/keyguard/KeyguardDisplayManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java index 11bf24d27170b..e3d9a267a149d 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardDisplayManager.java @@ -126,12 +126,14 @@ public class KeyguardDisplayManager { final int displayId = display.getDisplayId(); Presentation presentation = mPresentations.get(displayId); if (presentation == null) { - presentation = new KeyguardPresentation(mContext, display, mInjectableInflater); - presentation.setOnDismissListener(dialog -> { - if (null != mPresentations.get(displayId)) { + final Presentation newPresentation = + new KeyguardPresentation(mContext, display, mInjectableInflater); + newPresentation.setOnDismissListener(dialog -> { + if (newPresentation.equals(mPresentations.get(displayId))) { mPresentations.remove(displayId); } }); + presentation = newPresentation; try { presentation.show(); } catch (WindowManager.InvalidDisplayException ex) {