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

Commit f96adf35 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Remove mCurrentUserId dependency from switchToInputMethodLocked

This is a follow up CL to our previous CL [1], where we started using
the same implementation as the current user in the single-user mode in

  adb shell ime --user <userId> set <imeId>

when IMMS#mConcurrentMultiUserModeEnabled is set.

With this CL we expand the above new behavior unconditionally as part
of our on-going effort to remove the remaining dependency on

  InputMethodManagerService#mCurrentUserId.

 [1]: I58edae672be629bdacd4a9a16cc9ad5c8012eea6
      22992d58

Bug: 350386877
Bug: 350834650
Test: presubmit
Flag: EXEMPT refactor
Change-Id: I57868f616b232a70fec2e3bc2d087f7e5a06f9e6
parent e794f3ea
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -5706,15 +5706,9 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        if (!CollectionUtils.any(enabledImes, imi -> imi.getId().equals(imeId))) {
            return false; // IME is not found or not enabled.
        }
        if (mConcurrentMultiUserModeEnabled || userId == mCurrentUserId) {
        setInputMethodLocked(imeId, subtypeId, userId);
        return true;
    }
        settings.putSelectedInputMethod(imeId);
        // For non-current user, only reset subtypeId (instead of setting the given one).
        settings.putSelectedSubtype(NOT_A_SUBTYPE_ID);
        return true;
    }

    /**
     * Filter the access to the input method by rules of the package visibility. Return {@code true}