Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9aa05fed authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove a dependency on IMMS#getCurMethodLocked()" into main

parents 4c7e9593 9644f902
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -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