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

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

Make SKC#setInputMethodEnabled() consistent among users

With this CL

  AccessibilityService
      .SoftKeyboardController#setInputMethodEnabled()

uses the same logic no matter whether the target userId is

  InputMethodManagerService#mCurrentUserId

or not in favor of better consistency and simplicity.

Overall we do not expect any app compat issues.

Bug: 350386877
Flag: EXEMPT refactor
Test: atest CtsAccessibilityServiceTestCases:AccessibilitySoftKeyboardTest
Change-Id: Ia6765333323523e14c335e1bf38b43190acb5aae
parent 1054f4ec
Loading
Loading
Loading
Loading
+1 −16
Original line number Diff line number Diff line
@@ -5884,24 +5884,9 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                if (!settings.getMethodMap().containsKey(imeId)) {
                    return false; // IME is not found.
                }
                if (userId == mCurrentUserId) {
                setInputMethodEnabledLocked(imeId, enabled, userId);
                return true;
            }
                if (enabled) {
                    final String enabledImeIdsStr = settings.getEnabledInputMethodsStr();
                    final String newEnabledImeIdsStr = InputMethodUtils.concatEnabledImeIds(
                            enabledImeIdsStr, imeId);
                    if (!TextUtils.equals(enabledImeIdsStr, newEnabledImeIdsStr)) {
                        settings.putEnabledInputMethodsStr(newEnabledImeIdsStr);
                    }
                } else {
                    settings.buildAndPutEnabledInputMethodsStrRemovingId(
                            new StringBuilder(),
                            settings.getEnabledInputMethodsAndSubtypeList(), imeId);
                }
                return true;
            }
        }

        @Override