summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/java/com/android/server/wm/DisplayContent.java5
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java2
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java19
3 files changed, 24 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index d4629d9f9b8f..43c9eab5b701 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -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();
}
/**
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 124e120e310e..53f6eabdaffa 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -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();
diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
index 9527625d50ff..11be74d1a8c7 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
@@ -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++) {