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

Commit bffb83e9 authored by satok's avatar satok Committed by Android (Google) Code Review
Browse files

Merge "Add an option for the implicitly selected subtype"

parents 1d477c53 a86f5e44
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -709,6 +709,7 @@ package android {
    field public static final int overScrollFooter = 16843459; // 0x10102c3
    field public static final int overScrollHeader = 16843458; // 0x10102c2
    field public static final int overScrollMode = 16843457; // 0x10102c1
    field public static final int overridesImplicitlyEnabledSubtype = 16843696; // 0x10103b0
    field public static final int packageNames = 16843649; // 0x1010381
    field public static final int padding = 16842965; // 0x10100d5
    field public static final int paddingBottom = 16842969; // 0x10100d9
@@ -24531,6 +24532,7 @@ package android.view.inputmethod {
  }
  public final class InputMethodSubtype implements android.os.Parcelable {
    ctor public InputMethodSubtype(int, int, java.lang.String, java.lang.String, java.lang.String, boolean, boolean);
    method public boolean containsExtraValueKey(java.lang.String);
    method public int describeContents();
    method public java.lang.CharSequence getDisplayName(android.content.Context, java.lang.String, android.content.pm.ApplicationInfo);
@@ -24541,6 +24543,7 @@ package android.view.inputmethod {
    method public java.lang.String getMode();
    method public int getNameResId();
    method public boolean isAuxiliary();
    method public boolean overridesImplicitlyEnabledSubtype();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
  }
+3 −1
Original line number Diff line number Diff line
@@ -164,7 +164,9 @@ public final class InputMethodInfo implements Parcelable {
                            a.getString(com.android.internal.R.styleable
                                    .InputMethod_Subtype_imeSubtypeExtraValue),
                            a.getBoolean(com.android.internal.R.styleable
                                    .InputMethod_Subtype_isAuxiliary, false));
                                    .InputMethod_Subtype_isAuxiliary, false),
                            a.getBoolean(com.android.internal.R.styleable
                                    .InputMethod_Subtype_overridesImplicitlyEnabledSubtype, false));
                    mSubtypes.add(subtype);
                }
            }
