Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1eaf643 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Deprecate private AsciiCapable protocol"

parents 31f6a261 b1845f31
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -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 NOT_A_SUBTYPE_ID_STR = String.valueOf(NOT_A_SUBTYPE_ID);
    private static final String TAG_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE =
    private static final String TAG_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE =
            "EnabledWhenDefaultIsNotAsciiCapable";
            "EnabledWhenDefaultIsNotAsciiCapable";
    private static final String TAG_ASCII_CAPABLE = "AsciiCapable";


    // The string for enabled input method is saved as follows:
    // The string for enabled input method is saved as follows:
    // example: ("ime0;subtype0;subtype1;subtype2:ime1:ime2;subtype0")
    // example: ("ime0;subtype0;subtype1;subtype2:ime1:ime2;subtype0")
@@ -539,7 +538,7 @@ public class InputMethodUtils {
            final int numApplicationSubtypes = applicableSubtypes.size();
            final int numApplicationSubtypes = applicableSubtypes.size();
            for (int i = 0; i < numApplicationSubtypes; ++i) {
            for (int i = 0; i < numApplicationSubtypes; ++i) {
                final InputMethodSubtype subtype = applicableSubtypes.get(i);
                final InputMethodSubtype subtype = applicableSubtypes.get(i);
                if (subtype.containsExtraValueKey(TAG_ASCII_CAPABLE)) {
                if (subtype.isAsciiCapable()) {
                    hasAsciiCapableKeyboard = true;
                    hasAsciiCapableKeyboard = true;
                    break;
                    break;
                }
                }
+8 −2
Original line number Original line Diff line number Diff line
@@ -3419,10 +3419,16 @@
             constructor or 0. Arrays.hashCode(new Object[] {locale, mode, extraValue,
             constructor or 0. Arrays.hashCode(new Object[] {locale, mode, extraValue,
             isAuxiliary, overridesImplicitlyEnabledSubtype}) will be used instead. -->
             isAuxiliary, overridesImplicitlyEnabledSubtype}) will be used instead. -->
        <attr name="subtypeId" format="integer"/>
        <attr name="subtypeId" format="integer"/>
        <!-- Set to true if this subtype is ASCII capable. If the subtype is ASCII
        <!-- Set to {@code true} if this subtype is ASCII capable. If the subtype is ASCII
             capable, it should guarantee that the user can input ASCII characters with
             capable, it should guarantee that the user can input ASCII characters with
             this subtype. This is important because many password fields only allow
             this subtype. This is important because many password fields only allow
             ASCII-characters. -->
             ASCII-characters.

             <p>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.-->
        <attr name="isAsciiCapable" format="boolean" />
        <attr name="isAsciiCapable" format="boolean" />
        <!-- The BCP-47 Language Tag of the subtype.  This replaces
        <!-- The BCP-47 Language Tag of the subtype.  This replaces
        {@link android.R.styleable#InputMethod_Subtype_imeSubtypeLocale}.  -->
        {@link android.R.styleable#InputMethod_Subtype_imeSubtypeLocale}.  -->
+0 −8
Original line number Original line Diff line number Diff line
@@ -87,7 +87,6 @@ public class InputMethodUtilsTest {
    private static final String SUBTYPE_MODE_HANDWRITING = "handwriting";
    private static final String SUBTYPE_MODE_HANDWRITING = "handwriting";
    private static final String SUBTYPE_MODE_ANY = null;
    private static final String SUBTYPE_MODE_ANY = null;
    private static final String EXTRA_VALUE_PAIR_SEPARATOR = ",";
    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 =
    private static final String EXTRA_VALUE_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE =
            "EnabledWhenDefaultIsNotAsciiCapable";
            "EnabledWhenDefaultIsNotAsciiCapable";


@@ -910,13 +909,6 @@ public class InputMethodUtilsTest {
            subtypeExtraValue.append(EXTRA_VALUE_ENABLED_WHEN_DEFAULT_IS_NOT_ASCII_CAPABLE);
            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()
        return new InputMethodSubtypeBuilder()
                .setSubtypeNameResId(0)
                .setSubtypeNameResId(0)
                .setSubtypeIconResId(0)
                .setSubtypeIconResId(0)