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

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

Merge "Add a way to read the last AutofillSelection." into oc-dev

parents 500c1d07 cc684ed4
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -37030,6 +37030,7 @@ package android.service.autofill {
  public abstract class AutofillService extends android.app.Service {
    ctor public AutofillService();
    method public final deprecated void disableSelf();
    method public final android.service.autofill.FillEventHistory getFillEventHistory();
    method public final android.os.IBinder onBind(android.content.Intent);
    method public void onConnected();
    method public void onDisconnected();
@@ -37052,6 +37053,7 @@ package android.service.autofill {
    ctor public Dataset.Builder();
    method public android.service.autofill.Dataset build();
    method public android.service.autofill.Dataset.Builder setAuthentication(android.content.IntentSender);
    method public android.service.autofill.Dataset.Builder setId(java.lang.String);
    method public android.service.autofill.Dataset.Builder setValue(android.view.autofill.AutofillId, android.view.autofill.AutofillValue);
    method public android.service.autofill.Dataset.Builder setValue(android.view.autofill.AutofillId, android.view.autofill.AutofillValue, android.widget.RemoteViews);
  }
@@ -37069,6 +37071,23 @@ package android.service.autofill {
    field public static final android.os.Parcelable.Creator<android.service.autofill.FillContext> CREATOR;
  }
  public final class FillEventHistory implements android.os.Parcelable {
    method public int describeContents();
    method public android.os.Bundle getClientState();
    method public java.util.List<android.service.autofill.FillEventHistory.Event> getEvents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.FillEventHistory> CREATOR;
  }
  public static final class FillEventHistory.Event {
    method public java.lang.String getDatasetId();
    method public int getType();
    field public static final int TYPE_AUTHENTICATION_SELECTED = 2; // 0x2
    field public static final int TYPE_DATASET_AUTHENTICATION_SELECTED = 1; // 0x1
    field public static final int TYPE_DATASET_SELECTED = 0; // 0x0
    field public static final int TYPE_SAVE_SHOWN = 3; // 0x3
  }
  public final class FillRequest implements android.os.Parcelable {
    method public int describeContents();
    method public android.os.Bundle getClientState();
+19 −0
Original line number Diff line number Diff line
@@ -40142,6 +40142,7 @@ package android.service.autofill {
  public abstract class AutofillService extends android.app.Service {
    ctor public AutofillService();
    method public final deprecated void disableSelf();
    method public final android.service.autofill.FillEventHistory getFillEventHistory();
    method public final android.os.IBinder onBind(android.content.Intent);
    method public void onConnected();
    method public void onDisconnected();
@@ -40164,6 +40165,7 @@ package android.service.autofill {
    ctor public Dataset.Builder();
    method public android.service.autofill.Dataset build();
    method public android.service.autofill.Dataset.Builder setAuthentication(android.content.IntentSender);
    method public android.service.autofill.Dataset.Builder setId(java.lang.String);
    method public android.service.autofill.Dataset.Builder setValue(android.view.autofill.AutofillId, android.view.autofill.AutofillValue);
    method public android.service.autofill.Dataset.Builder setValue(android.view.autofill.AutofillId, android.view.autofill.AutofillValue, android.widget.RemoteViews);
  }
@@ -40181,6 +40183,23 @@ package android.service.autofill {
    field public static final android.os.Parcelable.Creator<android.service.autofill.FillContext> CREATOR;
  }
  public final class FillEventHistory implements android.os.Parcelable {
    method public int describeContents();
    method public android.os.Bundle getClientState();
    method public java.util.List<android.service.autofill.FillEventHistory.Event> getEvents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.FillEventHistory> CREATOR;
  }
  public static final class FillEventHistory.Event {
    method public java.lang.String getDatasetId();
    method public int getType();
    field public static final int TYPE_AUTHENTICATION_SELECTED = 2; // 0x2
    field public static final int TYPE_DATASET_AUTHENTICATION_SELECTED = 1; // 0x1
    field public static final int TYPE_DATASET_SELECTED = 0; // 0x0
    field public static final int TYPE_SAVE_SHOWN = 3; // 0x3
  }
  public final class FillRequest implements android.os.Parcelable {
    method public int describeContents();
    method public android.os.Bundle getClientState();
+19 −0
Original line number Diff line number Diff line
@@ -37183,6 +37183,7 @@ package android.service.autofill {
  public abstract class AutofillService extends android.app.Service {
    ctor public AutofillService();
    method public final deprecated void disableSelf();
    method public final android.service.autofill.FillEventHistory getFillEventHistory();
    method public final android.os.IBinder onBind(android.content.Intent);
    method public void onConnected();
    method public void onDisconnected();
@@ -37205,6 +37206,7 @@ package android.service.autofill {
    ctor public Dataset.Builder();
    method public android.service.autofill.Dataset build();
    method public android.service.autofill.Dataset.Builder setAuthentication(android.content.IntentSender);
    method public android.service.autofill.Dataset.Builder setId(java.lang.String);
    method public android.service.autofill.Dataset.Builder setValue(android.view.autofill.AutofillId, android.view.autofill.AutofillValue);
    method public android.service.autofill.Dataset.Builder setValue(android.view.autofill.AutofillId, android.view.autofill.AutofillValue, android.widget.RemoteViews);
  }
@@ -37222,6 +37224,23 @@ package android.service.autofill {
    field public static final android.os.Parcelable.Creator<android.service.autofill.FillContext> CREATOR;
  }
  public final class FillEventHistory implements android.os.Parcelable {
    method public int describeContents();
    method public android.os.Bundle getClientState();
    method public java.util.List<android.service.autofill.FillEventHistory.Event> getEvents();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.service.autofill.FillEventHistory> CREATOR;
  }
  public static final class FillEventHistory.Event {
    method public java.lang.String getDatasetId();
    method public int getType();
    field public static final int TYPE_AUTHENTICATION_SELECTED = 2; // 0x2
    field public static final int TYPE_DATASET_AUTHENTICATION_SELECTED = 1; // 0x1
    field public static final int TYPE_DATASET_SELECTED = 0; // 0x0
    field public static final int TYPE_SAVE_SHOWN = 3; // 0x3
  }
  public final class FillRequest implements android.os.Parcelable {
    method public int describeContents();
    method public android.os.Bundle getClientState();
+18 −0
Original line number Diff line number Diff line
@@ -285,4 +285,22 @@ public abstract class AutofillService extends Service {
        // TODO(b/33197203): Remove when GCore has migrated off this API
        getSystemService(AutofillManager.class).disableOwnedAutofillServices();
    }

    /**
     * Returns the {@link FillEventHistory.Event events} since the last {@link FillResponse} was
     * returned.
     *
     * <p>The history is not persisted over reboots.
     *
     * @return The history or {@code null} if there are not events.
     */
    @Nullable public final FillEventHistory getFillEventHistory() {
        AutofillManager afm = getSystemService(AutofillManager.class);

        if (afm == null) {
            return null;
        } else {
            return afm.getFillEventHistory();
        }
    }
}
+37 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.IntentSender;
import android.os.Parcel;
import android.os.Parcelable;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillValue;
import android.widget.RemoteViews;
import com.android.internal.util.Preconditions;
@@ -50,6 +51,7 @@ public final class Dataset implements Parcelable {
    private final ArrayList<RemoteViews> mFieldPresentations;
    private final RemoteViews mPresentation;
    private final IntentSender mAuthentication;
    @Nullable String mId;

    private Dataset(Builder builder) {
        mFieldIds = builder.mFieldIds;
@@ -57,6 +59,7 @@ public final class Dataset implements Parcelable {
        mFieldPresentations = builder.mFieldPresentations;
        mPresentation = builder.mPresentation;
        mAuthentication = builder.mAuthentication;
        mId = builder.mId;
    }

    /** @hide */
@@ -89,7 +92,7 @@ public final class Dataset implements Parcelable {
    public String toString() {
        if (!DEBUG) return super.toString();

        return new StringBuilder("Dataset [")
        return new StringBuilder("Dataset " + mId + " [")
                .append("fieldIds=").append(mFieldIds)
                .append(", fieldValues=").append(mFieldValues)
                .append(", fieldPresentations=")
@@ -99,6 +102,17 @@ public final class Dataset implements Parcelable {
                .append(']').toString();
    }

    /**
     * Gets the id of this dataset.
     *
     * @return The id of this dataset or {@code null} if not set
     *
     * @hide
     */
    public String getId() {
        return mId;
    }

    /**
     * A builder for {@link Dataset} objects. You must to provide at least
     * one value for a field or set an authentication intent.
@@ -110,6 +124,7 @@ public final class Dataset implements Parcelable {
        private RemoteViews mPresentation;
        private IntentSender mAuthentication;
        private boolean mDestroyed;
        @Nullable private String mId;

        /**
         * Creates a new builder.
@@ -172,6 +187,25 @@ public final class Dataset implements Parcelable {
            return this;
        }

        /**
         * Sets the id for the dataset.
         *
         * <p>The id of the last selected dataset can be read from
         * {@link AutofillService#getFillEventHistory()}. If the id is not set it will not be clear
         * if a dataset was selected as {@link AutofillService#getFillEventHistory()} uses
         * {@code null} to indicate that no dataset was selected.
         *
         * @param id id for this dataset or {@code null} to unset.

         * @return This builder.
         */
        public @NonNull Builder setId(@Nullable String id) {
            throwIfDestroyed();

            mId = id;
            return this;
        }

        /**
         * Sets the value of a field.
         *
@@ -269,6 +303,7 @@ public final class Dataset implements Parcelable {
        parcel.writeTypedArrayList(mFieldValues, flags);
        parcel.writeParcelableList(mFieldPresentations, flags);
        parcel.writeParcelable(mAuthentication, flags);
        parcel.writeString(mId);
    }

    public static final Creator<Dataset> CREATOR = new Creator<Dataset>() {
@@ -295,6 +330,7 @@ public final class Dataset implements Parcelable {
                builder.setValueAndPresentation(id, value, fieldPresentation);
            }
            builder.setAuthentication(parcel.readParcelable(null));
            builder.setId(parcel.readString());
            return builder.build();
        }

Loading