Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +27 −1 Original line number Diff line number Diff line Loading @@ -2515,6 +2515,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub if (DEBUG) { Slog.v(TAG, "Restoring default device input method: " + defaultDeviceMethodId); } mSettings.putSelectedDefaultDeviceInputMethod(null); return defaultDeviceMethodId; } Loading Loading @@ -3179,6 +3180,26 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } } } if (mDeviceIdToShowIme == DEVICE_ID_DEFAULT) { String ime = SecureSettingsWrapper.getString( Settings.Secure.DEFAULT_INPUT_METHOD, null, mSettings.getUserId()); String defaultDeviceIme = SecureSettingsWrapper.getString( Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD, null, mSettings.getUserId()); if (defaultDeviceIme != null && !Objects.equals(ime, defaultDeviceIme)) { if (DEBUG) { Slog.v(TAG, "Current input method " + ime + " differs from the stored default" + " device input method for user " + mSettings.getUserId() + " - restoring " + defaultDeviceIme); } SecureSettingsWrapper.putString( Settings.Secure.DEFAULT_INPUT_METHOD, defaultDeviceIme, mSettings.getUserId()); SecureSettingsWrapper.putString( Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD, null, mSettings.getUserId()); } } // We are assuming that whoever is changing DEFAULT_INPUT_METHOD and // ENABLED_INPUT_METHODS is taking care of keeping them correctly in // sync, so we will never have a DEFAULT_INPUT_METHOD that is not Loading Loading @@ -5339,7 +5360,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub InputMethodInfoUtils.getMostApplicableDefaultIME( mSettings.getEnabledInputMethodList()); mSettings.putSelectedDefaultDeviceInputMethod( newDefaultIme == null ? "" : newDefaultIme.getId()); newDefaultIme == null ? null : newDefaultIme.getId()); } // Previous state was enabled. return true; Loading Loading @@ -5382,6 +5403,10 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub @GuardedBy("ImfLock.class") private void resetSelectedInputMethodAndSubtypeLocked(String newDefaultIme) { mDeviceIdToShowIme = DEVICE_ID_DEFAULT; mDisplayIdToShowIme = INVALID_DISPLAY; mSettings.putSelectedDefaultDeviceInputMethod(null); InputMethodInfo imi = mSettings.getMethodMap().get(newDefaultIme); int lastSubtypeId = NOT_A_SUBTYPE_ID; // newDefaultIme is empty when there is no candidate for the selected IME. Loading Loading @@ -6565,6 +6590,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub // Reset selected IME. settings.putSelectedInputMethod(nextIme); settings.putSelectedDefaultDeviceInputMethod(null); settings.putSelectedSubtype(NOT_A_SUBTYPE_ID); } out.println("Reset current and enabled IMEs for user #" + userId); Loading services/core/java/com/android/server/inputmethod/InputMethodSettings.java +0 −7 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import com.android.internal.annotations.VisibleForTesting; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.function.Predicate; /** Loading Loading @@ -88,12 +87,6 @@ final class InputMethodSettings { mMethodMap = methodMap; mMethodList = methodMap.values(); mUserId = userId; String ime = getSelectedInputMethod(); String defaultDeviceIme = getSelectedDefaultDeviceInputMethod(); if (defaultDeviceIme != null && !Objects.equals(ime, defaultDeviceIme)) { putSelectedInputMethod(defaultDeviceIme); putSelectedDefaultDeviceInputMethod(null); } } @AnyThread Loading Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +27 −1 Original line number Diff line number Diff line Loading @@ -2515,6 +2515,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub if (DEBUG) { Slog.v(TAG, "Restoring default device input method: " + defaultDeviceMethodId); } mSettings.putSelectedDefaultDeviceInputMethod(null); return defaultDeviceMethodId; } Loading Loading @@ -3179,6 +3180,26 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub } } } if (mDeviceIdToShowIme == DEVICE_ID_DEFAULT) { String ime = SecureSettingsWrapper.getString( Settings.Secure.DEFAULT_INPUT_METHOD, null, mSettings.getUserId()); String defaultDeviceIme = SecureSettingsWrapper.getString( Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD, null, mSettings.getUserId()); if (defaultDeviceIme != null && !Objects.equals(ime, defaultDeviceIme)) { if (DEBUG) { Slog.v(TAG, "Current input method " + ime + " differs from the stored default" + " device input method for user " + mSettings.getUserId() + " - restoring " + defaultDeviceIme); } SecureSettingsWrapper.putString( Settings.Secure.DEFAULT_INPUT_METHOD, defaultDeviceIme, mSettings.getUserId()); SecureSettingsWrapper.putString( Settings.Secure.DEFAULT_DEVICE_INPUT_METHOD, null, mSettings.getUserId()); } } // We are assuming that whoever is changing DEFAULT_INPUT_METHOD and // ENABLED_INPUT_METHODS is taking care of keeping them correctly in // sync, so we will never have a DEFAULT_INPUT_METHOD that is not Loading Loading @@ -5339,7 +5360,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub InputMethodInfoUtils.getMostApplicableDefaultIME( mSettings.getEnabledInputMethodList()); mSettings.putSelectedDefaultDeviceInputMethod( newDefaultIme == null ? "" : newDefaultIme.getId()); newDefaultIme == null ? null : newDefaultIme.getId()); } // Previous state was enabled. return true; Loading Loading @@ -5382,6 +5403,10 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub @GuardedBy("ImfLock.class") private void resetSelectedInputMethodAndSubtypeLocked(String newDefaultIme) { mDeviceIdToShowIme = DEVICE_ID_DEFAULT; mDisplayIdToShowIme = INVALID_DISPLAY; mSettings.putSelectedDefaultDeviceInputMethod(null); InputMethodInfo imi = mSettings.getMethodMap().get(newDefaultIme); int lastSubtypeId = NOT_A_SUBTYPE_ID; // newDefaultIme is empty when there is no candidate for the selected IME. Loading Loading @@ -6565,6 +6590,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub // Reset selected IME. settings.putSelectedInputMethod(nextIme); settings.putSelectedDefaultDeviceInputMethod(null); settings.putSelectedSubtype(NOT_A_SUBTYPE_ID); } out.println("Reset current and enabled IMEs for user #" + userId); Loading
services/core/java/com/android/server/inputmethod/InputMethodSettings.java +0 −7 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import com.android.internal.annotations.VisibleForTesting; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.function.Predicate; /** Loading Loading @@ -88,12 +87,6 @@ final class InputMethodSettings { mMethodMap = methodMap; mMethodList = methodMap.values(); mUserId = userId; String ime = getSelectedInputMethod(); String defaultDeviceIme = getSelectedDefaultDeviceInputMethod(); if (defaultDeviceIme != null && !Objects.equals(ime, defaultDeviceIme)) { putSelectedInputMethod(defaultDeviceIme); putSelectedDefaultDeviceInputMethod(null); } } @AnyThread Loading