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

Commit bb8ea18d authored by TYM Tsai's avatar TYM Tsai Committed by Android (Google) Code Review
Browse files

Merge "Add API for creating AutofillId with virtual child id"

parents 0549d7d8 4a5d4e51
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -53807,6 +53807,7 @@ package android.view.animation {
package android.view.autofill {
  public final class AutofillId implements android.os.Parcelable {
    method @NonNull public static android.view.autofill.AutofillId create(@NonNull android.view.View, int);
    method public int describeContents();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.view.autofill.AutofillId> CREATOR;
+19 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.view.View;

import java.util.Objects;

/**
 * A unique identifier for an autofill node inside an {@link android.app.Activity}.
 */
@@ -76,6 +78,23 @@ public final class AutofillId implements Parcelable {
    @NonNull
    public static final AutofillId NO_AUTOFILL_ID = new AutofillId(0);

    /**
     * Creates an {@link AutofillId} with the virtual id.
     *
     * This method is used by a {@link View} that contains the virtual view hierarchy. Use this
     * method to create the {@link AutofillId} for each virtual view.
     *
     * @param host the view hosting the virtual view hierarchy which is used to show autofill
     *            suggestions.
     * @param virtualId id identifying the virtual view inside the host view.
     * @return an {@link AutofillId} for the virtual view
     */
    @NonNull
    public static AutofillId create(@NonNull View host, int virtualId) {
        Objects.requireNonNull(host);
        return new AutofillId(host.getAutofillId(), virtualId);
    }

    /** @hide */
    @NonNull
    @TestApi