From 6e139493079b6c6cfef7a9d5d2c322f5574840f6 Mon Sep 17 00:00:00 2001 From: Chavi Weingarten Date: Mon, 27 Mar 2023 23:03:35 +0000 Subject: [PATCH] Modify EmbeddedWindow InputTarget to work with IME EmbeddedWindow implements InputTarget to allow IME to work for embedded windows. However, a few methods need to be modified to allow IME to work. 1. shouldControlIme should return true if there's a host WindowState. This doesn't meant the embedded window will control the IME, but rather the host for embedded will control the IME. This is needed to ensure the IME is reparented to the correct Activity and uses the parent WindowState to when determining inset controller. 2. getImeControlTarget should return the host WindowState's control target. This ensures the IME has the correct target information and not the fallback. 3. getActivityRecord should return the host ActivityRecord. This tells IME where to reparent the layer so it's a child of the ActivityRecord. Othewise, the IME layer is left where it was previously. Test: SurfaceControlViewHostTests Bug: 230340812 Change-Id: I8407c3ec7ed6372ed3484f25117db45944855a22 --- .../com/android/server/wm/EmbeddedWindowController.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/wm/EmbeddedWindowController.java b/services/core/java/com/android/server/wm/EmbeddedWindowController.java index c3c727a1d8797..052c09a0e0ebf 100644 --- a/services/core/java/com/android/server/wm/EmbeddedWindowController.java +++ b/services/core/java/com/android/server/wm/EmbeddedWindowController.java @@ -326,7 +326,7 @@ class EmbeddedWindowController { @Override public boolean shouldControlIme() { - return false; + return mHostWindowState != null; } @Override @@ -336,6 +336,9 @@ class EmbeddedWindowController { @Override public InsetsControlTarget getImeControlTarget() { + if (mHostWindowState != null) { + return mHostWindowState.getImeControlTarget(); + } return mWmService.getDefaultDisplayContentLocked().mRemoteInsetsControlTarget; } @@ -346,7 +349,7 @@ class EmbeddedWindowController { @Override public ActivityRecord getActivityRecord() { - return null; + return mHostActivityRecord; } @Override