diff options
3 files changed, 71 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 52116a07e8e6..a498e3867c05 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -820,10 +820,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub final EditorInfo mEditorInfo; @NonNull final String mRequestWindowName; + @Nullable + final String mImeControlTargetName; + @Nullable + final String mImeTargetNameFromWm; Entry(ClientState client, EditorInfo editorInfo, String focusedWindowName, @SoftInputModeFlags int softInputMode, @SoftInputShowHideReason int reason, - boolean inFullscreenMode, String requestWindowName) { + boolean inFullscreenMode, String requestWindowName, + @Nullable String imeControlTargetName, @Nullable String imeTargetName) { mClientState = client; mEditorInfo = editorInfo; mFocusedWindowName = focusedWindowName; @@ -833,6 +838,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mWallTime = System.currentTimeMillis(); mInFullscreenMode = inFullscreenMode; mRequestWindowName = requestWindowName; + mImeControlTargetName = imeControlTargetName; + mImeTargetNameFromWm = imeTargetName; } } @@ -873,6 +880,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub pw.println(" requestWindowName=" + entry.mRequestWindowName); pw.print(prefix); + pw.println(" imeControlTargetName=" + entry.mImeControlTargetName); + + pw.print(prefix); + pw.println(" imeTargetNameFromWm=" + entry.mImeTargetNameFromWm); + + pw.print(prefix); pw.print(" editorInfo: "); pw.print(" inputType=" + entry.mEditorInfo.inputType); pw.print(" privateImeOptions=" + entry.mEditorInfo.privateImeOptions); @@ -4123,7 +4136,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mWindowManagerInternal.getWindowName(mCurFocusedWindow), mCurFocusedWindowSoftInputMode, reason, mInFullscreenMode, mWindowManagerInternal.getWindowName( - mShowRequestWindowMap.get(args.arg3)))); + mShowRequestWindowMap.get(args.arg3)), + mWindowManagerInternal.getImeControlTargetNameForLogging( + mCurTokenDisplayId), + mWindowManagerInternal.getImeTargetNameForLogging( + mCurTokenDisplayId))); } catch (RemoteException e) { } args.recycle(); @@ -4142,7 +4159,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mWindowManagerInternal.getWindowName(mCurFocusedWindow), mCurFocusedWindowSoftInputMode, reason, mInFullscreenMode, mWindowManagerInternal.getWindowName( - mHideRequestWindowMap.get(args.arg3)))); + mHideRequestWindowMap.get(args.arg3)), + mWindowManagerInternal.getImeControlTargetNameForLogging( + mCurTokenDisplayId), + mWindowManagerInternal.getImeTargetNameForLogging( + mCurTokenDisplayId))); } catch (RemoteException e) { } args.recycle(); diff --git a/services/core/java/com/android/server/wm/WindowManagerInternal.java b/services/core/java/com/android/server/wm/WindowManagerInternal.java index e011c7945882..c605e3e1ea60 100644 --- a/services/core/java/com/android/server/wm/WindowManagerInternal.java +++ b/services/core/java/com/android/server/wm/WindowManagerInternal.java @@ -576,4 +576,24 @@ public abstract class WindowManagerInternal { * @return The corresponding {@link WindowState#getName()} */ public abstract String getWindowName(@NonNull IBinder binder); + + /** + * Return the window name of IME Insets control target. + * + * @param displayId The ID of the display which input method is currently focused. + * @return The corresponding {@link WindowState#getName()} + */ + public abstract @Nullable String getImeControlTargetNameForLogging(int displayId); + + /** + * Return the current window name of the input method is on top of. + * + * Note that the concept of this window is only reparent the target window behind the input + * method window, it may different with the window which reported by + * {@code InputMethodManagerService#reportStartInput} which has input connection. + * + * @param displayId The ID of the display which input method is currently focused. + * @return The corresponding {@link WindowState#getName()} + */ + public abstract @Nullable String getImeTargetNameForLogging(int displayId); } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index eee4e7795252..f34510e2104a 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -7755,6 +7755,33 @@ public class WindowManagerService extends IWindowManager.Stub return w != null ? w.getName() : null; } } + + @Override + public String getImeControlTargetNameForLogging(int displayId) { + synchronized (mGlobalLock) { + final DisplayContent dc = mRoot.getDisplayContent(displayId); + if (dc == null) { + return null; + } + final InsetsControlTarget target = dc.mInputMethodControlTarget; + if (target == null) { + return null; + } + final WindowState win = target.getWindow(); + return win != null ? win.getName() : target.toString(); + } + } + + @Override + public String getImeTargetNameForLogging(int displayId) { + synchronized (mGlobalLock) { + final DisplayContent dc = mRoot.getDisplayContent(displayId); + if (dc == null) { + return null; + } + return dc.mInputMethodTarget != null ? dc.mInputMethodTarget.getName() : null; + } + } } void registerAppFreezeListener(AppFreezeListener listener) { |