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

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

Merge "Resolve userId from displayId in IMMI#hideAllInputMethods()" into main

parents d66f7176 5263c613
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -5072,10 +5072,11 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.

            // ---------------------------------------------------------

            case MSG_HIDE_ALL_INPUT_METHODS:
            case MSG_HIDE_ALL_INPUT_METHODS: {
                @SoftInputShowHideReason final int reason = msg.arg1;
                final int originatingDisplayId = msg.arg2;
                synchronized (ImfLock.class) {
                    // TODO(b/305849394): Needs to figure out what to do where for background users.
                    final int userId = mCurrentUserId;
                    final int userId = resolveImeUserIdFromDisplayIdLocked(originatingDisplayId);
                    final var userData = getUserData(userId);
                    if (Flags.refactorInsetsController()) {
                        if (userData.mImeBindingState != null
@@ -5086,12 +5087,13 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                                            null /* TODO(b329229469) check statsToken */);
                        }
                    } else {
                        @SoftInputShowHideReason final int reason = (int) msg.obj;

                        hideCurrentInputLocked(userData.mImeBindingState.mFocusedWindow,
                                0 /* flags */, reason, userId);
                    }
                }
                return true;
            }
            case MSG_REMOVE_IME_SURFACE: {
                synchronized (ImfLock.class) {
                    // TODO(b/305849394): Needs to figure out what to do where for background users.
@@ -5809,7 +5811,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        public void hideAllInputMethods(@SoftInputShowHideReason int reason,
                int originatingDisplayId) {
            mHandler.removeMessages(MSG_HIDE_ALL_INPUT_METHODS);
            mHandler.obtainMessage(MSG_HIDE_ALL_INPUT_METHODS, reason).sendToTarget();
            mHandler.obtainMessage(MSG_HIDE_ALL_INPUT_METHODS, reason, originatingDisplayId)
                    .sendToTarget();
        }

        @ImfLockFree