diff options
| author | 2023-03-16 19:24:01 +0100 | |
|---|---|---|
| committer | 2023-03-22 16:43:00 +0100 | |
| commit | 8a8169dae5f7d0912e39fcea58c54d4491f016f0 (patch) | |
| tree | 6cbedb38e0b6fc7b0fa0ae434c807f2e8a5ee008 | |
| parent | 0af487566de8908c1ccad3f94ae41225757335c3 (diff) | |
Hold onto occluded change until it's committed
When we're delaying commit of setKeyguardOccluded due to a transition
taking over instead to synchronise occlude status more nicely, we hold
onto the final occlude status so we can be eventually consistent even
if the systemui restarts or gets something wrong.
The "notify" parameter in setKeyguardOccludedLw was risky because when
false it could lead to SystemUI not being informed of an update, but
the system server still considering its job done because the flag for
pending updates was cleared anyway.
This is a speculative fix to help the attached issue resolved itself
whenever it happens.
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:52d8053880b1be999ebc75730333b2d9ea326fb4)
Test: atest android.server.wm.KeyguardTests
Bug: 269892931
Merged-In: I7d3ac020db34d8a15d18b25de07231bda83cbcf0
Change-Id: I7d3ac020db34d8a15d18b25de07231bda83cbcf0
| -rw-r--r-- | services/core/java/com/android/server/policy/PhoneWindowManager.java | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index be4fe09d593c..afd9316092ff 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -3341,8 +3341,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mPendingKeyguardOccluded = occluded; mKeyguardOccludedChanged = true; } else { - setKeyguardOccludedLw(occluded, false /* force */, - false /* transitionStarted */); + setKeyguardOccludedLw(occluded, false /* transitionStarted */); } } @@ -3351,8 +3350,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (mKeyguardOccludedChanged) { if (DEBUG_KEYGUARD) Slog.d(TAG, "transition/occluded changed occluded=" + mPendingKeyguardOccluded); - if (setKeyguardOccludedLw(mPendingKeyguardOccluded, false /* force */, - transitionStarted)) { + if (setKeyguardOccludedLw(mPendingKeyguardOccluded, transitionStarted)) { return FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_WALLPAPER; } } @@ -3601,22 +3599,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { } /** - * Updates the occluded state of the Keyguard. + * Updates the occluded state of the Keyguard immediately via + * {@link com.android.internal.policy.IKeyguardService}. * * @param isOccluded Whether the Keyguard is occluded by another window. - * @param force notify the occluded status to KeyguardService and update flags even though - * occlude status doesn't change. * @param transitionStarted {@code true} if keyguard (un)occluded transition started. * @return Whether the flags have changed and we have to redo the layout. */ - private boolean setKeyguardOccludedLw(boolean isOccluded, boolean force, - boolean transitionStarted) { + private boolean setKeyguardOccludedLw(boolean isOccluded, boolean transitionStarted) { if (DEBUG_KEYGUARD) Slog.d(TAG, "setKeyguardOccluded occluded=" + isOccluded); - mKeyguardOccludedChanged = false; - if (isKeyguardOccluded() == isOccluded && !force) { - return false; - } - final boolean showing = mKeyguardDelegate.isShowing(); final boolean animate = showing && !isOccluded; // When remote animation is enabled for keyguard (un)occlude transition, KeyguardService @@ -3624,7 +3615,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { // to notify here. final boolean notify = !WindowManagerService.sEnableRemoteKeyguardOccludeAnimation || !transitionStarted; - mKeyguardDelegate.setOccluded(isOccluded, animate, notify); + if (notify) { + mKeyguardOccludedChanged = false; + mKeyguardDelegate.setOccluded(isOccluded, animate, notify); + } return showing; } |