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

Commit 969d1b8e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix keyboard is attached to wrong task in split" into tm-dev

parents 4c419129 e27e307b
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -4272,7 +4272,15 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            setImeInputTarget(target);
            mInsetsStateController.updateAboveInsetsState(mInsetsStateController
                    .getRawInsetsState().getSourceOrDefaultVisibility(ITYPE_IME));
            updateImeControlTarget();
            // Force updating the IME parent when the IME control target has been updated to the
            // remote target but updateImeParent not happen because ImeLayeringTarget and
            // ImeInputTarget are different. Then later updateImeParent would be ignored when there
            // is no new IME control target to change the IME parent.
            final boolean forceUpdateImeParent = mImeControlTarget == mRemoteInsetsControlTarget
                    && (mInputMethodSurfaceParent != null
                    && !mInputMethodSurfaceParent.isSameSurface(
                            mImeWindowsContainer.getParent().mSurfaceControl));
            updateImeControlTarget(forceUpdateImeParent);
        }
        // Unfreeze IME insets after the new target updated, in case updateAboveInsetsState may
        // deliver unrelated IME insets change to the non-IME requester.
+25 −0
Original line number Diff line number Diff line
@@ -1183,6 +1183,31 @@ public class DisplayContentTests extends WindowTestsBase {
                mDisplayContent.computeImeParent());
    }

    @Test
    public void testComputeImeParent_remoteControlTarget() throws Exception {
        final DisplayContent dc = mDisplayContent;
        WindowState app1 = createWindow(null, TYPE_BASE_APPLICATION, "app1");
        WindowState app2 = createWindow(null, TYPE_BASE_APPLICATION, "app2");

        dc.setImeLayeringTarget(app1);
        dc.setImeInputTarget(app2);
        dc.setRemoteInsetsController(createDisplayWindowInsetsController());
        dc.getImeTarget(IME_TARGET_LAYERING).getWindow().setWindowingMode(
                WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW);
        dc.getImeInputTarget().getWindowState().setWindowingMode(
                WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW);

        // Expect ImeParent is null since ImeLayeringTarget and ImeInputTarget are different.
        assertNull(dc.computeImeParent());

        // ImeLayeringTarget and ImeInputTarget are updated to the same.
        dc.setImeInputTarget(app1);
        assertEquals(dc.getImeTarget(IME_TARGET_LAYERING), dc.getImeInputTarget());

        // The ImeParent should be the display.
        assertEquals(dc.getImeContainer().getParent().getSurfaceControl(), dc.computeImeParent());
    }

    @Test
    public void testInputMethodInputTarget_isClearedWhenWindowStateIsRemoved() throws Exception {
        final DisplayContent dc = createNewDisplay();