From ac8355b60e3e4edbbb08a01f9174e2e95a91e699 Mon Sep 17 00:00:00 2001 From: Xiaowen Lei Date: Wed, 23 Mar 2022 17:00:51 +0000 Subject: [PATCH] Remove unnecessary (and potentially problematic) call of notifyDefaultDisplayCallbacks. Since the KEYGUARD_TIMEOUT message is sent to the handler before the SHOW message, when handling KEYGUARD_TIMEOUT, mShowing is still false. The notifyDefaultDisplayCallbacks is later called again in setKeyguardShowing, after showing has been updated to true. Also updated setKeyguardShowing to not call notifyDefaultDisplayCallbacks when only aodShowing is different. Bug: 221866693 Fix: 221866693 Test: manually on device with instructions in the bug. Test: manually on device with added logging. Change-Id: Ie43b1c629e94307a617fcf57c9ebc4ff3e982fbf --- .../android/systemui/keyguard/KeyguardViewMediator.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 758609a541e2f..0486fee4239d0 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -2009,7 +2009,6 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, case KEYGUARD_TIMEOUT: synchronized (KeyguardViewMediator.this) { doKeyguardLocked((Bundle) msg.obj); - notifyDefaultDisplayCallbacks(mShowing); } break; case DISMISS: @@ -2955,14 +2954,18 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, private void setShowingLocked(boolean showing, boolean forceCallbacks) { final boolean aodShowing = mDozing && !mScreenOnCoordinator.getWakeAndUnlocking(); - final boolean notifyDefaultDisplayCallbacks = showing != mShowing + final boolean notifyDefaultDisplayCallbacks = showing != mShowing || forceCallbacks; + final boolean updateActivityLockScreenState = showing != mShowing || aodShowing != mAodShowing || forceCallbacks; mShowing = showing; mAodShowing = aodShowing; if (notifyDefaultDisplayCallbacks) { notifyDefaultDisplayCallbacks(showing); + } + if (updateActivityLockScreenState) { updateActivityLockScreenState(showing, aodShowing); } + } private void notifyDefaultDisplayCallbacks(boolean showing) {