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

Commit ae80a887 authored by Adrian Roos's avatar Adrian Roos Committed by Automerger Merge Worker
Browse files

Merge "DisplayArea: Fix computation of ImeContainers parent surface" into rvc-dev am: f0fcd8da

Change-Id: Icf948811b4dea3664bf6658702f85ae935e52a2c
parents d9d2acf9 f0fcd8da
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -3457,11 +3457,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
    }

    private void updateImeParent() {
        // Force attaching IME to the display when magnifying, or it would be magnified with
        // target app together.
        final boolean shouldAttachToDisplay = (mMagnificationSpec != null);
        final SurfaceControl newParent =
                shouldAttachToDisplay ? mWindowContainers.getSurfaceControl() : computeImeParent();
        final SurfaceControl newParent = computeImeParent();
        if (newParent != null) {
            getPendingTransaction().reparent(mImeWindowsContainers.mSurfaceControl, newParent);
            scheduleAnimation();
@@ -3473,16 +3469,19 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
     */
    @VisibleForTesting
    SurfaceControl computeImeParent() {
        // Force attaching IME to the display when magnifying, or it would be magnified with
        // target app together.
        final boolean allowAttachToApp = (mMagnificationSpec == null);

        // Attach it to app if the target is part of an app and such app is covering the entire
        // screen. If it's not covering the entire screen the IME might extend beyond the apps
        // bounds.
        if (isImeAttachedToApp()) {
        if (allowAttachToApp && isImeAttachedToApp()) {
            return mInputMethodTarget.mActivityRecord.getSurfaceControl();
        }

        // Otherwise, we just attach it to the display.
        return mWindowContainers.getSurfaceControl();
        // Otherwise, we just attach it to where the display area policy put it.
        return mImeWindowsContainers.getParent().getSurfaceControl();
    }

    void setLayoutNeeded() {
@@ -4727,6 +4726,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        return mWindowContainers.getSurfaceControl();
    }

    @VisibleForTesting
    WindowContainer<?> getImeContainer() {
        return mImeWindowsContainers;
    }

    SurfaceControl getOverlayLayer() {
        return mOverlayContainers.getSurfaceControl();
    }
+4 −3
Original line number Diff line number Diff line
@@ -826,7 +826,7 @@ public class DisplayContentTests extends WindowTestsBase {
            dc.mInputMethodTarget = createWindow(null, TYPE_STATUS_BAR, "app");
            dc.mInputMethodTarget.setWindowingMode(
                    WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
            assertEquals(dc.getWindowingLayer(), dc.computeImeParent());
            assertEquals(dc.getImeContainer().getParentSurfaceControl(), dc.computeImeParent());
        }
    }

@@ -836,7 +836,8 @@ public class DisplayContentTests extends WindowTestsBase {
        doReturn(false).when(mAppWindow.mActivityRecord).matchParentBounds();
        mDisplayContent.mInputMethodTarget = mAppWindow;
        // The surface parent of IME should be the display instead of app window.
        assertEquals(mDisplayContent.getWindowingLayer(), mDisplayContent.computeImeParent());
        assertEquals(mDisplayContent.getImeContainer().getParentSurfaceControl(),
                mDisplayContent.computeImeParent());
    }

    @Test
@@ -845,7 +846,7 @@ public class DisplayContentTests extends WindowTestsBase {
                     new InsetsModeSession(ViewRootImpl.NEW_INSETS_MODE_IME)) {
            final DisplayContent dc = createNewDisplay();
            dc.mInputMethodTarget = createWindow(null, TYPE_STATUS_BAR, "statusBar");
            assertEquals(dc.getWindowingLayer(), dc.computeImeParent());
            assertEquals(dc.getImeContainer().getParentSurfaceControl(), dc.computeImeParent());
        }
    }