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

Commit 825581a3 authored by Robert Carr's avatar Robert Carr
Browse files

Fix computation of child window insets.

Translate some old code that derived conditions
from Surface layers to directly infer the conditions.

Bug: 75253006
Test: Manual. go/wm-smoke
Change-Id: Ib114e8cb3b7c2255d68237e18eebba8f48e0fb16
parent 1e0a9b0b
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -4976,13 +4976,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    private void setAttachedWindowFrames(WindowState win, int fl, int adjust, WindowState attached,
            boolean insetDecors, Rect pf, Rect df, Rect of, Rect cf, Rect vf,
            DisplayFrames displayFrames) {
        if (win.getSurfaceLayer() > mDockLayer && attached.getSurfaceLayer() < mDockLayer) {
            // Here's a special case: if this attached window is a panel that is above the dock
            // window, and the window it is attached to is below the dock window, then the frames we
            // computed for the window it is attached to can not be used because the dock is
            // effectively part of the underlying window and the attached window is floating on top
            // of the whole thing. So, we ignore the attached window and explicitly compute the
            // frames that would be appropriate without the dock.
        if (!win.isInputMethodTarget() && attached.isInputMethodTarget()) {
            // Here's a special case: if the child window is not the 'dock window'
            // or input method target, and the window it is attached to is below
            // the dock window, then the frames we computed for the window it is
            // attached to can not be used because the dock is effectively part
            // of the underlying window and the attached window is floating on top
            // of the whole thing. So, we ignore the attached window and explicitly
            // compute the frames that would be appropriate without the dock.
            vf.set(displayFrames.mDock);
            cf.set(displayFrames.mDock);
            of.set(displayFrames.mDock);
@@ -5009,7 +5010,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                cf.set(attached.getContentFrameLw());
                if (attached.isVoiceInteraction()) {
                    cf.intersectUnchecked(displayFrames.mVoiceContent);
                } else if (attached.getSurfaceLayer() < mDockLayer) {
                } else if (win.isInputMethodTarget() || attached.isInputMethodTarget()) {
                    cf.intersectUnchecked(displayFrames.mContent);
                }
            }
@@ -5500,7 +5501,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {

        win.computeFrameLw(pf, df, of, cf, vf, dcf, sf, osf, displayFrames.mDisplayCutout,
                parentFrameWasClippedByDisplayCutout);

        // Dock windows carve out the bottom of the screen, so normal windows
        // can't appear underneath them.
        if (type == TYPE_INPUT_METHOD && win.isVisibleLw()
+2 −0
Original line number Diff line number Diff line
@@ -474,6 +474,8 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {

        public boolean isInputMethodWindow();

        public boolean isInputMethodTarget();

        public int getDisplayId();

        /**
+10 −5
Original line number Diff line number Diff line
@@ -897,7 +897,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            }
            final WindowState imeWin = mService.mInputMethodWindow;
            // IME is up and obscuring this window. Adjust the window position so it is visible.
            if (imeWin != null && imeWin.isVisibleNow() && mService.mInputMethodTarget == this) {
            if (imeWin != null && imeWin.isVisibleNow() && isInputMethodTarget()) {
                if (inFreeformWindowingMode()
                        && mContainingFrame.bottom > contentFrame.bottom) {
                    // In freeform we want to move the top up directly.
@@ -1885,7 +1885,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        }

        final DisplayContent dc = getDisplayContent();
        if (mService.mInputMethodTarget == this) {
        if (isInputMethodTarget()) {
            dc.computeImeTarget(true /* updateImeTarget */);
        }

@@ -3949,7 +3949,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    private boolean applyInOrderWithImeWindows(ToBooleanFunction<WindowState> callback,
            boolean traverseTopToBottom) {
        if (traverseTopToBottom) {
            if (mService.mInputMethodTarget == this) {
            if (isInputMethodTarget()) {
                // This window is the current IME target, so we need to process the IME windows
                // directly above it.
                if (getDisplayContent().forAllImeWindows(callback, traverseTopToBottom)) {
@@ -3963,7 +3963,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            if (callback.apply(this)) {
                return true;
            }
            if (mService.mInputMethodTarget == this) {
            if (isInputMethodTarget()) {
                // This window is the current IME target, so we need to process the IME windows
                // directly above it.
                if (getDisplayContent().forAllImeWindows(callback, traverseTopToBottom)) {
@@ -4673,7 +4673,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    void assignLayer(Transaction t, int layer) {
        // See comment in assignRelativeLayerForImeTargetChild
        if (!isChildWindow()
                || (mService.mInputMethodTarget != getParentWindow())
                || (!getParentWindow().isInputMethodTarget())
                || !inSplitScreenWindowingMode()) {
            super.assignLayer(t, layer);
            return;
@@ -4741,6 +4741,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mTapExcludeRegionHolder.amendRegion(region, getBounds());
    }

    @Override
    public boolean isInputMethodTarget() {
        return mService.mInputMethodTarget == this;
    }

    private final class MoveAnimationSpec implements AnimationSpec {

        private final long mDuration;
+5 −0
Original line number Diff line number Diff line
@@ -258,4 +258,9 @@ public class FakeWindowState implements WindowManagerPolicy.WindowState {
    public void writeIdentifierToProto(ProtoOutputStream proto, long fieldId){
        throw new UnsupportedOperationException("not implemented");
    }

    @Override
    public boolean isInputMethodTarget() {
        return false;
    }
}