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

Commit 1abd2c64 authored by Antonio Kantek's avatar Antonio Kantek
Browse files

Fix resolveImeUserIdLocked bug on non-concurrent multi-user mode

`I03f6f4b08470afc36eb8d7381b14556804d6b2c2` improved IMMS#resolveImeUserIdLocked, which is used by showSoftInput and hideSoftInput to resolve the user id from the display owner when the caller id was SYSTEM_USER. However, this also introduced a regression for non-concurrent multi-user mode. The regression is that, in non-concurrent multi-user mode, it should return mCurrentImeUserId instead of callingProcessUserId.

Bug: 362665493
Bug: 358105425
Flag: EXEMPT bug fix
Test: presubmit
Change-Id: I79cba7f9e3aefc87ef28254656871b7bac9e3d35
parent 06a3a60a
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -350,14 +350,16 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
    @BinderThread
    private int resolveImeUserIdLocked(@UserIdInt int callingProcessUserId,
            @NonNull IInputMethodClient client) {
        if (mConcurrentMultiUserModeEnabled
                && callingProcessUserId == UserHandle.USER_SYSTEM) {
        if (mConcurrentMultiUserModeEnabled) {
            if (callingProcessUserId == UserHandle.USER_SYSTEM) {
                final var clientState = mClientController.getClient(client.asBinder());
                return mUserManagerInternal.getUserAssignedToDisplay(
                        clientState.mSelfReportedDisplayId);
            }
            return callingProcessUserId;
        }
        return mCurrentImeUserId;
    }

   /**
     * Figures out the target IME user ID associated with the given {@code displayId}.