From 8403a13752dc7c45902ef5b36cdcc763388dd09e Mon Sep 17 00:00:00 2001 From: Antonio Kantek Date: Mon, 8 Jun 2020 21:11:09 -0700 Subject: [PATCH] Enabling New Insets API with Multi-Session IME. New insets based IME requires windows manager to properly link the assocaited IME window token against the target window token. Test script: Step 1: Patch this CL on rvc-dev repo Step 2: Build and flash Hawk Step 3: Build and install a sample multi-client IME make -j MultiClientInputMethod adb install -r $OUT/system/priv-app/MultiClientInputMethod/MultiClientInputMethod.apk Step 4: Enable multi-client IME for the side-loaded sample multi-client IME adb root adb shell setprop persist.debug.multi_client_ime com.example.android.multiclientinputmethod/.MultiClientInputMethod adb reboot Step 5: Open KitchenSync app, select carboard, enter text on Plain Text tab (sample multi-session keyboard doesn't support numeric keyboard yet) Bug: 123718661 Test: manual (see test script above) Change-Id: I2a27c0da3a243d9cb3c98541531396cd9ff819a0 --- .../inputmethod/MultiClientInputMethodManagerService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java index d025b0f4ece5a..33c78e403ce3c 100644 --- a/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/MultiClientInputMethodManagerService.java @@ -1347,13 +1347,14 @@ public final class MultiClientInputMethodManagerService { for (WindowInfo windowInfo : clientInfo.mWindowMap.values()) { if (windowInfo.mWindowHandle == targetWindowHandle) { final IBinder targetWindowToken = windowInfo.mWindowToken; - // TODO(yukawa): Report targetWindowToken and targetWindowToken to WMS. if (DEBUG) { Slog.v(TAG, "reportImeWindowTarget" + " clientId=" + clientId + " imeWindowToken=" + imeWindowToken + " targetWindowToken=" + targetWindowToken); } + mIWindowManagerInternal.updateInputMethodTargetWindow( + imeWindowToken, targetWindowToken); } } // not found. @@ -1496,6 +1497,9 @@ public final class MultiClientInputMethodManagerService { case InputMethodClientState.ALREADY_SENT_BIND_RESULT: try { clientInfo.mMSInputMethodSession.showSoftInput(flags, resultReceiver); + + // Forcing WM to show IME on imeTargetWindow + mWindowManagerInternal.showImePostLayout(token); } catch (RemoteException e) { } break;