diff options
| -rw-r--r-- | services/core/java/com/android/server/inputmethod/InputMethodManagerService.java | 13 | ||||
| -rw-r--r-- | services/core/java/com/android/server/inputmethod/InputMethodSettings.java | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 15f7dd90f646..3b0321d889ec 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -270,6 +270,10 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. private static final int MSG_NOTIFY_IME_UID_TO_AUDIO_SERVICE = 7000; private static final int NOT_A_SUBTYPE_ID = InputMethodUtils.NOT_A_SUBTYPE_ID; + + private static final int INVALID_SUBTYPE_HASHCODE = + InputMethodSettings.INVALID_SUBTYPE_HASHCODE; + private static final String TAG_TRY_SUPPRESSING_IME_SWITCHER = "TrySuppressingImeSwitcher"; private static final String HANDLER_THREAD_NAME = "android.imms"; private static final String PACKAGE_MONITOR_THREAD_NAME = "android.imms2"; @@ -5442,20 +5446,23 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mCurrentSubtype); // Set Subtype here + final int newSubtypeHashcode; if (imi == null || subtypeId < 0) { - settings.putSelectedSubtype(NOT_A_SUBTYPE_ID); + newSubtypeHashcode = INVALID_SUBTYPE_HASHCODE; mCurrentSubtype = null; } else { if (subtypeId < imi.getSubtypeCount()) { InputMethodSubtype subtype = imi.getSubtypeAt(subtypeId); - settings.putSelectedSubtype(subtype.hashCode()); + newSubtypeHashcode = subtype.hashCode(); mCurrentSubtype = subtype; } else { - settings.putSelectedSubtype(NOT_A_SUBTYPE_ID); + // TODO(b/347093491): Probably this should be determined from the new subtype. + newSubtypeHashcode = INVALID_SUBTYPE_HASHCODE; // If the subtype is not specified, choose the most applicable one mCurrentSubtype = getCurrentInputMethodSubtypeLocked(); } } + settings.putSelectedSubtype(newSubtypeHashcode); notifyInputMethodSubtypeChangedLocked(settings.getUserId(), imi, mCurrentSubtype); if (!setSubtypeOnly) { diff --git a/services/core/java/com/android/server/inputmethod/InputMethodSettings.java b/services/core/java/com/android/server/inputmethod/InputMethodSettings.java index 7ce4074bb1d0..5569e1e5211e 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodSettings.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodSettings.java @@ -58,7 +58,7 @@ final class InputMethodSettings { * used {@code -1} here. We cannot change this value as it's already saved into secure settings. * </p> */ - private static final int INVALID_SUBTYPE_HASHCODE = -1; + static final int INVALID_SUBTYPE_HASHCODE = -1; /** * A string code that represents "no subtype" when a subtype hashcode is used. * |