Loading services/core/java/com/android/server/wm/DisplayContent.java +4 −1 Original line number Diff line number Diff line Loading @@ -3643,7 +3643,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp && mImeLayeringTarget.getWindowingMode() == WINDOWING_MODE_FULLSCREEN // An activity with override bounds should be letterboxed inside its parent bounds, // so it doesn't fill the screen. && mImeLayeringTarget.mActivityRecord.matchParentBounds(); && mImeLayeringTarget.mActivityRecord.matchParentBounds() // IME is attached to non-Letterboxed app windows, other than windows with // LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER flag. (Refer to WS.isLetterboxedAppWindow()) && mImeLayeringTarget.matchesRootDisplayAreaBounds(); } /** Loading services/core/java/com/android/server/wm/WindowState.java +1 −1 Original line number Diff line number Diff line Loading @@ -2097,7 +2097,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return getDisplayContent().getBounds().equals(getBounds()); } private boolean matchesRootDisplayAreaBounds() { boolean matchesRootDisplayAreaBounds() { RootDisplayArea root = getRootDisplayArea(); if (root == null || root == getDisplayContent()) { return matchesDisplayBounds(); Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +19 −0 Original line number Diff line number Diff line Loading @@ -540,6 +540,25 @@ public class DisplayContentTests extends WindowTestsBase { assertFalse(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot()); } @Test public void testImeIsAttachedToDisplayForLetterboxedApp() { final DisplayContent dc = mDisplayContent; final WindowState ws = createWindow(null, TYPE_APPLICATION, dc, "app window"); dc.setImeLayeringTarget(ws); // Adjust bounds so that matchesRootDisplayAreaBounds() returns false and // hence isLetterboxedAppWindow() returns true. ws.mActivityRecord.getConfiguration().windowConfiguration.setBounds(new Rect(1, 1, 1, 1)); assertFalse("matchesRootDisplayAreaBounds() should return false", ws.matchesRootDisplayAreaBounds()); assertTrue("isLetterboxedAppWindow() should return true", ws.isLetterboxedAppWindow()); assertTrue("IME shouldn't be attached to app", dc.computeImeParent() != dc.getImeTarget(IME_TARGET_LAYERING).getWindow() .mActivityRecord.getSurfaceControl()); assertEquals("IME should be attached to display", dc.getImeContainer().getParent().getSurfaceControl(), dc.computeImeParent()); } private WindowState[] createNotDrawnWindowsOn(DisplayContent displayContent, int... types) { final WindowState[] windows = new WindowState[types.length]; for (int i = 0; i < types.length; i++) { Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +4 −1 Original line number Diff line number Diff line Loading @@ -3643,7 +3643,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp && mImeLayeringTarget.getWindowingMode() == WINDOWING_MODE_FULLSCREEN // An activity with override bounds should be letterboxed inside its parent bounds, // so it doesn't fill the screen. && mImeLayeringTarget.mActivityRecord.matchParentBounds(); && mImeLayeringTarget.mActivityRecord.matchParentBounds() // IME is attached to non-Letterboxed app windows, other than windows with // LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER flag. (Refer to WS.isLetterboxedAppWindow()) && mImeLayeringTarget.matchesRootDisplayAreaBounds(); } /** Loading
services/core/java/com/android/server/wm/WindowState.java +1 −1 Original line number Diff line number Diff line Loading @@ -2097,7 +2097,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return getDisplayContent().getBounds().equals(getBounds()); } private boolean matchesRootDisplayAreaBounds() { boolean matchesRootDisplayAreaBounds() { RootDisplayArea root = getRootDisplayArea(); if (root == null || root == getDisplayContent()) { return matchesDisplayBounds(); Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +19 −0 Original line number Diff line number Diff line Loading @@ -540,6 +540,25 @@ public class DisplayContentTests extends WindowTestsBase { assertFalse(secondaryDisplay.shouldWaitForSystemDecorWindowsOnBoot()); } @Test public void testImeIsAttachedToDisplayForLetterboxedApp() { final DisplayContent dc = mDisplayContent; final WindowState ws = createWindow(null, TYPE_APPLICATION, dc, "app window"); dc.setImeLayeringTarget(ws); // Adjust bounds so that matchesRootDisplayAreaBounds() returns false and // hence isLetterboxedAppWindow() returns true. ws.mActivityRecord.getConfiguration().windowConfiguration.setBounds(new Rect(1, 1, 1, 1)); assertFalse("matchesRootDisplayAreaBounds() should return false", ws.matchesRootDisplayAreaBounds()); assertTrue("isLetterboxedAppWindow() should return true", ws.isLetterboxedAppWindow()); assertTrue("IME shouldn't be attached to app", dc.computeImeParent() != dc.getImeTarget(IME_TARGET_LAYERING).getWindow() .mActivityRecord.getSurfaceControl()); assertEquals("IME should be attached to display", dc.getImeContainer().getParent().getSurfaceControl(), dc.computeImeParent()); } private WindowState[] createNotDrawnWindowsOn(DisplayContent displayContent, int... types) { final WindowState[] windows = new WindowState[types.length]; for (int i = 0; i < types.length; i++) { Loading