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

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

Merge "Enable 1P IMEs for concurrent multi-user IME mode" into main

parents f008fd09 f7d90f36
Loading
Loading
Loading
Loading
+24 −4
Original line number Diff line number Diff line
@@ -1161,7 +1161,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            synchronized (ImfLock.class) {
                mService.mUserDataRepository.getOrCreate(userId);
                if (mService.mExperimentalConcurrentMultiUserModeEnabled) {
                    if (mService.mCurrentUserId != userId) {
                    if (mService.mCurrentUserId != userId && mService.mSystemReady) {
                        mService.experimentalInitializeVisibleBackgroundUserLocked(userId);
                    }
                }
@@ -1547,6 +1547,14 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                final var unused = SystemServerInitThreadPool.submit(
                        AdditionalSubtypeMapRepository::startWriterThread,
                        "Start AdditionalSubtypeMapRepository's writer thread");

                if (mExperimentalConcurrentMultiUserModeEnabled) {
                    for (int userId : mUserManagerInternal.getUserIds()) {
                        if (userId != mCurrentUserId) {
                            experimentalInitializeVisibleBackgroundUserLocked(userId);
                        }
                    }
                }
            }
        }
    }
@@ -2884,10 +2892,22 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
     */
    @GuardedBy("ImfLock.class")
    void experimentalInitializeVisibleBackgroundUserLocked(@UserIdInt int userId) {
        if (!mUserManagerInternal.isUserVisible(userId)) {
        final var settings = InputMethodSettingsRepository.get(userId);

        // Until we figure out what makes most sense, we enable all the pre-installed IMEs in
        // concurrent multi-user IME mode.
        String enabledImeIdsStr = settings.getEnabledInputMethodsStr();
        for (var imi : settings.getMethodList()) {
            if (!imi.isSystem()) {
                return;
            }
        final var settings = InputMethodSettingsRepository.get(userId);
            enabledImeIdsStr = InputMethodUtils.concatEnabledImeIds(enabledImeIdsStr, imi.getId());
        }
        if (!TextUtils.equals(settings.getEnabledInputMethodsStr(), enabledImeIdsStr)) {
            settings.putEnabledInputMethodsStr(enabledImeIdsStr);
        }

        // Also update the currently-selected IME.
        String id = settings.getSelectedInputMethod();
        if (TextUtils.isEmpty(id)) {
            final InputMethodInfo imi = InputMethodInfoUtils.getMostApplicableDefaultIME(