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 | |
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
-rw-r--r-- | api/current.xml | 15 | ||||
-rw-r--r-- | core/java/android/view/inputmethod/InputMethodManager.java | 9 | ||||
-rw-r--r-- | core/java/com/android/internal/view/IInputMethodManager.aidl | 2 | ||||
-rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 37 |
4 files changed, 57 insertions, 6 deletions
diff --git a/api/current.xml b/api/current.xml index 0b80a90..c649e15 100644 --- a/api/current.xml +++ b/api/current.xml @@ -219268,6 +219268,19 @@ visibility="public" > </method> +<method name="getEnabledInputMethodSubtypeList" + return="java.util.List<android.view.inputmethod.InputMethodSubtype>" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="imi" type="android.view.inputmethod.InputMethodInfo"> +</parameter> +</method> <method name="getInputMethodList" return="java.util.List<android.view.inputmethod.InputMethodInfo>" abstract="false" @@ -246844,7 +246857,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="t" type="T"> +<parameter name="arg0" type="T"> </parameter> </method> </interface> diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 5e7a133..fe55f34 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -27,6 +27,7 @@ import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ServiceManager; import android.util.Log; +import android.util.Pair; import android.util.PrintWriterPrinter; import android.util.Printer; import android.view.KeyEvent; @@ -502,6 +503,14 @@ public final class InputMethodManager { } } + public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(InputMethodInfo imi) { + try { + return mService.getEnabledInputMethodSubtypeList(imi); + } catch (RemoteException e) { + throw new RuntimeException(e); + } + } + public void showStatusIcon(IBinder imeToken, String packageName, int iconId) { try { mService.updateStatusIcon(imeToken, packageName, iconId); diff --git a/core/java/com/android/internal/view/IInputMethodManager.aidl b/core/java/com/android/internal/view/IInputMethodManager.aidl index 7592e8b..63d05ec 100644 --- a/core/java/com/android/internal/view/IInputMethodManager.aidl +++ b/core/java/com/android/internal/view/IInputMethodManager.aidl @@ -31,7 +31,7 @@ import com.android.internal.view.IInputMethodClient; interface IInputMethodManager { List<InputMethodInfo> getInputMethodList(); List<InputMethodInfo> getEnabledInputMethodList(); - + List<InputMethodSubtype> getEnabledInputMethodSubtypeList(in InputMethodInfo imi); void addClient(in IInputMethodClient client, in IInputContext inputContext, int uid, int pid); void removeClient(in IInputMethodClient client); 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>>>(); |