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

Commit 5fc1daeb authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Remove unintentinal early-returns in IMMS

This is a follow up CL to my previous CLs [1][2], which aimed to
implement a per-user initialization logic for concurrent multi-user
mode.

Apparently there are questionable early-returns in

  #experimentalInitializeVisibleBackgroundUserLocked().

Let's make sure that the entire initialization logic is executed by
removing them.

There must be no behavior change in the existing single user mode, and
for concurrent multi-user mode, the new behavior should be the right
one.

 [1]: I82cfc366b614d7e55a0f4fa11d5eaf5f0f8eb0a8
      1ec914a0
 [2]: I414a228e068fa53223234fe1db3e813474841604
      f7d90f36

Bug: 341199701
Bug: 341558132
Test: presubmit
Flag: android.view.inputmethod.concurrent_input_methods
Change-Id: If659c309d57bf498aa5614734a6409ce478b7d8a
parent 67de832d
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -2868,7 +2868,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        String enabledImeIdsStr = settings.getEnabledInputMethodsStr();
        for (var imi : settings.getMethodList()) {
            if (!imi.isSystem()) {
                return;
                continue;
            }
            enabledImeIdsStr = InputMethodUtils.concatEnabledImeIds(enabledImeIdsStr, imi.getId());
        }
@@ -2881,19 +2881,18 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        if (TextUtils.isEmpty(id)) {
            final InputMethodInfo imi = InputMethodInfoUtils.getMostApplicableDefaultIME(
                    settings.getEnabledInputMethodList());
            if (imi == null) {
                return;
            }
            if (imi != null) {
                id = imi.getId();
                settings.putSelectedInputMethod(id);
            }
        }
        final var bindingController = getInputMethodBindingController(userId);
        bindingController.setSelectedMethodId(id);

        // Also re-initialize controllers.
        final var userData = getUserData(userId);
        userData.mSwitchingController.resetCircularListLocked(mContext, settings);
        userData.mHardwareKeyboardShortcutController.update(settings);

        final var bindingController = getInputMethodBindingController(userId);
        bindingController.setSelectedMethodId(id);
    }

    @GuardedBy("ImfLock.class")