Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b71c7b40 authored by Issei Suzuki's avatar Issei Suzuki Committed by Robin Lee
Browse files

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
parent 02ec45ac
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3482,8 +3482,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 {
+2 −1
Original line number Diff line number Diff line
@@ -164,9 +164,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);

    /**
     * @param notify {@code true} if the status change should be immediately notified via
+4 −2
Original line number Diff line number Diff line
@@ -401,8 +401,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()
+1 −1
Original line number Diff line number Diff line
@@ -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) {