Skip to content

Commit ce3d276

Browse files
Issei SuzukiAndroid Build Coastguard Worker
authored andcommitted
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 (cherry picked from commit b71c7b4) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:b323776b1b205a4b266e16fbdc4095871cc4d9ec) Merged-In: I4cd7e62e6800897cce50a5376495c499a0b9ad10 Change-Id: I4cd7e62e6800897cce50a5376495c499a0b9ad10
1 parent 25b0c7f commit ce3d276

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

services/core/java/com/android/server/policy/PhoneWindowManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3312,8 +3312,8 @@ public void registerShortcutKey(long shortcutCode, IShortcutService shortcutServ
33123312
}
33133313

33143314
@Override
3315-
public void onKeyguardOccludedChangedLw(boolean occluded) {
3316-
if (mKeyguardDelegate != null && mKeyguardDelegate.isShowing()) {
3315+
public void onKeyguardOccludedChangedLw(boolean occluded, boolean waitAppTransition) {
3316+
if (mKeyguardDelegate != null && waitAppTransition) {
33173317
mPendingKeyguardOccluded = occluded;
33183318
mKeyguardOccludedChanged = true;
33193319
} else {

services/core/java/com/android/server/policy/WindowManagerPolicy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ void registerShortcutKey(long shortcutCode, IShortcutService shortcutKeyReceiver
166166

167167
/**
168168
* Called when the Keyguard occluded state changed.
169+
*
169170
* @param occluded Whether Keyguard is currently occluded or not.
170171
*/
171-
void onKeyguardOccludedChangedLw(boolean occluded);
172+
void onKeyguardOccludedChangedLw(boolean occluded, boolean waitAppTransition);
172173

173174
/**
174175
* Applies a keyguard occlusion change if one happened.

services/core/java/com/android/server/wm/KeyguardController.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,10 @@ private void handleOccludedChanged(int displayId, @Nullable ActivityRecord topAc
403403
return;
404404
}
405405

406-
mWindowManager.mPolicy.onKeyguardOccludedChangedLw(isDisplayOccluded(DEFAULT_DISPLAY));
407-
if (isKeyguardLocked(displayId)) {
406+
final boolean waitAppTransition = isKeyguardLocked(displayId);
407+
mWindowManager.mPolicy.onKeyguardOccludedChangedLw(isDisplayOccluded(DEFAULT_DISPLAY),
408+
waitAppTransition);
409+
if (waitAppTransition) {
408410
mService.deferWindowLayout();
409411
try {
410412
mRootWindowContainer.getDefaultDisplay()

services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public boolean isKeyguardDrawnLw() {
222222
}
223223

224224
@Override
225-
public void onKeyguardOccludedChangedLw(boolean occluded) {
225+
public void onKeyguardOccludedChangedLw(boolean occluded, boolean waitAppTransition) {
226226
}
227227

228228
public void setSafeMode(boolean safeMode) {

0 commit comments

Comments
 (0)