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

Commit 4480564b authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by android-build-merger
Browse files

Merge "Get rid of custom negaitve save button label am: dc6cccb9" into oc-dev-plus-aosp

am: c8dda2ad

Change-Id: Idb3668a644fa3a528811f59121fb0e5e252a82db
parents b6cfad8b c8dda2ad
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -37122,6 +37122,8 @@ package android.service.autofill {
    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 int FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE = 1; // 0x1
    field public static final int NEGATIVE_BUTTON_STYLE_CANCEL = 0; // 0x0
    field public static final int NEGATIVE_BUTTON_STYLE_REJECT = 1; // 0x1
    field public static final int SAVE_DATA_TYPE_ADDRESS = 2; // 0x2
    field public static final int SAVE_DATA_TYPE_CREDIT_CARD = 4; // 0x4
    field public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 16; // 0x10
@@ -37135,7 +37137,7 @@ package android.service.autofill {
    method public android.service.autofill.SaveInfo build();
    method public android.service.autofill.SaveInfo.Builder setDescription(java.lang.CharSequence);
    method public android.service.autofill.SaveInfo.Builder setFlags(int);
    method public android.service.autofill.SaveInfo.Builder setNegativeAction(java.lang.CharSequence, android.content.IntentSender);
    method public android.service.autofill.SaveInfo.Builder setNegativeAction(int, android.content.IntentSender);
    method public android.service.autofill.SaveInfo.Builder setOptionalIds(android.view.autofill.AutofillId[]);
  }
+3 −1
Original line number Diff line number Diff line
@@ -40237,6 +40237,8 @@ package android.service.autofill {
    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 int FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE = 1; // 0x1
    field public static final int NEGATIVE_BUTTON_STYLE_CANCEL = 0; // 0x0
    field public static final int NEGATIVE_BUTTON_STYLE_REJECT = 1; // 0x1
    field public static final int SAVE_DATA_TYPE_ADDRESS = 2; // 0x2
    field public static final int SAVE_DATA_TYPE_CREDIT_CARD = 4; // 0x4
    field public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 16; // 0x10
@@ -40250,7 +40252,7 @@ package android.service.autofill {
    method public android.service.autofill.SaveInfo build();
    method public android.service.autofill.SaveInfo.Builder setDescription(java.lang.CharSequence);
    method public android.service.autofill.SaveInfo.Builder setFlags(int);
    method public android.service.autofill.SaveInfo.Builder setNegativeAction(java.lang.CharSequence, android.content.IntentSender);
    method public android.service.autofill.SaveInfo.Builder setNegativeAction(int, android.content.IntentSender);
    method public android.service.autofill.SaveInfo.Builder setOptionalIds(android.view.autofill.AutofillId[]);
  }
+3 −1
Original line number Diff line number Diff line
@@ -37276,6 +37276,8 @@ package android.service.autofill {
    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 int FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE = 1; // 0x1
    field public static final int NEGATIVE_BUTTON_STYLE_CANCEL = 0; // 0x0
    field public static final int NEGATIVE_BUTTON_STYLE_REJECT = 1; // 0x1
    field public static final int SAVE_DATA_TYPE_ADDRESS = 2; // 0x2
    field public static final int SAVE_DATA_TYPE_CREDIT_CARD = 4; // 0x4
    field public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 16; // 0x10
@@ -37289,7 +37291,7 @@ package android.service.autofill {
    method public android.service.autofill.SaveInfo build();
    method public android.service.autofill.SaveInfo.Builder setDescription(java.lang.CharSequence);
    method public android.service.autofill.SaveInfo.Builder setFlags(int);
    method public android.service.autofill.SaveInfo.Builder setNegativeAction(java.lang.CharSequence, android.content.IntentSender);
    method public android.service.autofill.SaveInfo.Builder setNegativeAction(int, android.content.IntentSender);
    method public android.service.autofill.SaveInfo.Builder setOptionalIds(android.view.autofill.AutofillId[]);
  }
+8 −4
Original line number Diff line number Diff line
@@ -223,9 +223,11 @@ public abstract class AutofillService extends Service {
     * @hide
     */
    @Deprecated
    public abstract void onFillRequest(@NonNull AssistStructure structure, @Nullable Bundle data,
    public void onFillRequest(@NonNull AssistStructure structure, @Nullable Bundle data,
            int flags, @NonNull CancellationSignal cancellationSignal,
            @NonNull FillCallback callback);
            @NonNull FillCallback callback) {

    }

    /**
     * Called when user requests service to save the fields of an {@link Activity}.
@@ -260,8 +262,10 @@ public abstract class AutofillService extends Service {
     * @hide
     */
    @Deprecated
    public abstract void onSaveRequest(@NonNull AssistStructure structure, @Nullable Bundle data,
            @NonNull SaveCallback callback);
    public void onSaveRequest(@NonNull AssistStructure structure, @Nullable Bundle data,
            @NonNull SaveCallback callback) {

    }

    /**
     * Called when the Android system disconnects from the service.
+59 −26
Original line number Diff line number Diff line
@@ -139,6 +139,33 @@ public final class SaveInfo implements Parcelable {
     */
    public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 0x10;

    /**
     * Style for the negative button of the save UI to cancel the
     * save operation. In this case, the user tapping the negative
     * button signals that they would prefer to not save the filled
     * content.
     */
    public static final int NEGATIVE_BUTTON_STYLE_CANCEL = 0;

    /**
     * Style for the negative button of the save UI to reject the
     * save operation. This could be useful if the user needs to
     * opt-in your service and the save prompt is an advertisement
     * of the potential value you can add to the user. In this
     * case, the user tapping the negative button sends a strong
     * signal that the feature may not be useful and you may
     * consider some backoff strategy.
     */
    public static final int NEGATIVE_BUTTON_STYLE_REJECT = 1;

    /** @hide */
    @IntDef(
        value = {
                NEGATIVE_BUTTON_STYLE_CANCEL,
                NEGATIVE_BUTTON_STYLE_REJECT})
    @Retention(RetentionPolicy.SOURCE)
    @interface NegativeButtonStyle{}

    /** @hide */
    @IntDef(
       flag = true,
@@ -166,7 +193,7 @@ public final class SaveInfo implements Parcelable {
    @interface SaveInfoFlags{}

    private final @SaveDataType int mType;
    private final CharSequence mNegativeActionTitle;
    private final @NegativeButtonStyle int mNegativeButtonStyle;
    private final IntentSender mNegativeActionListener;
    private final AutofillId[] mRequiredIds;
    private final AutofillId[] mOptionalIds;
@@ -175,7 +202,7 @@ public final class SaveInfo implements Parcelable {

    private SaveInfo(Builder builder) {
        mType = builder.mType;
        mNegativeActionTitle = builder.mNegativeActionTitle;
        mNegativeButtonStyle = builder.mNegativeButtonStyle;
        mNegativeActionListener = builder.mNegativeActionListener;
        mRequiredIds = builder.mRequiredIds;
        mOptionalIds = builder.mOptionalIds;
@@ -184,8 +211,8 @@ public final class SaveInfo implements Parcelable {
    }

    /** @hide */
    public @Nullable CharSequence getNegativeActionTitle() {
        return mNegativeActionTitle;
    public @NegativeButtonStyle int getNegativeActionStyle() {
        return mNegativeButtonStyle;
    }

    /** @hide */
@@ -224,7 +251,7 @@ public final class SaveInfo implements Parcelable {
    public static final class Builder {

        private final @SaveDataType int mType;
        private CharSequence mNegativeActionTitle;
        private @NegativeButtonStyle int mNegativeButtonStyle = NEGATIVE_BUTTON_STYLE_CANCEL;
        private IntentSender mNegativeActionListener;
        private final AutofillId[] mRequiredIds;
        private AutofillId[] mOptionalIds;
@@ -298,38 +325,42 @@ public final class SaveInfo implements Parcelable {
            return this;
        }

        /** @hide */
        // TODO (b/37563972): Remove when callers migrate
        public @NonNull Builder setNegativeAction(@Nullable CharSequence title,
                @Nullable IntentSender listener) {
            throwIfDestroyed();
            setNegativeAction(NEGATIVE_BUTTON_STYLE_CANCEL, listener);
            return this;
        }

        /**
         * Sets the title and listener for the negative save action.
         * Sets the style and listener for the negative save action.
         *
         * <p>This allows a fill-provider to customize the text and be
         * <p>This allows a fill-provider to customize the style and be
         * notified when the user selects the negative action in the save
         * UI. Note that selecting the negative action regardless of its text
         * UI. Note that selecting the negative action regardless of its style
         * and listener being customized would dismiss the save UI and if a
         * custom listener intent is provided then this intent will be
         * started.</p>
         *
         * <p>This customization could be useful for providing additional
         * semantics to the negative action. For example, a fill-provider
         * can use this mechanism to add a "Disable" function or a "More info"
         * function, etc. Note that the save action is exclusively controlled
         * by the platform to ensure user consent is collected to release
         * data from the filled app to the fill-provider.</p>
         * started. The default style is {@link #NEGATIVE_BUTTON_STYLE_CANCEL}</p>
         *
         * @param title The action title.
         * @param style The action style.
         * @param listener The action listener.
         * @return This builder.
         *
         * @throws IllegalArgumentException If the title and the listener
         *     are not both either null or non-null.
         * @see #NEGATIVE_BUTTON_STYLE_CANCEL
         * @see #NEGATIVE_BUTTON_STYLE_REJECT
         *
         * @throws IllegalArgumentException If the style is invalid
         */
        public @NonNull Builder setNegativeAction(@Nullable CharSequence title,
        public @NonNull Builder setNegativeAction(@NegativeButtonStyle int style,
                @Nullable IntentSender listener) {
            throwIfDestroyed();
            if (title == null ^ listener == null) {
                throw new IllegalArgumentException("title and listener"
                        + " must be both non-null or null");
            if (style != NEGATIVE_BUTTON_STYLE_CANCEL
                    && style != NEGATIVE_BUTTON_STYLE_REJECT) {
                throw new IllegalArgumentException("Invalid style: " + style);
            }
            mNegativeActionTitle = title;
            mNegativeButtonStyle = style;
            mNegativeActionListener = listener;
            return this;
        }
@@ -363,6 +394,8 @@ public final class SaveInfo implements Parcelable {
                .append(", requiredIds=").append(Arrays.toString(mRequiredIds))
                .append(", optionalIds=").append(Arrays.toString(mOptionalIds))
                .append(", description=").append(mDescription)
                .append(DebugUtils.flagsToString(SaveInfo.class, "NEGATIVE_BUTTON_STYLE_",
                        mNegativeButtonStyle))
                .append(", mFlags=").append(mFlags)
                .append("]").toString();
    }
@@ -380,7 +413,7 @@ public final class SaveInfo implements Parcelable {
    public void writeToParcel(Parcel parcel, int flags) {
        parcel.writeInt(mType);
        parcel.writeParcelableArray(mRequiredIds, flags);
        parcel.writeCharSequence(mNegativeActionTitle);
        parcel.writeInt(mNegativeButtonStyle);
        parcel.writeParcelable(mNegativeActionListener, flags);
        parcel.writeParcelableArray(mOptionalIds, flags);
        parcel.writeCharSequence(mDescription);
@@ -395,7 +428,7 @@ public final class SaveInfo implements Parcelable {
            // using specially crafted parcels.
            final Builder builder = new Builder(parcel.readInt(),
                    parcel.readParcelableArray(null, AutofillId.class));
            builder.setNegativeAction(parcel.readCharSequence(), parcel.readParcelable(null));
            builder.setNegativeAction(parcel.readInt(), parcel.readParcelable(null));
            builder.setOptionalIds(parcel.readParcelableArray(null, AutofillId.class));
            builder.setDescription(parcel.readCharSequence());
            builder.setFlags(parcel.readInt());
Loading