aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/compat
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2014-07-02 13:29:36 +0900
committerYohei Yukawa <yukawa@google.com>2014-07-04 15:08:58 +0900
commit3895d7f8dc2e4999947f61220b86fa148f433413 (patch)
treeed5ee83335e18f8dd78c732f7198d0391f62bba5 /java/src/com/android/inputmethod/compat
parent0100a49bdd7658814b016fbefe63148e57d6096f (diff)
downloadlatinime-3895d7f8dc2e4999947f61220b86fa148f433413.tar.gz
latinime-3895d7f8dc2e4999947f61220b86fa148f433413.tar.xz
latinime-3895d7f8dc2e4999947f61220b86fa148f433413.zip
Additional subtype ID should be independent of OS-version
This CL consolidates the initialization logic for additional subtypes so that each additional subtypes can have predictable subtype ID regardless of OS version. Previously subtype IDs for additional subtypes are calculated differently depending on the running OS version with hoping it minimizes the risk of compatibility issues. However, it is getting harder and harder to maintain slightly different logic between OSes. Thus we decided to unify the logic into that in KitKat even though it may causes some breaking changes. Note that the actual extra values that are used to instantiate InputMethodSubtype object are still determined on the fly depending on the running OS version. However these actual extra values are no longer used for the subtype ID calculation. BUG: 16000850 Change-Id: Id3c262386a7bc7ed75966b1395a50171abe550d3
Diffstat (limited to 'java/src/com/android/inputmethod/compat')
-rw-r--r--java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java b/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java
index 4ea7fb888..ee9125a07 100644
--- a/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/InputMethodSubtypeCompatUtils.java
@@ -19,6 +19,7 @@ package com.android.inputmethod.compat;
import android.os.Build;
import android.view.inputmethod.InputMethodSubtype;
+import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.latin.Constants;
import java.lang.reflect.Constructor;
@@ -64,7 +65,12 @@ public final class InputMethodSubtypeCompatUtils {
}
public static boolean isAsciiCapable(final InputMethodSubtype subtype) {
- return (Boolean)CompatUtils.invoke(subtype, false, METHOD_isAsciiCapable)
+ return isAsciiCapableWithAPI(subtype)
|| subtype.containsExtraValueKey(Constants.Subtype.ExtraValue.ASCII_CAPABLE);
}
+
+ @UsedForTesting
+ public static boolean isAsciiCapableWithAPI(final InputMethodSubtype subtype) {
+ return (Boolean)CompatUtils.invoke(subtype, false, METHOD_isAsciiCapable);
+ }
}