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

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

Merge "Remove pending intent from framework provider APIs"

parents a9d6585f 72dd90b6
Loading
Loading
Loading
Loading
+3 −7
Original line number Original line Diff line number Diff line
@@ -39769,9 +39769,8 @@ package android.service.controls.templates {
package android.service.credentials {
package android.service.credentials {
  public class Action implements android.os.Parcelable {
  public class Action implements android.os.Parcelable {
    ctor public Action(@NonNull android.app.slice.Slice, @NonNull android.app.PendingIntent);
    ctor public Action(@NonNull android.app.slice.Slice);
    method public int describeContents();
    method public int describeContents();
    method @NonNull public android.app.PendingIntent getPendingIntent();
    method @NonNull public android.app.slice.Slice getSlice();
    method @NonNull public android.app.slice.Slice getSlice();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.service.credentials.Action> CREATOR;
    field @NonNull public static final android.os.Parcelable.Creator<android.service.credentials.Action> CREATOR;
@@ -39866,21 +39865,18 @@ package android.service.credentials {
  }
  }
  public class CreateEntry implements android.os.Parcelable {
  public class CreateEntry implements android.os.Parcelable {
    ctor public CreateEntry(@NonNull android.app.slice.Slice, @NonNull android.app.PendingIntent);
    ctor public CreateEntry(@NonNull android.app.slice.Slice);
    method public int describeContents();
    method public int describeContents();
    method @NonNull public android.app.PendingIntent getPendingIntent();
    method @NonNull public android.app.slice.Slice getSlice();
    method @NonNull public android.app.slice.Slice getSlice();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.service.credentials.CreateEntry> CREATOR;
    field @NonNull public static final android.os.Parcelable.Creator<android.service.credentials.CreateEntry> CREATOR;
  }
  }
  public class CredentialEntry implements android.os.Parcelable {
  public class CredentialEntry implements android.os.Parcelable {
    ctor public CredentialEntry(@NonNull String, @NonNull android.app.slice.Slice, @NonNull android.app.PendingIntent, boolean);
    ctor public CredentialEntry(@NonNull String, @NonNull android.app.slice.Slice);
    method public int describeContents();
    method public int describeContents();
    method @NonNull public android.app.PendingIntent getPendingIntent();
    method @NonNull public android.app.slice.Slice getSlice();
    method @NonNull public android.app.slice.Slice getSlice();
    method @NonNull public String getType();
    method @NonNull public String getType();
    method public boolean isAutoSelectAllowed();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.service.credentials.CredentialEntry> CREATOR;
    field @NonNull public static final android.os.Parcelable.Creator<android.service.credentials.CredentialEntry> CREATOR;
  }
  }
+2 −1
Original line number Original line Diff line number Diff line
@@ -997,7 +997,8 @@ package android.credentials.ui {


  public final class Entry implements android.os.Parcelable {
  public final class Entry implements android.os.Parcelable {
    ctor public Entry(@NonNull String, @NonNull String, @NonNull android.app.slice.Slice);
    ctor public Entry(@NonNull String, @NonNull String, @NonNull android.app.slice.Slice);
    ctor public Entry(@NonNull String, @NonNull String, @NonNull android.app.slice.Slice, @NonNull android.app.PendingIntent, @Nullable android.content.Intent);
    ctor public Entry(@NonNull String, @NonNull String, @NonNull android.app.slice.Slice, @NonNull android.app.PendingIntent, @NonNull android.content.Intent);
    ctor public Entry(@NonNull String, @NonNull String, @NonNull android.app.slice.Slice, @NonNull android.content.Intent);
    method public int describeContents();
    method public int describeContents();
    method @Nullable public android.content.Intent getFrameworkExtrasIntent();
    method @Nullable public android.content.Intent getFrameworkExtrasIntent();
    method @NonNull public String getKey();
    method @NonNull public String getKey();
+10 −1
Original line number Original line Diff line number Diff line
@@ -89,12 +89,21 @@ public final class Entry implements Parcelable {
     * when clicked.
     * when clicked.
     */
     */
    public Entry(@NonNull String key, @NonNull String subkey, @NonNull Slice slice,
    public Entry(@NonNull String key, @NonNull String subkey, @NonNull Slice slice,
            @NonNull PendingIntent pendingIntent, @Nullable Intent intent) {
            @NonNull PendingIntent pendingIntent, @NonNull Intent intent) {
        this(key, subkey, slice);
        this(key, subkey, slice);
        mPendingIntent = pendingIntent;
        mPendingIntent = pendingIntent;
        mFrameworkExtrasIntent = intent;
        mFrameworkExtrasIntent = intent;
    }
    }


    /** Constructor to be used for an entry that requires a pending intent to be invoked
     * when clicked.
     */
    public Entry(@NonNull String key, @NonNull String subkey, @NonNull Slice slice,
            @NonNull Intent intent) {
        this(key, subkey, slice);
        mFrameworkExtrasIntent = intent;
    }

    /**
    /**
    * Returns the identifier of this entry that's unique within the context of the CredentialManager
    * Returns the identifier of this entry that's unique within the context of the CredentialManager
    * request.
    * request.
+10 −18
Original line number Original line Diff line number Diff line
@@ -29,6 +29,9 @@ import java.util.Objects;
 * An action defined by the provider that intents into the provider's app for specific
 * An action defined by the provider that intents into the provider's app for specific
 * user actions.
 * user actions.
 *
 *
 * <p>If user selects this action entry, the corresponding {@link PendingIntent} set on the
 * {@code slice} as a {@link androidx.slice.core.SliceAction} will get invoked.
 *
 * <p>Any class that derives this class must only add extra field values to the {@code slice}
 * <p>Any class that derives this class must only add extra field values to the {@code slice}
 * object passed into the constructor. Any other field will not be parceled through. If the
 * object passed into the constructor. Any other field will not be parceled through. If the
 * derived class has custom parceling implementation, this class will not be able to unpack
 * derived class has custom parceling implementation, this class will not be able to unpack
@@ -37,9 +40,8 @@ import java.util.Objects;
@SuppressLint("ParcelNotFinal")
@SuppressLint("ParcelNotFinal")
public class Action implements Parcelable {
public class Action implements Parcelable {
    /** Slice object containing display content to be displayed with this action on the UI. */
    /** Slice object containing display content to be displayed with this action on the UI. */
    private final @NonNull Slice mSlice;
    @NonNull
    /** The pending intent to be invoked when the user selects this action. */
    private final Slice mSlice;
    private final @NonNull PendingIntent mPendingIntent;


    /**
    /**
     * Constructs an action to be displayed on the UI.
     * Constructs an action to be displayed on the UI.
@@ -52,21 +54,18 @@ public class Action implements Parcelable {
     * {@link BeginCreateCredentialResponse} and {@link BeginGetCredentialResponse}.
     * {@link BeginCreateCredentialResponse} and {@link BeginGetCredentialResponse}.
     *
     *
     * @param slice the display content to be displayed on the UI, along with this action
     * @param slice the display content to be displayed on the UI, along with this action
     * @param pendingIntent the intent to be invoked when the user selects this action
     */
     */
    public Action(@NonNull Slice slice, @NonNull PendingIntent pendingIntent) {
    public Action(@NonNull Slice slice) {
        Objects.requireNonNull(slice, "slice must not be null");
        Objects.requireNonNull(slice, "slice must not be null");
        Objects.requireNonNull(pendingIntent, "pendingIntent must not be null");
        mSlice = slice;
        mSlice = slice;
        mPendingIntent = pendingIntent;
    }
    }


    private Action(@NonNull Parcel in) {
    private Action(@NonNull Parcel in) {
        mSlice = in.readTypedObject(Slice.CREATOR);
        mSlice = in.readTypedObject(Slice.CREATOR);
        mPendingIntent = in.readTypedObject(PendingIntent.CREATOR);
    }
    }


    public static final @NonNull Creator<Action> CREATOR = new Creator<Action>() {
    @NonNull
    public static final Creator<Action> CREATOR = new Creator<Action>() {
        @Override
        @Override
        public Action createFromParcel(@NonNull Parcel in) {
        public Action createFromParcel(@NonNull Parcel in) {
            return new Action(in);
            return new Action(in);
@@ -86,20 +85,13 @@ public class Action implements Parcelable {
    @Override
    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeTypedObject(mSlice, flags);
        dest.writeTypedObject(mSlice, flags);
        dest.writeTypedObject(mPendingIntent, flags);
    }
    }


    /**
    /**
     * Returns a {@code Slice} object containing the display content to be displayed on the UI.
     * Returns a {@code Slice} object containing the display content to be displayed on the UI.
     */
     */
    public @NonNull Slice getSlice() {
    @NonNull
    public Slice getSlice() {
        return mSlice;
        return mSlice;
    }
    }

    /**
     * Returns the {@link PendingIntent} to be invoked when the action is selected.
     */
    public @NonNull PendingIntent getPendingIntent() {
        return mPendingIntent;
    }
}
}
+12 −16
Original line number Original line Diff line number Diff line
@@ -27,6 +27,13 @@ import android.os.Parcelable;
 * An entry to be shown on the UI. This entry represents where the credential to be created will
 * An entry to be shown on the UI. This entry represents where the credential to be created will
 * be stored. Examples include user's account, family group etc.
 * be stored. Examples include user's account, family group etc.
 *
 *
 * <p>If user selects this entry, the corresponding {@link PendingIntent} set on the
 * {@code slice} as a {@link androidx.slice.core.SliceAction} will get invoked.
 * Once the resulting activity fulfills the required user engagement,
 * the {@link android.app.Activity} result should be set to {@link android.app.Activity#RESULT_OK},
 * and the {@link CredentialProviderService#EXTRA_CREATE_CREDENTIAL_RESPONSE} must be set with a
 * {@link android.credentials.CreateCredentialResponse} object.
 *
 * <p>Any class that derives this class must only add extra field values to the {@code slice}
 * <p>Any class that derives this class must only add extra field values to the {@code slice}
 * object passed into the constructor. Any other field will not be parceled through. If the
 * object passed into the constructor. Any other field will not be parceled through. If the
 * derived class has custom parceling implementation, this class will not be able to unpack
 * derived class has custom parceling implementation, this class will not be able to unpack
@@ -35,14 +42,13 @@ import android.os.Parcelable;
@SuppressLint("ParcelNotFinal")
@SuppressLint("ParcelNotFinal")
public class CreateEntry implements Parcelable {
public class CreateEntry implements Parcelable {
    private final @NonNull Slice mSlice;
    private final @NonNull Slice mSlice;
    private final @NonNull PendingIntent mPendingIntent;


    private CreateEntry(@NonNull Parcel in) {
    private CreateEntry(@NonNull Parcel in) {
        mSlice = in.readTypedObject(Slice.CREATOR);
        mSlice = in.readTypedObject(Slice.CREATOR);
        mPendingIntent = in.readTypedObject(PendingIntent.CREATOR);
    }
    }


    public static final @NonNull Creator<CreateEntry> CREATOR = new Creator<CreateEntry>() {
    @NonNull
    public static final Creator<CreateEntry> CREATOR = new Creator<CreateEntry>() {
        @Override
        @Override
        public CreateEntry createFromParcel(@NonNull Parcel in) {
        public CreateEntry createFromParcel(@NonNull Parcel in) {
            return new CreateEntry(in);
            return new CreateEntry(in);
@@ -62,33 +68,23 @@ public class CreateEntry implements Parcelable {
    @Override
    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeTypedObject(mSlice, flags);
        dest.writeTypedObject(mSlice, flags);
        dest.writeTypedObject(mPendingIntent, flags);
    }
    }


    /**
    /**
     * Constructs a CreateEntry to be displayed on the UI.
     * Constructs a CreateEntry to be displayed on the UI.
     *
     *
     * @param slice the display content to be displayed on the UI, along with this entry
     * @param slice the display content to be displayed on the UI, along with this entry
     * @param pendingIntent the intent to be invoked when the user selects this entry
     */
     */
    public CreateEntry(
    public CreateEntry(
            @NonNull Slice slice,
            @NonNull Slice slice) {
            @NonNull PendingIntent pendingIntent) {
        this.mSlice = slice;
        this.mSlice = slice;
        com.android.internal.util.AnnotationValidations.validate(
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mSlice);
                NonNull.class, null, mSlice);
        this.mPendingIntent = pendingIntent;
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mPendingIntent);
    }
    }


    /** Returns the content to be displayed with this create entry on the UI. */
    /** Returns the content to be displayed with this create entry on the UI. */
    public @NonNull Slice getSlice() {
    @NonNull
    public Slice getSlice() {
        return mSlice;
        return mSlice;
    }
    }

    /** Returns the pendingIntent to be invoked when this create entry on the UI is selectcd. */
    public @NonNull PendingIntent getPendingIntent() {
        return mPendingIntent;
    }
}
}
Loading