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

Commit 7f7535fd authored by Satoshi Kataoka's avatar Satoshi Kataoka
Browse files

Fix an issue where voice input is not enabled by default for the secondary user

Bug: 8205725
Change-Id: I438daf996ba48cdb34f0a6158a0cbb510aae931b
parent ac838a3a
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -731,7 +731,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        }
    }

    private void resetAllInternalStateLocked(final boolean updateOnlyWhenLocaleChanged) {
    private void resetAllInternalStateLocked(final boolean updateOnlyWhenLocaleChanged,
            final boolean resetDefaultEnabledIme) {
        if (!mSystemReady) {
            // not system ready
            return;
@@ -749,8 +750,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            }
            // InputMethodAndSubtypeListManager should be reset when the locale is changed.
            mImListManager = new InputMethodAndSubtypeListManager(mContext, this);
            buildInputMethodListLocked(mMethodList, mMethodMap,
                    updateOnlyWhenLocaleChanged /* resetDefaultEnabledIme */);
            buildInputMethodListLocked(mMethodList, mMethodMap, resetDefaultEnabledIme);
            if (!updateOnlyWhenLocaleChanged) {
                final String selectedImiId = mSettings.getSelectedInputMethod();
                if (TextUtils.isEmpty(selectedImiId)) {
@@ -775,14 +775,21 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
    }

    private void checkCurrentLocaleChangedLocked() {
        resetAllInternalStateLocked(true);
        resetAllInternalStateLocked(true /* updateOnlyWhenLocaleChanged */,
                true /* resetDefaultImeLocked */);
    }

    private void switchUserLocked(int newUserId) {
        mSettings.setCurrentUserId(newUserId);
        // InputMethodFileManager should be reset when the user is changed
        mFileManager = new InputMethodFileManager(mMethodMap, newUserId);
        resetAllInternalStateLocked(false);
        final String defaultImiId = mSettings.getSelectedInputMethod();
        final boolean needsToResetDefaultIme = TextUtils.isEmpty(defaultImiId);
        if (DEBUG) {
            Slog.d(TAG, "Switch user: " + newUserId + " current ime = " + defaultImiId);
        }
        resetAllInternalStateLocked(false  /* updateOnlyWhenLocaleChanged */,
                needsToResetDefaultIme);
    }

    @Override