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

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

Merge "Simplify IMMS#setInputMethodLocked() a bit" into main

parents 177d3ceb 0b178b3c
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -3079,7 +3079,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.


    @GuardedBy("ImfLock.class")
    @GuardedBy("ImfLock.class")
    void setInputMethodLocked(String id, int subtypeId, int deviceId) {
    void setInputMethodLocked(String id, int subtypeId, int deviceId) {
        final InputMethodSettings settings = InputMethodSettingsRepository.get(mCurrentUserId);
        final int userId = mCurrentUserId;
        final InputMethodSettings settings = InputMethodSettingsRepository.get(userId);
        InputMethodInfo info = settings.getMethodMap().get(id);
        InputMethodInfo info = settings.getMethodMap().get(id);
        if (info == null) {
        if (info == null) {
            throw getExceptionForUnknownImeId(id);
            throw getExceptionForUnknownImeId(id);
@@ -3087,7 +3088,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.


        // See if we need to notify a subtype change within the same IME.
        // See if we need to notify a subtype change within the same IME.
        if (id.equals(getSelectedMethodIdLocked())) {
        if (id.equals(getSelectedMethodIdLocked())) {
            final int userId = settings.getUserId();
            final int subtypeCount = info.getSubtypeCount();
            final int subtypeCount = info.getSubtypeCount();
            if (subtypeCount <= 0) {
            if (subtypeCount <= 0) {
                notifyInputMethodSubtypeChangedLocked(userId, info, null);
                notifyInputMethodSubtypeChangedLocked(userId, info, null);
@@ -3143,7 +3143,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            // mCurMethodId should be updated after setSelectedInputMethodAndSubtypeLocked()
            // mCurMethodId should be updated after setSelectedInputMethodAndSubtypeLocked()
            // because mCurMethodId is stored as a history in
            // because mCurMethodId is stored as a history in
            // setSelectedInputMethodAndSubtypeLocked().
            // setSelectedInputMethodAndSubtypeLocked().
            getInputMethodBindingController(mCurrentUserId).setSelectedMethodId(id);
            getInputMethodBindingController(userId).setSelectedMethodId(id);


            if (mActivityManagerInternal.isSystemReady()) {
            if (mActivityManagerInternal.isSystemReady()) {
                Intent intent = new Intent(Intent.ACTION_INPUT_METHOD_CHANGED);
                Intent intent = new Intent(Intent.ACTION_INPUT_METHOD_CHANGED);