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

Commit 686cb71d authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Make IMMS#onActionLocaleChanged() multi-user aware

With this CL, Intent#ACTION_LOCALE_CHANGED will be fully propagated
into any visible background users when

  InputMethodManagerService#mConcurrentMultiUserModeEnabled

is set. There should be no behavior change otherwise.

Bug: 350386877
Test: presubmit
Flag: android.view.inputmethod.concurrent_input_methods
Change-Id: Ifc7aebeef5f3354703fa1de668996e7f4691b900
parent c7aa0be4
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -648,7 +648,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
     * Handles {@link Intent#ACTION_LOCALE_CHANGED}.
     *
     * <p>Note: For historical reasons, {@link Intent#ACTION_LOCALE_CHANGED} has been sent to all
     * the users. We should ignore this event if this is about any background user's locale.</p>
     * the users.</p>
     */
    void onActionLocaleChanged(@NonNull LocaleList prevLocales, @NonNull LocaleList newLocales) {
        if (DEBUG) {
@@ -665,15 +665,16 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                        AdditionalSubtypeMapRepository.get(userId),
                        DirectBootAwareness.AUTO);
                InputMethodSettingsRepository.put(userId, settings);
            }
            // TODO(b/305849394): Dispatch this to non-current users.
            final int userId = mCurrentUserId;

                if (mConcurrentMultiUserModeEnabled || userId == mCurrentUserId) {
                    postInputMethodSettingUpdatedLocked(true /* resetDefaultEnabledIme */, userId);
                    // If the locale is changed, needs to reset the default ime
                    resetDefaultImeLocked(mContext, userId);
                    updateFromSettingsLocked(true, userId);
                }
            }
        }
    }

    final class MyPackageMonitor extends PackageMonitor {
        /**