From 9cc2c94c8b4bfd4e00e5d3478b9f6e520e791bc5 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 2 Apr 2012 21:31:52 +0900 Subject: Remove InputMethodSubtypeCompatWrapper Bug: 6129704 Change-Id: I8f84f0f61a2205ac1fcd1cd40e3a586ee535282d --- .../compat/InputMethodManagerCompatWrapper.java | 72 ++++------------------ 1 file changed, 12 insertions(+), 60 deletions(-) (limited to 'java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java') diff --git a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java index 0f03c2ef8..7f0b071a3 100644 --- a/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java +++ b/java/src/com/android/inputmethod/compat/InputMethodManagerCompatWrapper.java @@ -21,10 +21,9 @@ import android.os.IBinder; import android.util.Log; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; +import android.view.inputmethod.InputMethodSubtype; import java.lang.reflect.Method; -import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -32,21 +31,6 @@ import java.util.Map; // performance. public class InputMethodManagerCompatWrapper { private static final String TAG = InputMethodManagerCompatWrapper.class.getSimpleName(); - private static final Method METHOD_getCurrentInputMethodSubtype = - CompatUtils.getMethod(InputMethodManager.class, "getCurrentInputMethodSubtype"); - private static final Method METHOD_getLastInputMethodSubtype = - CompatUtils.getMethod(InputMethodManager.class, "getLastInputMethodSubtype"); - private static final Method METHOD_getEnabledInputMethodSubtypeList = - CompatUtils.getMethod(InputMethodManager.class, "getEnabledInputMethodSubtypeList", - InputMethodInfo.class, boolean.class); - private static final Method METHOD_getShortcutInputMethodsAndSubtypes = - CompatUtils.getMethod(InputMethodManager.class, "getShortcutInputMethodsAndSubtypes"); - private static final Method METHOD_setInputMethodAndSubtype = - 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 Method METHOD_switchToNextInputMethod = CompatUtils.getMethod( InputMethodManager.class, "switchToNextInputMethod", IBinder.class, Boolean.TYPE); @@ -66,62 +50,30 @@ public class InputMethodManagerCompatWrapper { Context.INPUT_METHOD_SERVICE); } - public InputMethodSubtypeCompatWrapper getCurrentInputMethodSubtype() { - Object o = CompatUtils.invoke(mImm, null, METHOD_getCurrentInputMethodSubtype); - return new InputMethodSubtypeCompatWrapper(o); + public InputMethodSubtype getCurrentInputMethodSubtype() { + return mImm.getCurrentInputMethodSubtype(); } - public InputMethodSubtypeCompatWrapper getLastInputMethodSubtype() { - Object o = CompatUtils.invoke(mImm, null, METHOD_getLastInputMethodSubtype); - return new InputMethodSubtypeCompatWrapper(o); + public InputMethodSubtype getLastInputMethodSubtype() { + return mImm.getLastInputMethodSubtype(); } - public List getEnabledInputMethodSubtypeList( + public List getEnabledInputMethodSubtypeList( InputMethodInfo imi, boolean allowsImplicitlySelectedSubtypes) { - Object retval = CompatUtils.invoke(mImm, null, METHOD_getEnabledInputMethodSubtypeList, - imi, allowsImplicitlySelectedSubtypes); - if (retval == null || !(retval instanceof List) || ((List)retval).isEmpty()) { - // Returns an empty list - return Collections.emptyList(); - } - return CompatUtils.copyInputMethodSubtypeListToWrapper(retval); + return mImm.getEnabledInputMethodSubtypeList(imi, allowsImplicitlySelectedSubtypes); } - public Map> - getShortcutInputMethodsAndSubtypes() { - Object retval = CompatUtils.invoke(mImm, null, METHOD_getShortcutInputMethodsAndSubtypes); - if (retval == null || !(retval instanceof Map) || ((Map)retval).isEmpty()) { - // Returns an empty map - return Collections.emptyMap(); - } - Map> shortcutMap = - new HashMap>(); - final Map retvalMap = (Map)retval; - for (Object key : retvalMap.keySet()) { - if (!(key instanceof InputMethodInfo)) { - Log.e(TAG, "Class type error."); - return null; - } - shortcutMap.put((InputMethodInfo)key, - CompatUtils.copyInputMethodSubtypeListToWrapper(retvalMap.get(key))); - } - return shortcutMap; + public Map> getShortcutInputMethodsAndSubtypes() { + return mImm.getShortcutInputMethodsAndSubtypes(); } // We don't call this method when we switch between subtypes within this IME. - public void setInputMethodAndSubtype( - IBinder token, String id, InputMethodSubtypeCompatWrapper subtype) { - // TODO: Support subtype change on non-subtype-supported platform. - if (subtype != null && subtype.hasOriginalObject()) { - CompatUtils.invoke(mImm, null, METHOD_setInputMethodAndSubtype, - token, id, subtype.getOriginalObject()); - } else { - mImm.setInputMethod(token, id); - } + public void setInputMethodAndSubtype(IBinder token, String id, InputMethodSubtype subtype) { + mImm.setInputMethodAndSubtype(token, id, subtype); } public boolean switchToLastInputMethod(IBinder token) { - return (Boolean)CompatUtils.invoke(mImm, false, METHOD_switchToLastInputMethod, token); + return mImm.switchToLastInputMethod(token); } public boolean switchToNextInputMethod(IBinder token, boolean onlyCurrentIme) { -- cgit v1.2.3-83-g751a