summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-04-11 14:26:04 +0900
committersatok <satok@google.com>2011-04-15 13:49:33 +0900
commit68f1b78b7b9139a0e34285ff641a664e664a14b8 (patch)
treedbd50188b77a1dfab9310daad8550d553cf72204 /services
parentc02c97ef7527e19dce067562692c89d27e7bad52 (diff)
downloadframeworks_base-68f1b78b7b9139a0e34285ff641a664e664a14b8.zip
frameworks_base-68f1b78b7b9139a0e34285ff641a664e664a14b8.tar.gz
frameworks_base-68f1b78b7b9139a0e34285ff641a664e664a14b8.tar.bz2
Add an API to get the last used input method subtype
Bug: 4075039 - Voice input requires to know the last used input method subtype. Change-Id: I603a4fb88a2af5195e52188adfa6585ad80304fa
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 1455764..7028772 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -1399,6 +1399,24 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
}
+ public InputMethodSubtype getLastInputMethodSubtype() {
+ synchronized (mMethodMap) {
+ final Pair<String, String> lastIme = mSettings.getLastInputMethodAndSubtypeLocked();
+ // TODO: Handle the case of the last IME with no subtypes
+ if (lastIme == null || TextUtils.isEmpty(lastIme.first)
+ || TextUtils.isEmpty(lastIme.second)) return null;
+ final InputMethodInfo lastImi = mMethodMap.get(lastIme.first);
+ if (lastImi == null) return null;
+ try {
+ final int lastSubtypeHash = Integer.valueOf(lastIme.second);
+ return lastImi.getSubtypeAt(getSubtypeIdFromHashCode(
+ lastImi, lastSubtypeHash));
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ }
+ }
+
private void setInputMethodWithSubtypeId(IBinder token, String id, int subtypeId) {
synchronized (mMethodMap) {
if (token == null) {