summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIssei Suzuki <issei@google.com>2023-02-10 17:10:28 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-03-17 03:09:19 +0000
commit05f193365428996acec0633ebf088987325d764b (patch)
tree34d667c20ccd9821aaedf0e7b809302c3daafc34
parentf0af195296dec9170cec1787240605f5d5768e69 (diff)
downloadbase-05f193365428996acec0633ebf088987325d764b.tar.gz
FIx occlusion status mismatch issue when screen turns off and on quickly
When KeyguardController detects occlude status change while the keyguard is shown, it requests (UN)OCCLUDE app transition and PhoneWindowManager defers committing the occlude state. However KeyguardController and PhoneWindowManager use different predicates to decide if keygaurd is shown or not. In case the predicates return different value, occlude state in KeyguardController and PhoneWindowManager remain inconsistent. Test: manual 1. set secure lock method (pattern) 2. launch calculator app 3. push power button to screen off 4. just before the screen turns off, push power button to screen on again Bug: 232002936 Change-Id: I4cd7e62e6800897cce50a5376495c499a0b9ad10 (cherry picked from commit b71c7b40e7d0ade68e1d1a0ee93c8370edf6e415) (cherry picked from commit on googleplex-android-review.googlesource.com host: b323776b1b205a4b266e16fbdc4095871cc4d9ec) Merged-In: I4cd7e62e6800897cce50a5376495c499a0b9ad10
-rw-r--r--services/core/java/com/android/server/policy/PhoneWindowManager.java4
-rw-r--r--services/core/java/com/android/server/policy/WindowManagerPolicy.java3
-rw-r--r--services/core/java/com/android/server/wm/KeyguardController.java6
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java2
4 files changed, 9 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java
index 5285f63dcc44..adc74e6cab5d 100644
--- a/services/core/java/com/android/server/policy/PhoneWindowManager.java
+++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java
@@ -3312,8 +3312,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
@Override
- public void onKeyguardOccludedChangedLw(boolean occluded) {
- if (mKeyguardDelegate != null && mKeyguardDelegate.isShowing()) {
+ public void onKeyguardOccludedChangedLw(boolean occluded, boolean waitAppTransition) {
+ if (mKeyguardDelegate != null && waitAppTransition) {
mPendingKeyguardOccluded = occluded;
mKeyguardOccludedChanged = true;
} else {
diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
index 4f00992c713e..77007fa229a2 100644
--- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java
+++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java
@@ -166,9 +166,10 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
/**
* Called when the Keyguard occluded state changed.
+ *
* @param occluded Whether Keyguard is currently occluded or not.
*/
- void onKeyguardOccludedChangedLw(boolean occluded);
+ void onKeyguardOccludedChangedLw(boolean occluded, boolean waitAppTransition);
/**
* Applies a keyguard occlusion change if one happened.
diff --git a/services/core/java/com/android/server/wm/KeyguardController.java b/services/core/java/com/android/server/wm/KeyguardController.java
index 48258a11d13a..1d21b9d8c141 100644
--- a/services/core/java/com/android/server/wm/KeyguardController.java
+++ b/services/core/java/com/android/server/wm/KeyguardController.java
@@ -403,8 +403,10 @@ class KeyguardController {
return;
}
- mWindowManager.mPolicy.onKeyguardOccludedChangedLw(isDisplayOccluded(DEFAULT_DISPLAY));
- if (isKeyguardLocked(displayId)) {
+ final boolean waitAppTransition = isKeyguardLocked(displayId);
+ mWindowManager.mPolicy.onKeyguardOccludedChangedLw(isDisplayOccluded(DEFAULT_DISPLAY),
+ waitAppTransition);
+ if (waitAppTransition) {
mService.deferWindowLayout();
try {
mRootWindowContainer.getDefaultDisplay()
diff --git a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java
index d2cb7ba5d311..e2db2e6b19e1 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java
@@ -222,7 +222,7 @@ class TestWindowManagerPolicy implements WindowManagerPolicy {
}
@Override
- public void onKeyguardOccludedChangedLw(boolean occluded) {
+ public void onKeyguardOccludedChangedLw(boolean occluded, boolean waitAppTransition) {
}
public void setSafeMode(boolean safeMode) {