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

Commit 4df011a9 authored by Gaurav Bhola's avatar Gaurav Bhola
Browse files

Don't attach ime to app if target bounds don't match ime container

- This adds flexibility for AAOS where the apps will be running in
  DisplayAreas which have FULLSCREEN_WINDOWING_MODE but are not
  visually fullscreen.
- In such cases, the IME currently reparents to app surface by default.
- Having it reparent to the placeholder gives these benefits:
    a. Ensures that IME actually shows up if the DA is lets say on
       bottom half of screen
    b. Gives more flexibility for OEMs to control where the IME should
       go.

Fix: 344234345
Test: atest DisplayContentTests
Change-Id: Ifa6896b5dda073c02bac8d03538f2024b468469e
parent cf7d9485
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4160,6 +4160,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                && mImeLayeringTarget != null
                && mImeLayeringTarget.mActivityRecord != null
                && mImeLayeringTarget.getWindowingMode() == WINDOWING_MODE_FULLSCREEN
                && mImeLayeringTarget.getBounds().equals(mImeWindowsContainer.getBounds())
                // IME is attached to app windows that fill display area. This excludes
                // letterboxed windows.
                && mImeLayeringTarget.matchesDisplayAreaBounds();
+21 −0
Original line number Diff line number Diff line
@@ -1343,6 +1343,27 @@ public class DisplayContentTests extends WindowTestsBase {
        assertEquals(mAppWindow, mDisplayContent.computeImeControlTarget());
    }

    @SetupWindows(addWindows = W_ACTIVITY)
    @Test
    public void testShouldImeAttachedToApp_targetBoundsDifferentFromImeContainer_returnsFalse()
            throws Exception {
        Rect imeContainerBounds = new Rect(0, 0, 100, 100);
        Rect imeTargetBounds = new Rect(0, 0, 100, 200);
        spyOn(mAppWindow);
        spyOn(mAppWindow.mActivityRecord);
        doReturn(imeTargetBounds).when(mAppWindow).getBounds();
        doReturn(true).when(mAppWindow.mActivityRecord).matchParentBounds();
        mDisplayContent.setImeInputTarget(mAppWindow);
        mDisplayContent.setImeLayeringTarget(
                mDisplayContent.getImeInputTarget().getWindowState());
        mDisplayContent.setRemoteInsetsController(createDisplayWindowInsetsController());
        final DisplayArea.Tokens imeContainer = mDisplayContent.getImeContainer();
        spyOn(imeContainer);
        doReturn(imeContainerBounds).when(imeContainer).getBounds();

        assertFalse(mDisplayContent.shouldImeAttachedToApp());
    }

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