diff options
Diffstat (limited to 'services/java/com/android/server/InputMethodManagerService.java')
-rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 3baa565ece9b..6e24d68301e7 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -705,7 +705,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub @Override public void onReceive(Context context, Intent intent) { synchronized(mMethodMap) { - checkCurrentLocaleChangedLocked(); + resetStateIfCurrentLocaleChangedLocked(); } } }, filter); @@ -781,7 +781,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } - private void checkCurrentLocaleChangedLocked() { + private void resetStateIfCurrentLocaleChangedLocked() { resetAllInternalStateLocked(true /* updateOnlyWhenLocaleChanged */, true /* resetDefaultImeLocked */); } @@ -791,17 +791,21 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // InputMethodFileManager should be reset when the user is changed mFileManager = new InputMethodFileManager(mMethodMap, newUserId); final String defaultImiId = mSettings.getSelectedInputMethod(); - final boolean needsToResetDefaultIme = TextUtils.isEmpty(defaultImiId); // For secondary users, the list of enabled IMEs may not have been updated since the // callbacks to PackageMonitor are ignored for the secondary user. Here, defaultImiId may // not be empty even if the IME has been uninstalled by the primary user. // Even in such cases, IMMS works fine because it will find the most applicable // IME for that user. + final boolean initialUserSwitch = TextUtils.isEmpty(defaultImiId); if (DEBUG) { Slog.d(TAG, "Switch user: " + newUserId + " current ime = " + defaultImiId); } - resetAllInternalStateLocked(false /* updateOnlyWhenLocaleChanged */, - needsToResetDefaultIme); + resetAllInternalStateLocked(false /* updateOnlyWhenLocaleChanged */, + initialUserSwitch /* needsToResetDefaultIme */); + if (initialUserSwitch) { + InputMethodUtils.setNonSelectedSystemImesDisabledUntilUsed(mContext.getPackageManager(), + mSettings.getEnabledInputMethodListLocked()); + } } @Override @@ -843,7 +847,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub !mImeSelectedOnBoot /* resetDefaultEnabledIme */); if (!mImeSelectedOnBoot) { Slog.w(TAG, "Reset the default IME as \"Resource\" is ready here."); - checkCurrentLocaleChangedLocked(); + resetStateIfCurrentLocaleChangedLocked(); + InputMethodUtils.setNonSelectedSystemImesDisabledUntilUsed( + mContext.getPackageManager(), + mSettings.getEnabledInputMethodListLocked()); } mLastSystemLocale = mRes.getConfiguration().locale; try { @@ -1604,6 +1611,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mSettings.getCurrentUserId()); if (ai != null && ai.enabledSetting == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED) { + if (DEBUG) { + Slog.d(TAG, "Update state(" + imm.getId() + + "): DISABLED_UNTIL_USED -> DEFAULT"); + } mIPackageManager.setApplicationEnabledSetting(imm.getPackageName(), PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, PackageManager.DONT_KILL_APP, mSettings.getCurrentUserId(), |