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

Commit d8bfc71c authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge changes Ia9df12fa,Ib114e8cb into pi-dev

* changes:
  Avoid calling detachChildren from onAppVisibilityChanged
  Fix computation of child window insets.
parents 0594af6d b6d4e2be
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 −12
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.
@@ -1691,13 +1691,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            return changed;
        }

        // Next up we will notify the client that it's visibility has changed.
        // We need to prevent it from destroying child surfaces until
        // the animation has finished.
        if (!visible && isVisibleNow()) {
            mWinAnimator.detachChildren();
        }

        if (visible != isVisibleNow()) {
            if (!runningAppAnimation) {
                final AccessibilityController accessibilityController =
@@ -1885,7 +1878,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        }

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

@@ -3949,7 +3942,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 +3956,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 +4666,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 +4734,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;
    }
}