+25 −9
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public final class InputMethodSubtype implements Parcelable {
    private static final String EXTRA_VALUE_KEY_VALUE_SEPARATOR = "=";

    private final boolean mIsAuxiliary;
    private final boolean mOverridesImplicitlyEnabledSubtype;
    private final int mSubtypeHashCode;
    private final int mSubtypeIconResId;
    private final int mSubtypeNameResId;
@@ -57,11 +58,12 @@ public final class InputMethodSubtype implements Parcelable {
     * @param locale The locale supported by the subtype
     * @param mode The mode supported by the subtype
     * @param extraValue The extra value of the subtype
     * @param isAuxiliary true when this subtype is one shot subtype.
     * @hide
     */
    public InputMethodSubtype(
            int nameId, int iconId, String locale, String mode, String extraValue) {
        this(nameId, iconId, locale, mode, extraValue, false);
    public InputMethodSubtype(int nameId, int iconId, String locale, String mode, String extraValue,
            boolean isAuxiliary) {
        this(nameId, iconId, locale, mode, extraValue, false, false);
    }

    /**
@@ -72,18 +74,21 @@ public final class InputMethodSubtype implements Parcelable {
     * @param mode The mode supported by the subtype
     * @param extraValue The extra value of the subtype
     * @param isAuxiliary true when this subtype is one shot subtype.
     * @hide
     * @param overridesImplicitlyEnabledSubtype true when this subtype should be selected by default
     * if no other subtypes are selected explicitly. Note that a subtype with this parameter being
     * true will not be shown in the subtypes list.
     */
    public InputMethodSubtype(int nameId, int iconId, String locale, String mode, String extraValue,
            boolean isAuxiliary) {
            boolean isAuxiliary, boolean overridesImplicitlyEnabledSubtype) {
        mSubtypeNameResId = nameId;
        mSubtypeIconResId = iconId;
        mSubtypeLocale = locale != null ? locale : "";
        mSubtypeMode = mode != null ? mode : "";
        mSubtypeExtraValue = extraValue != null ? extraValue : "";
        mIsAuxiliary = isAuxiliary;
        mOverridesImplicitlyEnabledSubtype = overridesImplicitlyEnabledSubtype;
        mSubtypeHashCode = hashCodeInternal(mSubtypeLocale, mSubtypeMode, mSubtypeExtraValue,
                mIsAuxiliary);
                mIsAuxiliary, mOverridesImplicitlyEnabledSubtype);
    }

    InputMethodSubtype(Parcel source) {
@@ -97,8 +102,9 @@ public final class InputMethodSubtype implements Parcelable {
        s = source.readString();
        mSubtypeExtraValue = s != null ? s : "";
        mIsAuxiliary = (source.readInt() == 1);
        mOverridesImplicitlyEnabledSubtype = (source.readInt() == 1);
        mSubtypeHashCode = hashCodeInternal(mSubtypeLocale, mSubtypeMode, mSubtypeExtraValue,
                mIsAuxiliary);
                mIsAuxiliary, mOverridesImplicitlyEnabledSubtype);
    }

    /**
@@ -145,6 +151,14 @@ public final class InputMethodSubtype implements Parcelable {
        return mIsAuxiliary;
    }

    /**
     * @return true when this subtype is selected by default if no other subtypes are selected
     * explicitly. Note that a subtype that returns true will not be shown in the subtypes list.
     */
    public boolean overridesImplicitlyEnabledSubtype() {
        return mOverridesImplicitlyEnabledSubtype;
    }

    /**
     * @param context Context will be used for getting Locale and PackageManager.
     * @param packageName The package name of the IME
@@ -244,6 +258,7 @@ public final class InputMethodSubtype implements Parcelable {
        dest.writeString(mSubtypeMode);
        dest.writeString(mSubtypeExtraValue);
        dest.writeInt(mIsAuxiliary ? 1 : 0);
        dest.writeInt(mOverridesImplicitlyEnabledSubtype ? 1 : 0);
    }

    public static final Parcelable.Creator<InputMethodSubtype> CREATOR
@@ -276,8 +291,9 @@ public final class InputMethodSubtype implements Parcelable {
    }

    private static int hashCodeInternal(String locale, String mode, String extraValue,
            boolean isAuxiliary) {
        return Arrays.hashCode(new Object[] {locale, mode, extraValue, isAuxiliary});
            boolean isAuxiliary, boolean overridesImplicitlyEnabledSubtype) {
        return Arrays.hashCode(new Object[] {locale, mode, extraValue, isAuxiliary,
                overridesImplicitlyEnabledSubtype});
    }

    /**
+4 −0
Original line number Diff line number Diff line
@@ -2237,6 +2237,10 @@
             InputMethodManager#switchToLastInputMethod will ignore auxiliary subtypes when it
             chooses a target subtype. -->
        <attr name="isAuxiliary" format="boolean" />
        <!-- Set true when this subtype should be selected by default if no other subtypes are
             selected explicitly. Note that a subtype with this parameter being true will
             not be shown in the subtypes list. -->
        <attr name="overridesImplicitlyEnabledSubtype" format="boolean" />
        <!-- The extra value of the subtype. This string can be any string and will be passed to
             the IME when the framework calls the IME with the subtype.  -->
        <attr name="imeSubtypeExtraValue" format="string" />
+1 −0
Original line number Diff line number Diff line
@@ -2010,4 +2010,5 @@
  <public type="attr" name="targetDescriptions" />
  <public type="attr" name="directionDescriptions" />

  <public type="attr" name="overridesImplicitlyEnabledSubtype" />
</resources>
Loading