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

Commit c535b349 authored by Robert Carr's avatar Robert Carr Committed by android-build-merger
Browse files

Merge "Fix layering of non-IME target windows in IME-target app in split-screen." into pi-dev

am: 12a6cd74

Change-Id: Ie5b6c1967b4bfeed601fd7a32387ab8dbce0dc2a
parents 4dcb9b08 12a6cd74
Loading
Loading
Loading
Loading
+27 −5
Original line number Diff line number Diff line
@@ -4717,16 +4717,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