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

Commit 49b37310 authored by Felipe Leme's avatar Felipe Leme Committed by android-build-merger
Browse files

Merge "Autofill Partitioning: support multiple SaveInfos." into oc-dev

am: 5c8d88e8

Change-Id: Ia363ebbbf73514936776b7b0a9ca7ba0f65bf1bc
parents c91a7466 5c8d88e8
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -37038,11 +37038,11 @@ package android.service.autofill {
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.SaveInfo> CREATOR;
    field public static final android.os.Parcelable.Creator<android.service.autofill.SaveInfo> CREATOR;
    field public static final int SAVE_DATA_TYPE_ADDRESS = 2; // 0x2
    field public static final int SAVE_DATA_TYPE_ADDRESS = 2; // 0x2
    field public static final int SAVE_DATA_TYPE_CREDIT_CARD = 3; // 0x3
    field public static final int SAVE_DATA_TYPE_CREDIT_CARD = 4; // 0x4
    field public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 5; // 0x5
    field public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 16; // 0x10
    field public static final int SAVE_DATA_TYPE_GENERIC = 0; // 0x0
    field public static final int SAVE_DATA_TYPE_GENERIC = 0; // 0x0
    field public static final int SAVE_DATA_TYPE_PASSWORD = 1; // 0x1
    field public static final int SAVE_DATA_TYPE_PASSWORD = 1; // 0x1
    field public static final int SAVE_DATA_TYPE_USERNAME = 4; // 0x4
    field public static final int SAVE_DATA_TYPE_USERNAME = 8; // 0x8
  }
  }
  public static final class SaveInfo.Builder {
  public static final class SaveInfo.Builder {
+3 −3
Original line number Original line Diff line number Diff line
@@ -40134,11 +40134,11 @@ package android.service.autofill {
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.SaveInfo> CREATOR;
    field public static final android.os.Parcelable.Creator<android.service.autofill.SaveInfo> CREATOR;
    field public static final int SAVE_DATA_TYPE_ADDRESS = 2; // 0x2
    field public static final int SAVE_DATA_TYPE_ADDRESS = 2; // 0x2
    field public static final int SAVE_DATA_TYPE_CREDIT_CARD = 3; // 0x3
    field public static final int SAVE_DATA_TYPE_CREDIT_CARD = 4; // 0x4
    field public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 5; // 0x5
    field public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 16; // 0x10
    field public static final int SAVE_DATA_TYPE_GENERIC = 0; // 0x0
    field public static final int SAVE_DATA_TYPE_GENERIC = 0; // 0x0
    field public static final int SAVE_DATA_TYPE_PASSWORD = 1; // 0x1
    field public static final int SAVE_DATA_TYPE_PASSWORD = 1; // 0x1
    field public static final int SAVE_DATA_TYPE_USERNAME = 4; // 0x4
    field public static final int SAVE_DATA_TYPE_USERNAME = 8; // 0x8
  }
  }
  public static final class SaveInfo.Builder {
  public static final class SaveInfo.Builder {
+3 −3
Original line number Original line Diff line number Diff line
@@ -37196,11 +37196,11 @@ package android.service.autofill {
    method public void writeToParcel(android.os.Parcel, int);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.SaveInfo> CREATOR;
    field public static final android.os.Parcelable.Creator<android.service.autofill.SaveInfo> CREATOR;
    field public static final int SAVE_DATA_TYPE_ADDRESS = 2; // 0x2
    field public static final int SAVE_DATA_TYPE_ADDRESS = 2; // 0x2
    field public static final int SAVE_DATA_TYPE_CREDIT_CARD = 3; // 0x3
    field public static final int SAVE_DATA_TYPE_CREDIT_CARD = 4; // 0x4
    field public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 5; // 0x5
    field public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 16; // 0x10
    field public static final int SAVE_DATA_TYPE_GENERIC = 0; // 0x0
    field public static final int SAVE_DATA_TYPE_GENERIC = 0; // 0x0
    field public static final int SAVE_DATA_TYPE_PASSWORD = 1; // 0x1
    field public static final int SAVE_DATA_TYPE_PASSWORD = 1; // 0x1
    field public static final int SAVE_DATA_TYPE_USERNAME = 4; // 0x4
    field public static final int SAVE_DATA_TYPE_USERNAME = 8; // 0x8
  }
  }
  public static final class SaveInfo.Builder {
  public static final class SaveInfo.Builder {
+20 −37
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import android.content.IntentSender;
import android.os.Bundle;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable;
import android.util.DebugUtils;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillValue;
import android.view.autofill.AutofillValue;
@@ -111,52 +112,41 @@ public final class SaveInfo implements Parcelable {
     * Type used on when the service can save the contents of an activity, but cannot describe what
     * Type used on when the service can save the contents of an activity, but cannot describe what
     * the content is for.
     * the content is for.
     */
     */
    public static final int SAVE_DATA_TYPE_GENERIC = 0;
    public static final int SAVE_DATA_TYPE_GENERIC = 0x0;


    /**
    /**
     * Type used when the {@link FillResponse} represents user credentials that have a password.
     * Type used when the {@link FillResponse} represents user credentials that have a password.
     */
     */
    public static final int SAVE_DATA_TYPE_PASSWORD = 1;
    public static final int SAVE_DATA_TYPE_PASSWORD = 0x01;


    /**
    /**
     * Type used on when the {@link FillResponse} represents a physical address (such as street,
     * Type used on when the {@link FillResponse} represents a physical address (such as street,
     * city, state, etc).
     * city, state, etc).
     */
     */
    public static final int SAVE_DATA_TYPE_ADDRESS = 2;
    public static final int SAVE_DATA_TYPE_ADDRESS = 0x02;


    /**
    /**
     * Type used when the {@link FillResponse} represents a credit card.
     * Type used when the {@link FillResponse} represents a credit card.
     */
     */
    public static final int SAVE_DATA_TYPE_CREDIT_CARD = 3;
    public static final int SAVE_DATA_TYPE_CREDIT_CARD = 0x04;


    /**
    /**
     * Type used when the {@link FillResponse} represents just an username, without a password.
     * Type used when the {@link FillResponse} represents just an username, without a password.
     */
     */
    public static final int SAVE_DATA_TYPE_USERNAME = 4;
    public static final int SAVE_DATA_TYPE_USERNAME = 0x08;


    /**
    /**
     * Type used when the {@link FillResponse} represents just an email address, without a password.
     * Type used when the {@link FillResponse} represents just an email address, without a password.
     */
     */
    public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 5;
    public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 0x10;


    private final @SaveDataType int mType;
    private final int mType;
    private final CharSequence mNegativeActionTitle;
    private final CharSequence mNegativeActionTitle;
    private final IntentSender mNegativeActionListener;
    private final IntentSender mNegativeActionListener;
    private final AutofillId[] mRequiredIds;
    private final AutofillId[] mRequiredIds;
    private final AutofillId[] mOptionalIds;
    private final AutofillId[] mOptionalIds;
    private final CharSequence mDescription;
    private final CharSequence mDescription;


    /** @hide */
    @IntDef({
        SAVE_DATA_TYPE_GENERIC,
        SAVE_DATA_TYPE_PASSWORD,
        SAVE_DATA_TYPE_ADDRESS,
        SAVE_DATA_TYPE_CREDIT_CARD
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface SaveDataType {
    }

    private SaveInfo(Builder builder) {
    private SaveInfo(Builder builder) {
        mType = builder.mType;
        mType = builder.mType;
        mNegativeActionTitle = builder.mNegativeActionTitle;
        mNegativeActionTitle = builder.mNegativeActionTitle;
@@ -201,7 +191,7 @@ public final class SaveInfo implements Parcelable {
     */
     */
    public static final class Builder {
    public static final class Builder {


        private final @SaveDataType int mType;
        private final int mType;
        private CharSequence mNegativeActionTitle;
        private CharSequence mNegativeActionTitle;
        private IntentSender mNegativeActionListener;
        private IntentSender mNegativeActionListener;
        // TODO(b/33197203): make mRequiredIds final once addSavableIds() is gone
        // TODO(b/33197203): make mRequiredIds final once addSavableIds() is gone
@@ -213,32 +203,24 @@ public final class SaveInfo implements Parcelable {
        /**
        /**
         * Creates a new builder.
         * Creates a new builder.
         *
         *
         * @param type the type of information the associated {@link FillResponse} represents. Must
         * @param type the type of information the associated {@link FillResponse} represents, can
         * be {@link SaveInfo#SAVE_DATA_TYPE_GENERIC}, {@link SaveInfo#SAVE_DATA_TYPE_PASSWORD},
         * be any combination of {@link SaveInfo#SAVE_DATA_TYPE_GENERIC},
         * {@link SaveInfo#SAVE_DATA_TYPE_ADDRESS}, or {@link SaveInfo#SAVE_DATA_TYPE_CREDIT_CARD};
         * {@link SaveInfo#SAVE_DATA_TYPE_PASSWORD},
         * otherwise it will assume {@link SaveInfo#SAVE_DATA_TYPE_GENERIC}.
         * {@link SaveInfo#SAVE_DATA_TYPE_ADDRESS}, {@link SaveInfo#SAVE_DATA_TYPE_CREDIT_CARD},
         * {@link SaveInfo#SAVE_DATA_TYPE_USERNAME}, or
         * {@link SaveInfo#SAVE_DATA_TYPE_EMAIL_ADDRESS}.
         * @param requiredIds ids of all required views that will trigger a save request.
         * @param requiredIds ids of all required views that will trigger a save request.
         *
         *
         * <p>See {@link SaveInfo} for more info.
         * <p>See {@link SaveInfo} for more info.
         *
         *
         * @throws IllegalArgumentException if {@code requiredIds} is {@code null} or empty.
         * @throws IllegalArgumentException if {@code requiredIds} is {@code null} or empty.
         */
         */
        public Builder(@SaveDataType int type, @NonNull AutofillId[] requiredIds) {
        public Builder(int type, @NonNull AutofillId[] requiredIds) {
            if (false) {// TODO(b/33197203): re-move when clients use it
            if (false) {// TODO(b/33197203): re-move when clients use it
            Preconditions.checkArgument(requiredIds != null && requiredIds.length > 0,
            Preconditions.checkArgument(requiredIds != null && requiredIds.length > 0,
                    "must have at least one required id: " + Arrays.toString(requiredIds));
                    "must have at least one required id: " + Arrays.toString(requiredIds));
            }
            }
            switch (type) {
                case SAVE_DATA_TYPE_PASSWORD:
                case SAVE_DATA_TYPE_ADDRESS:
                case SAVE_DATA_TYPE_CREDIT_CARD:
                case SAVE_DATA_TYPE_USERNAME:
                case SAVE_DATA_TYPE_EMAIL_ADDRESS:
            mType = type;
            mType = type;
                    break;
                default:
                    mType = SAVE_DATA_TYPE_GENERIC;
            }
            mRequiredIds = requiredIds;
            mRequiredIds = requiredIds;
        }
        }


@@ -248,7 +230,7 @@ public final class SaveInfo implements Parcelable {
         * // TODO(b/33197203): make sure is removed when clients migrated
         * // TODO(b/33197203): make sure is removed when clients migrated
         */
         */
        @Deprecated
        @Deprecated
        public Builder(@SaveDataType int type) {
        public Builder(int type) {
            this(type, null);
            this(type, null);
        }
        }


@@ -355,7 +337,8 @@ public final class SaveInfo implements Parcelable {
    public String toString() {
    public String toString() {
        if (!DEBUG) return super.toString();
        if (!DEBUG) return super.toString();


        return new StringBuilder("SaveInfo: [type=").append(mType)
        return new StringBuilder("SaveInfo: [type=")
                .append(DebugUtils.flagsToString(SaveInfo.class, "SAVE_DATA_TYPE_", mType))
                .append(", requiredIds=").append(Arrays.toString(mRequiredIds))
                .append(", requiredIds=").append(Arrays.toString(mRequiredIds))
                .append(", optionalIds=").append(Arrays.toString(mOptionalIds))
                .append(", optionalIds=").append(Arrays.toString(mOptionalIds))
                .append(", description=").append(mDescription)
                .append(", description=").append(mDescription)
+8 −0
Original line number Original line Diff line number Diff line
@@ -4594,6 +4594,14 @@
    <!-- Title for the autofill save dialog shown when the the contents of the activity can be saved
    <!-- Title for the autofill save dialog shown when the the contents of the activity can be saved
         by an autofill service, and the service does knows what the activity represents (for example, credit card info) [CHAR LIMIT=NONE] -->
         by an autofill service, and the service does knows what the activity represents (for example, credit card info) [CHAR LIMIT=NONE] -->
    <string name="autofill_save_title_with_type">Save <xliff:g id="type" example="Credit Card">%1$s</xliff:g> to <xliff:g id="label" example="MyPass">%2$s</xliff:g>?</string>
    <string name="autofill_save_title_with_type">Save <xliff:g id="type" example="Credit Card">%1$s</xliff:g> to <xliff:g id="label" example="MyPass">%2$s</xliff:g>?</string>
    <!-- Title for the autofill save dialog shown when the the contents of the activity can be saved
         by an autofill service, and the service does knows what the activity represents, and it represents 2 types of
         data (for example, password and credit card info) [CHAR LIMIT=NONE] -->
    <string name="autofill_save_title_with_2types">Save <xliff:g id="type" example="Password">%1$s</xliff:g>, <xliff:g id="type" example="Credit Card">%2$s</xliff:g> to <xliff:g id="label" example="MyPass">%3$s</xliff:g>?</string>
    <!-- Title for the autofill save dialog shown when the the contents of the activity can be saved
         by an autofill service, and the service does knows what the activity represents, and it represents 3 types of
         data (for example, username, password and credit card info) [CHAR LIMIT=NONE] -->
    <string name="autofill_save_title_with_3types">Save <xliff:g id="type" example="Username">%1$s</xliff:g>, <xliff:g id="type" example="Password">%2$s</xliff:g>, <xliff:g id="type" example="Credit Card">%3$s</xliff:g> to <xliff:g id="label" example="MyPass">%4$s</xliff:g>?</string>
    <!-- Label for the autofill save button [CHAR LIMIT=NONE] -->
    <!-- Label for the autofill save button [CHAR LIMIT=NONE] -->
    <string name="autofill_save_yes">Save</string>
    <string name="autofill_save_yes">Save</string>
    <!-- Label for the autofill cancel button [CHAR LIMIT=NONE] -->
    <!-- Label for the autofill cancel button [CHAR LIMIT=NONE] -->
Loading