Ime target window should control when to hide IME (1/2)
Input method frameworks uses focused window and some tricks
to best guestimate IME target. Though it doesn't always know the
actual IME target. e.g. when window has both NOT_FOCUSABLE,
ALT_FOCUSABLE_IM; IMF thinks focued window is IME target but it isn't
the case.
The right thing to do is to call both show(IME), hide(IME) on IME
target.
Bug: 142461756
Bug: 111084606
Test: Manually tested using steps below:
1. Make sure new insets flag is enabled
2. Launch any activity which has child window with NOT_FOCUSABLE,
ALT_FOCUSABLE_IM (e.g. Instagram login screen)
3. Verify IME can be shown and hidden by this window.
Change-Id: I13f3e04f6f9e1574db9cbb56bdb7817152499d03
diff --git a/services/core/java/com/android/server/wm/InsetsControlTarget.java b/services/core/java/com/android/server/wm/InsetsControlTarget.java
index b7184a5..22ba82a 100644
--- a/services/core/java/com/android/server/wm/InsetsControlTarget.java
+++ b/services/core/java/com/android/server/wm/InsetsControlTarget.java
@@ -33,4 +33,13 @@
*/
default void showInsets(@InsetType int types, boolean fromIme) {
}
+
+ /**
+ * Instructs the control target to hide inset sources.
+ *
+ * @param types to specify which types of insets source window should be hidden.
+ * @param fromIme {@code true} if IME hide request originated from {@link InputMethodService}.
+ */
+ default void hideInsets(@InsetType int types, boolean fromIme) {
+ }
}