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

Commit 44742c0e authored by Robert Berry's avatar Robert Berry
Browse files

Fix application overlay visibility bug

System UI components may set the
SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS flag in
WindowManager.LayoutParams to force application overlays to be
invisible. StatusBarViewController is responsible for setting this when
the user locks their phone, and then removing it when the user unlocks
their phone.

Currently there is a bug where, while StatusBar removes this flag, the
update is not propagated through WindowManagerService. This causes
application overlays to be invisible when they should not be. This
affects all application overlays.

Repro steps:

1) Enable rotation if disabled
2) Enable an application overlay (e.g. Live Caption)
3) In portrait orientation, open e.g. YouTube.
4) Rotate to landscape orientation
5) Turn off the phone screen
6) Rotate to portrait orientation
7) Turn on the phone screen and unlock the phone

Application overlays are now invisible. Rotating again fixes it.

This CL fixes the logic error that was causing this bug.

Bug: 133747592
Test: go/wm-smoke
Change-Id: Idab0629765cbe048fc1eb4413e529464cad876ff
parent 5f1fb46e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -2004,6 +2004,7 @@ public class WindowManagerService extends IWindowManager.Stub

            int attrChanges = 0;
            int flagChanges = 0;
            int privateFlagChanges = 0;
            if (attrs != null) {
                displayPolicy.adjustWindowParamsLw(win, attrs, pid, uid);
                // if they don't have the permission, mask out the status bar bits
@@ -2032,6 +2033,7 @@ public class WindowManagerService extends IWindowManager.Stub
                }

                flagChanges = win.mAttrs.flags ^= attrs.flags;
                privateFlagChanges = win.mAttrs.privateFlags ^ attrs.privateFlags;
                attrChanges = win.mAttrs.copyFrom(attrs);
                if ((attrChanges & (WindowManager.LayoutParams.LAYOUT_CHANGED
                        | WindowManager.LayoutParams.SYSTEM_UI_VISIBILITY_CHANGED)) != 0) {
@@ -2049,7 +2051,7 @@ public class WindowManagerService extends IWindowManager.Stub
                    mAccessibilityController.onSomeWindowResizedOrMovedLocked();
                }

                if ((flagChanges & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS) != 0) {
                if ((privateFlagChanges & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS) != 0) {
                    updateNonSystemOverlayWindowsVisibilityIfNeeded(
                            win, win.mWinAnimator.getShown());
                }
@@ -7592,7 +7594,7 @@ public class WindowManagerService extends IWindowManager.Stub
            return;
        }
        final boolean systemAlertWindowsHidden = !mHidingNonSystemOverlayWindows.isEmpty();
        if (surfaceShown) {
        if (surfaceShown && win.hideNonSystemOverlayWindowsWhenVisible()) {
            if (!mHidingNonSystemOverlayWindows.contains(win)) {
                mHidingNonSystemOverlayWindows.add(win);
            }