diff options
author | satok <satok@google.com> | 2010-11-17 09:45:54 +0900 |
---|---|---|
committer | satok <satok@google.com> | 2010-11-17 13:59:56 +0900 |
commit | 67ddf9cbd5d7133c7f443cd3c55841ed1109c3a0 (patch) | |
tree | 5053a6b86d1820e1a12f3f96b534deacc0208fca /services/java | |
parent | 4f3c25f3175d3ef08577fd0b08c65772479ffecd (diff) | |
download | frameworks_base-67ddf9cbd5d7133c7f443cd3c55841ed1109c3a0.zip frameworks_base-67ddf9cbd5d7133c7f443cd3c55841ed1109c3a0.tar.gz frameworks_base-67ddf9cbd5d7133c7f443cd3c55841ed1109c3a0.tar.bz2 |
Add a function to get enabledInputMethodAndSubtype
Change-Id: Ie97635343249aa63e33028c2843cab103125ca92
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 4f8862c..8d25d50 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -555,6 +555,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } + public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(InputMethodInfo imi) { + synchronized (mMethodMap) { + return mSettings.getEnabledInputMethodSubtypeListLocked(imi); + } + } + public void addClient(IInputMethodClient client, IInputContext inputContext, int uid, int pid) { synchronized (mMethodMap) { @@ -1607,7 +1613,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub synchronized (mMethodMap) { final List<Pair<InputMethodInfo, ArrayList<String>>> immis = - mSettings.getEnabledInputMethodAndSubtypeListLocked(); + mSettings.getEnabledInputMethodAndSubtypeHashCodeListLocked(); ArrayList<Integer> subtypeIds = new ArrayList<Integer>(); if (immis == null || immis.size() == 0) { @@ -2026,11 +2032,34 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } public List<Pair<InputMethodInfo, ArrayList<String>>> - getEnabledInputMethodAndSubtypeListLocked() { - return createEnabledInputMethodAndSubtypeListLocked( + getEnabledInputMethodAndSubtypeHashCodeListLocked() { + return createEnabledInputMethodAndSubtypeHashCodeListLocked( getEnabledInputMethodsAndSubtypeListLocked()); } + public List<InputMethodSubtype> getEnabledInputMethodSubtypeListLocked( + InputMethodInfo imi) { + List<Pair<String, ArrayList<String>>> imsList = + getEnabledInputMethodsAndSubtypeListLocked(); + ArrayList<InputMethodSubtype> enabledSubtypes = + new ArrayList<InputMethodSubtype>(); + for (Pair<String, ArrayList<String>> imsPair : imsList) { + InputMethodInfo info = mMethodMap.get(imsPair.first); + if (info != null && info.getId().equals(imi.getId())) { + ArrayList<InputMethodSubtype> subtypes = info.getSubtypes(); + for (InputMethodSubtype ims: subtypes) { + for (String s: imsPair.second) { + if (String.valueOf(ims.hashCode()).equals(s)) { + enabledSubtypes.add(ims); + } + } + } + break; + } + } + return enabledSubtypes; + } + // At the initial boot, the settings for input methods are not set, // so we need to enable IME in that case. public void enableAllIMEsIfThereIsNoEnabledIME() { @@ -2128,7 +2157,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } private List<Pair<InputMethodInfo, ArrayList<String>>> - createEnabledInputMethodAndSubtypeListLocked( + createEnabledInputMethodAndSubtypeHashCodeListLocked( List<Pair<String, ArrayList<String>>> imsList) { final ArrayList<Pair<InputMethodInfo, ArrayList<String>>> res = new ArrayList<Pair<InputMethodInfo, ArrayList<String>>>(); |