diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java index d4ba6930d61c3..add67b156785b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodsPanel.java @@ -242,6 +242,7 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O // Turn on the selected radio button at startup private void updateRadioButtonsByImiAndSubtype( InputMethodInfo imi, InputMethodSubtype subtype) { + if (imi == null) return; if (DEBUG) { Log.d(TAG, "Update radio buttons by " + imi.getId() + ", " + subtype); } @@ -253,7 +254,7 @@ public class InputMethodsPanel extends LinearLayout implements StatusBarPanel, O return; } Pair imiAndSubtype = - mRadioViewAndImiMap.get(radioView); + mRadioViewAndImiMap.get(radioView); if (imiAndSubtype.first.getId().equals(imi.getId()) && (imiAndSubtype.second == null || imiAndSubtype.second.equals(subtype))) { subtypeRadioButton.setChecked(true); diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 2b98795f37764..7b4f24697226f 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -2540,16 +2540,16 @@ public class InputMethodManagerService extends IInputMethodManager.Stub ArrayList>> enabledImes, String imeId, String subtypeHashCode) { for (Pair> enabledIme: enabledImes) { if (enabledIme.first.equals(imeId)) { - final ArrayList enabledSubtypes = enabledIme.second; - if (enabledSubtypes.size() == 0) { - // If there are no enabled subtypes, applicable subtypes are enabled - // implicitly. + final ArrayList explicitlyEnabledSubtypes = enabledIme.second; + if (explicitlyEnabledSubtypes.size() == 0) { + // If there are no explicitly enabled subtypes, applicable subtypes are + // enabled implicitly. InputMethodInfo ime = mMethodMap.get(imeId); // If IME is enabled and no subtypes are enabled, applicable subtypes // are enabled implicitly, so needs to treat them to be enabled. if (ime != null && ime.getSubtypes().size() > 0) { List implicitlySelectedSubtypes = - getApplicableSubtypesLocked(mRes, ime.getSubtypes()); + getApplicableSubtypesLocked(mRes, ime.getSubtypes()); if (implicitlySelectedSubtypes != null) { final int N = implicitlySelectedSubtypes.size(); for (int i = 0; i < N; ++i) { @@ -2561,7 +2561,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } else { - for (String s: enabledSubtypes) { + for (String s: explicitlyEnabledSubtypes) { if (s.equals(subtypeHashCode)) { // If both imeId and subtypeId are enabled, return subtypeId. return s;