OSDN Git Service

Always clear hashcodes when input method settings is changed
authorsatok <satok@google.com>
Wed, 19 Jan 2011 14:47:13 +0000 (23:47 +0900)
committersatok <satok@google.com>
Wed, 19 Jan 2011 15:07:18 +0000 (00:07 +0900)
Change-Id: Ia2a5d3a856f0ce9e1c81052397e3d704a3b6b396

src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java

index 03c5ea1..bc347fa 100644 (file)
@@ -177,12 +177,20 @@ public class InputMethodAndSubtypeUtil {
                     enabledIMEAndSubtypesMap.put(imiId, new HashSet<String>());
                 }
                 HashSet<String> subtypesSet = enabledIMEAndSubtypesMap.get(imiId);
+
+                boolean subtypeCleared = false;
                 for (InputMethodSubtype subtype : imi.getSubtypes()) {
                     final String subtypeHashCodeStr = String.valueOf(subtype.hashCode());
                     CheckBoxPreference subtypePref = (CheckBoxPreference) context.findPreference(
                             imiId + subtypeHashCodeStr);
                     // In the Configure input method screen which does not have subtype preferences.
                     if (subtypePref == null) continue;
+                    // Once subtype checkbox is found, subtypeSet needs to be cleared.
+                    // Because of system change, hashCode value could have been changed.
+                    if (!subtypeCleared) {
+                        subtypesSet.clear();
+                        subtypeCleared = true;
+                    }
                     if (subtypePref.isChecked()) {
                         subtypesSet.add(subtypeHashCodeStr);
                         if (isCurrentInputMethod) {