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

Commit fbc8f413 authored by Arthur Hung's avatar Arthur Hung
Browse files

PointerLocation should not show if display is in mirror mode.

If a virtual display is created without flag FLAG_OWN_CONTENT_ONLY,
and no window initialized, it will automatically enter the mirror mode.

So we need to exclude the pointer location window when checking the
display has content, to make sure it won't leave the mirror mode if there
is no other window exist.

Test: manual
Bug: 138487611
Change-Id: I60d70ea578df4b18b1666d439a2c925f3310351f
parent 05c94cec
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -796,11 +796,15 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
                mTmpApplySurfaceChangesTransactionState.obscured = true;
            }

            mTmpApplySurfaceChangesTransactionState.displayHasContent |=
                    root.handleNotObscuredLocked(w,
            final boolean displayHasContent = root.handleNotObscuredLocked(w,
                    mTmpApplySurfaceChangesTransactionState.obscured,
                    mTmpApplySurfaceChangesTransactionState.syswin);

            if (!mTmpApplySurfaceChangesTransactionState.displayHasContent
                    && !getDisplayPolicy().isWindowExcludedFromContent(w)) {
                mTmpApplySurfaceChangesTransactionState.displayHasContent |= displayHasContent;
            }

            if (w.mHasSurface && isDisplayed) {
                final int type = w.mAttrs.type;
                if (type == TYPE_SYSTEM_DIALOG || type == TYPE_SYSTEM_ERROR
+14 −0
Original line number Diff line number Diff line
@@ -3790,6 +3790,20 @@ public class DisplayPolicy {
        mPointerLocationView = null;
    }

    /**
     * Check if the window could be excluded from checking if the display has content.
     *
     * @param w WindowState to check if should be excluded.
     * @return True if the window type is PointerLocation which is excluded.
     */
    boolean isWindowExcludedFromContent(WindowState w) {
        if (w != null && mPointerLocationView != null) {
            return w.mClient == mPointerLocationView.getWindowToken();
        }

        return false;
    }

    @VisibleForTesting
    static boolean isOverlappingWithNavBar(WindowState targetWindow, WindowState navBarWindow) {
        if (navBarWindow == null || !navBarWindow.isVisibleLw()