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

Commit 5263c613 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Resolve userId from displayId in IMMI#hideAllInputMethods()

There must be no observable behavior change in the single user mode.

Bug: 350386877
Test: presubmit
Flag: android.view.inputmethod.concurrent_input_methods
Change-Id: I658f89bea70369d3cd712a073177a478faebd917
parent 00d0d55d
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -5044,10 +5044,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
@@ -5058,12 +5059,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.
@@ -5781,7 +5783,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