diff --git a/core/java/com/android/internal/inputmethod/InputMethodUtils.java b/core/java/com/android/internal/inputmethod/InputMethodUtils.java index 7f289d0555bc4..1e5b5c80f31b4 100644 --- a/core/java/com/android/internal/inputmethod/InputMethodUtils.java +++ b/core/java/com/android/internal/inputmethod/InputMethodUtils.java @@ -67,7 +67,6 @@ public class InputMethodUtils { private static final String NOT_A_SUBTYPE_ID_STR = String.valueOf(NOT_A_SUBTYPE_ID); private static final String TAG_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE = "EnabledWhenDefaultIsNotAsciiCapable"; - private static final String TAG_ASCII_CAPABLE = "AsciiCapable"; // The string for enabled input method is saved as follows: // example: ("ime0;subtype0;subtype1;subtype2:ime1:ime2;subtype0") @@ -539,7 +538,7 @@ public class InputMethodUtils { final int numApplicationSubtypes = applicableSubtypes.size(); for (int i = 0; i < numApplicationSubtypes; ++i) { final InputMethodSubtype subtype = applicableSubtypes.get(i); - if (subtype.containsExtraValueKey(TAG_ASCII_CAPABLE)) { + if (subtype.isAsciiCapable()) { hasAsciiCapableKeyboard = true; break; } diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 21c10ce89c1a7..158d4e57934f2 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -3419,10 +3419,16 @@ constructor or 0. Arrays.hashCode(new Object[] {locale, mode, extraValue, isAuxiliary, overridesImplicitlyEnabledSubtype}) will be used instead. --> - + ASCII-characters. + +

Note: In order to avoid some known system issues on + {@link android.os.Build.VERSION_CODES#P} and prior OSes, you may want to include + {@code "AsciiCapable"} in + {@link android.R.styleable#InputMethod_Subtype_imeSubtypeExtraValue} when you specify + {@code true} to this attribute.--> diff --git a/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java b/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java index 863cf05ec95fc..a49e203532afd 100644 --- a/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java +++ b/core/tests/coretests/src/com/android/internal/inputmethod/InputMethodUtilsTest.java @@ -87,7 +87,6 @@ public class InputMethodUtilsTest { private static final String SUBTYPE_MODE_HANDWRITING = "handwriting"; private static final String SUBTYPE_MODE_ANY = null; private static final String EXTRA_VALUE_PAIR_SEPARATOR = ","; - private static final String EXTRA_VALUE_ASCII_CAPABLE = "AsciiCapable"; private static final String EXTRA_VALUE_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE = "EnabledWhenDefaultIsNotAsciiCapable"; @@ -910,13 +909,6 @@ public class InputMethodUtilsTest { subtypeExtraValue.append(EXTRA_VALUE_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE); } - // TODO: Remove following code. InputMethodSubtype#isAsciiCapable() has been publicly - // available since API level 19 (KitKat). We no longer need to rely on extra value. - if (isAsciiCapable) { - subtypeExtraValue.append(EXTRA_VALUE_PAIR_SEPARATOR); - subtypeExtraValue.append(EXTRA_VALUE_ASCII_CAPABLE); - } - return new InputMethodSubtypeBuilder() .setSubtypeNameResId(0) .setSubtypeIconResId(0)