aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
diff options
context:
space:
mode:
authorsatok <satok@google.com>2011-03-25 15:56:10 -0700
committersatok <satok@google.com>2011-03-25 18:38:20 -0700
commit9115dd272328def247116ccf1ce458d360fec4ad (patch)
tree1c8d717c55556a3b643d612f6e06e6be4dd2fca5 /java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
parentf1a81f5eb37df4170de2cf6327c860e3d64dc2f8 (diff)
downloadlatinime-9115dd272328def247116ccf1ce458d360fec4ad.tar.gz
latinime-9115dd272328def247116ccf1ce458d360fec4ad.tar.xz
latinime-9115dd272328def247116ccf1ce458d360fec4ad.zip
Fix some compat bugs and add VoiceInputLoggerCompatUtils
Change-Id: I54ed0853ed4423704a300977d7880678e066a6fb
Diffstat (limited to 'java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java')
-rw-r--r--java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
index d1747ba5f..3bf0ed6b5 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java
@@ -24,6 +24,7 @@ import android.view.inputmethod.InputMethodManager;
import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -43,6 +44,8 @@ public class InputMethodManagerCompatWrapper {
CompatUtils.getMethod(
InputMethodManager.class, "setInputMethodAndSubtype", IBinder.class,
String.class, InputMethodSubtypeCompatWrapper.CLASS_InputMethodSubtype);
+ private static final Method METHOD_switchToLastInputMethod = CompatUtils.getMethod(
+ InputMethodManager.class, "switchToLastInputMethod", IBinder.class);
private static final InputMethodManagerCompatWrapper sInstance =
new InputMethodManagerCompatWrapper();
@@ -78,7 +81,8 @@ public class InputMethodManagerCompatWrapper {
public Map<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>>
getShortcutInputMethodsAndSubtypes() {
Object retval = CompatUtils.invoke(mImm, null, METHOD_getShortcutInputMethodsAndSubtypes);
- if (!(retval instanceof Map)) return null;
+ // Returns an empty map
+ if (!(retval instanceof Map)) return Collections.emptyMap();
Map<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>> shortcutMap =
new HashMap<InputMethodInfoCompatWrapper, List<InputMethodSubtypeCompatWrapper>>();
final Map<?, ?> retvalMap = (Map<?, ?>)retval;
@@ -100,8 +104,7 @@ public class InputMethodManagerCompatWrapper {
}
public boolean switchToLastInputMethod(IBinder token) {
- if (mImm == null) return false;
- return mImm.switchToLastInputMethod(token);
+ return (Boolean)CompatUtils.invoke(mImm, false, METHOD_switchToLastInputMethod, token);
}
public List<InputMethodInfoCompatWrapper> getEnabledInputMethodList() {