Loading services/java/com/android/server/InputMethodManagerService.java +60 −24 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ import java.io.PrintWriter; import java.text.Collator; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.TreeMap; Loading Loading @@ -1567,14 +1568,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub int lastInputMethodSubtypeId = getSelectedInputMethodSubtypeId(lastInputMethodId); if (DEBUG) Slog.v(TAG, "Current IME: " + lastInputMethodId); final List<InputMethodInfo> immis = getEnabledInputMethodList(); synchronized (mMethodMap) { final List<Pair<InputMethodInfo, ArrayList<String>>> immis = mSettings.getEnabledInputMethodAndSubtypeListLocked(); ArrayList<Integer> subtypeIds = new ArrayList<Integer>(); if (immis == null) { if (immis == null || immis.size() == 0) { return; } synchronized (mMethodMap) { hideInputMethodMenuLocked(); int N = immis.size(); Loading @@ -1583,16 +1585,21 @@ public class InputMethodManagerService extends IInputMethodManager.Stub new TreeMap<CharSequence, Pair<InputMethodInfo, Integer>>(Collator.getInstance()); for (int i = 0; i < N; ++i) { InputMethodInfo property = immis.get(i); InputMethodInfo property = immis.get(i).first; final ArrayList<String> enabledSubtypeIds = immis.get(i).second; HashSet<String> enabledSubtypeSet = new HashSet<String>(); for (String s : enabledSubtypeIds) { enabledSubtypeSet.add(s); } if (property == null) { continue; } // TODO: Show only enabled subtypes ArrayList<InputMethodSubtype> subtypes = property.getSubtypes(); CharSequence label = property.loadLabel(pm); if (showSubtypes && subtypes.size() > 0) { if (showSubtypes && enabledSubtypeSet.size() > 0) { for (int j = 0; j < subtypes.size(); ++j) { InputMethodSubtype subtype = subtypes.get(j); if (enabledSubtypeSet.contains(String.valueOf(subtype.hashCode()))) { CharSequence title; int nameResId = subtype.getNameResId(); int modeResId = subtype.getModeResId(); Loading @@ -1610,6 +1617,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } imMap.put(title, new Pair<InputMethodInfo, Integer>(property, j)); } } } else { imMap.put(label, new Pair<InputMethodInfo, Integer>(property, NOT_A_SUBTYPE_ID)); Loading Loading @@ -1678,6 +1686,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } }); if (showSubtypes) { mDialogBuilder.setPositiveButton(com.android.internal.R.string.more_item_label, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { showInputMethodAndSubtypeEnabler(); } }); } mSwitchingDialog = mDialogBuilder.create(); mSwitchingDialog.getWindow().setType( WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG); Loading Loading @@ -1864,6 +1880,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub getEnabledInputMethodsAndSubtypeListLocked()); } public List<Pair<InputMethodInfo, ArrayList<String>>> getEnabledInputMethodAndSubtypeListLocked() { return createEnabledInputMethodAndSubtypeListLocked( getEnabledInputMethodsAndSubtypeListLocked()); } // At the initial boot, the settings for input methods are not set, // so we need to enable IME in that case. public void enableAllIMEsIfThereIsNoEnabledIME() { Loading Loading @@ -1960,6 +1982,20 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return res; } private List<Pair<InputMethodInfo, ArrayList<String>>> createEnabledInputMethodAndSubtypeListLocked( List<Pair<String, ArrayList<String>>> imsList) { final ArrayList<Pair<InputMethodInfo, ArrayList<String>>> res = new ArrayList<Pair<InputMethodInfo, ArrayList<String>>>(); for (Pair<String, ArrayList<String>> ims : imsList) { InputMethodInfo info = mMethodMap.get(ims.first); if (info != null) { res.add(new Pair<InputMethodInfo, ArrayList<String>>(info, ims.second)); } } return res; } private void putEnabledInputMethodsStr(String str) { Settings.Secure.putString(mResolver, Settings.Secure.ENABLED_INPUT_METHODS, str); mEnabledInputMethodsStrCache = str; Loading Loading
services/java/com/android/server/InputMethodManagerService.java +60 −24 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ import java.io.PrintWriter; import java.text.Collator; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.TreeMap; Loading Loading @@ -1567,14 +1568,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub int lastInputMethodSubtypeId = getSelectedInputMethodSubtypeId(lastInputMethodId); if (DEBUG) Slog.v(TAG, "Current IME: " + lastInputMethodId); final List<InputMethodInfo> immis = getEnabledInputMethodList(); synchronized (mMethodMap) { final List<Pair<InputMethodInfo, ArrayList<String>>> immis = mSettings.getEnabledInputMethodAndSubtypeListLocked(); ArrayList<Integer> subtypeIds = new ArrayList<Integer>(); if (immis == null) { if (immis == null || immis.size() == 0) { return; } synchronized (mMethodMap) { hideInputMethodMenuLocked(); int N = immis.size(); Loading @@ -1583,16 +1585,21 @@ public class InputMethodManagerService extends IInputMethodManager.Stub new TreeMap<CharSequence, Pair<InputMethodInfo, Integer>>(Collator.getInstance()); for (int i = 0; i < N; ++i) { InputMethodInfo property = immis.get(i); InputMethodInfo property = immis.get(i).first; final ArrayList<String> enabledSubtypeIds = immis.get(i).second; HashSet<String> enabledSubtypeSet = new HashSet<String>(); for (String s : enabledSubtypeIds) { enabledSubtypeSet.add(s); } if (property == null) { continue; } // TODO: Show only enabled subtypes ArrayList<InputMethodSubtype> subtypes = property.getSubtypes(); CharSequence label = property.loadLabel(pm); if (showSubtypes && subtypes.size() > 0) { if (showSubtypes && enabledSubtypeSet.size() > 0) { for (int j = 0; j < subtypes.size(); ++j) { InputMethodSubtype subtype = subtypes.get(j); if (enabledSubtypeSet.contains(String.valueOf(subtype.hashCode()))) { CharSequence title; int nameResId = subtype.getNameResId(); int modeResId = subtype.getModeResId(); Loading @@ -1610,6 +1617,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } imMap.put(title, new Pair<InputMethodInfo, Integer>(property, j)); } } } else { imMap.put(label, new Pair<InputMethodInfo, Integer>(property, NOT_A_SUBTYPE_ID)); Loading Loading @@ -1678,6 +1686,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } }); if (showSubtypes) { mDialogBuilder.setPositiveButton(com.android.internal.R.string.more_item_label, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { showInputMethodAndSubtypeEnabler(); } }); } mSwitchingDialog = mDialogBuilder.create(); mSwitchingDialog.getWindow().setType( WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG); Loading Loading @@ -1864,6 +1880,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub getEnabledInputMethodsAndSubtypeListLocked()); } public List<Pair<InputMethodInfo, ArrayList<String>>> getEnabledInputMethodAndSubtypeListLocked() { return createEnabledInputMethodAndSubtypeListLocked( getEnabledInputMethodsAndSubtypeListLocked()); } // At the initial boot, the settings for input methods are not set, // so we need to enable IME in that case. public void enableAllIMEsIfThereIsNoEnabledIME() { Loading Loading @@ -1960,6 +1982,20 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return res; } private List<Pair<InputMethodInfo, ArrayList<String>>> createEnabledInputMethodAndSubtypeListLocked( List<Pair<String, ArrayList<String>>> imsList) { final ArrayList<Pair<InputMethodInfo, ArrayList<String>>> res = new ArrayList<Pair<InputMethodInfo, ArrayList<String>>>(); for (Pair<String, ArrayList<String>> ims : imsList) { InputMethodInfo info = mMethodMap.get(ims.first); if (info != null) { res.add(new Pair<InputMethodInfo, ArrayList<String>>(info, ims.second)); } } return res; } private void putEnabledInputMethodsStr(String str) { Settings.Secure.putString(mResolver, Settings.Secure.ENABLED_INPUT_METHODS, str); mEnabledInputMethodsStrCache = str; Loading