diff options
| -rw-r--r-- | services/core/java/com/android/server/inputmethod/InputMethodManagerService.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 61d8e0be4950..1a711f0c7dcb 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -1234,8 +1234,9 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } @GuardedBy("ImfLock.class") - private void onUpdateEditorToolTypeLocked(@MotionEvent.ToolType int toolType) { - final IInputMethodInvoker curMethod = getCurMethodLocked(); + private void onUpdateEditorToolTypeLocked(@MotionEvent.ToolType int toolType, + @UserIdInt int userId) { + final var curMethod = getInputMethodBindingController(userId).getCurMethod(); if (curMethod != null) { curMethod.updateEditorToolType(toolType); } @@ -3456,9 +3457,9 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. userData.mCurStatsToken = null; if (Flags.useHandwritingListenerForTooltype()) { - maybeReportToolType(); + maybeReportToolType(userId); } else if (lastClickToolType != MotionEvent.TOOL_TYPE_UNKNOWN) { - onUpdateEditorToolTypeLocked(lastClickToolType); + onUpdateEditorToolTypeLocked(lastClickToolType, userId); } mVisibilityApplier.performShowIme(windowToken, statsToken, mVisibilityStateComputer.getShowFlagsForInputMethodServiceOnly(), @@ -3473,7 +3474,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. } @GuardedBy("ImfLock.class") - private void maybeReportToolType() { + private void maybeReportToolType(@UserIdInt int userId) { + // TODO(b/356638981): This needs to be compatible with visible background users. int lastDeviceId = mInputManagerInternal.getLastUsedInputDeviceId(); final InputManager im = mContext.getSystemService(InputManager.class); if (im == null) { @@ -3492,7 +3494,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. // other toolTypes are irrelevant and reported as unknown. toolType = MotionEvent.TOOL_TYPE_UNKNOWN; } - onUpdateEditorToolTypeLocked(toolType); + onUpdateEditorToolTypeLocked(toolType, userId); } @Override |