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

Commit 2251fb40 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Handle IMMS#onActionLocaleChanged() on the IO thread

With this CL

  InputMethodManagerService#onActionLocaleChanged()

starts being executed on the IO handler thread rather than the general
handler thread (a.k.a. IMMS UI thread), as it queries available IMEs
via PackageManager APIs, which may a bit slow.

Semantically there should be no observable behavior in this change.

Bug: 343601565
Test: manually verified by changing the device locale
Flag: EXEMPT refactor
Change-Id: I66ee52db627f92a466b4e067c9b3dc114150c6db
parent 9ce38320
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -707,6 +707,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
     * <p>Note: For historical reasons, {@link Intent#ACTION_LOCALE_CHANGED} has been sent to all
     * the users.</p>
     */
    @WorkerThread
    void onActionLocaleChanged(@NonNull LocaleList prevLocales, @NonNull LocaleList newLocales) {
        if (DEBUG) {
            Slog.d(TAG, "onActionLocaleChanged prev=" + prevLocales + " new=" + newLocales);
@@ -1179,7 +1180,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.

            mHandler = Handler.createAsync(uiLooper, this);
            mIoHandler = ioHandler;
            SystemLocaleWrapper.onStart(context, this::onActionLocaleChanged, mHandler);
            SystemLocaleWrapper.onStart(context, this::onActionLocaleChanged, mIoHandler);
            mImeTrackerService = new ImeTrackerService(mHandler);
            mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class);
            mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);