Fix lib and compat bugs.

Compat issues will be merged to master.

Change-Id: I3285606006483e247bea25ee77979cf71095b9c1
This commit is contained in:
satok 2011-03-25 17:06:35 -07:00
parent a511e0b432
commit 829b97b28d
6 changed files with 10 additions and 6 deletions

View file

@ -47,7 +47,7 @@
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/LatinIME*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/LatinIME.apk)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libjni_latinime_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libjni_latinime2_intermediates)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************

View file

@ -9,7 +9,7 @@ LOCAL_PACKAGE_NAME := LatinIME
LOCAL_CERTIFICATE := shared
LOCAL_JNI_SHARED_LIBRARIES := libjni_latinime
LOCAL_JNI_SHARED_LIBRARIES := libjni_latinime2
LOCAL_STATIC_JAVA_LIBRARIES := android-common

View file

@ -68,6 +68,7 @@ public class CompatUtils {
public static Method getMethod(Class<?> targetClass, String name,
Class<?>... parameterTypes) {
if (targetClass == null || TextUtils.isEmpty(name)) return null;
try {
return targetClass.getMethod(name, parameterTypes);
} catch (SecurityException e) {

View file

@ -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;
@ -78,7 +79,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;

View file

@ -48,7 +48,8 @@ public final class InputMethodSubtypeCompatWrapper extends AbstractCompatWrapper
CompatUtils.getMethod(CLASS_InputMethodSubtype, "getExtraValueOf", String.class);
public InputMethodSubtypeCompatWrapper(Object subtype) {
super(CLASS_InputMethodSubtype.isInstance(subtype) ? subtype : null);
super((CLASS_InputMethodSubtype != null && CLASS_InputMethodSubtype.isInstance(subtype))
? subtype : null);
if (DBG) {
Log.d(TAG, "CreateInputMethodSubtypeCompatWrapper");
}

View file

@ -534,9 +534,9 @@ public class Utils {
public static void loadNativeLibrary() {
try {
System.loadLibrary("jni_latinime");
System.loadLibrary("jni_latinime2");
} catch (UnsatisfiedLinkError ule) {
Log.e(TAG, "Could not load native library jni_latinime");
Log.e(TAG, "Could not load native library jni_latinime2");
}
}