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

Commit 4a1cdbd4 authored by Robert Carr's avatar Robert Carr
Browse files

Fix layering of non-IME target windows in IME-target app in split-screen.

In split-screen mode we elevate child windows of the IME target with relative
layering to ensure they and the IME can exist above the docked divider while
the IME target itself still exists below. For behavior compatibility with O
we need to give this same treatment to all windows with the same token as the
IME target.

Bug: 70811741
Test: Manual. go/wm-smoke.
Change-Id: Ife174069ec2571c95d546981d196b7f519bb08ca
parent a194a6be
Loading
Loading
Loading
Loading
+27 −5
Original line number Diff line number Diff line
@@ -4708,16 +4708,38 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        outPoint.offset(-mAttrs.surfaceInsets.left, -mAttrs.surfaceInsets.top);
    }

    boolean needsRelativeLayeringToIme() {
        // We only use the relative layering mode in split screen, as part of elevating the IME
        // and windows above it's target above the docked divider.
        if (!inSplitScreenWindowingMode()) {
            return false;
        }

        if (isChildWindow()) {
            // If we are a child of the input method target we need this promotion.
            if (getParentWindow().isInputMethodTarget()) {
                return true;
            }
        } else if (mAppToken != null) {
            // Likewise if we share a token with the Input method target and are ordered
            // above it but not necessarily a child (e.g. a Dialog) then we also need
            // this promotion.
            final WindowState imeTarget = mService.mInputMethodTarget;
            boolean inTokenWithAndAboveImeTarget = imeTarget != null && imeTarget != this
                    && imeTarget.mToken == mToken && imeTarget.compareTo(this) <= 0;
            return inTokenWithAndAboveImeTarget;
        }
        return false;
    }

    @Override
    void assignLayer(Transaction t, int layer) {
        // See comment in assignRelativeLayerForImeTargetChild
        if (!isChildWindow()
                || (!getParentWindow().isInputMethodTarget())
                || !inSplitScreenWindowingMode()) {
            super.assignLayer(t, layer);
        if (needsRelativeLayeringToIme()) {
            getDisplayContent().assignRelativeLayerForImeTargetChild(t, this);
            return;
        }
        getDisplayContent().assignRelativeLayerForImeTargetChild(t, this);
        super.assignLayer(t, layer);
    }

    @Override