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

Commit 4dc3bfb1 authored by Reema Bajwa's avatar Reema Bajwa Committed by Android (Google) Code Review
Browse files

Merge "Add basic piping for providers and ux Test: Built & deployed locally Bug: 253155340"

parents 894fe927 ad3a1f54
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ public final class CredentialManager {
        ICancellationSignal cancelRemote = null;
        try {
            cancelRemote = mService.executeGetCredential(request,
                    new GetCredentialTransport(executor, callback));
                    new GetCredentialTransport(executor, callback), mContext.getOpPackageName());
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
@@ -124,7 +124,8 @@ public final class CredentialManager {
        ICancellationSignal cancelRemote = null;
        try {
            cancelRemote = mService.executeCreateCredential(request,
                    new CreateCredentialTransport(executor, callback));
                    new CreateCredentialTransport(executor, callback),
                    mContext.getOpPackageName());
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ import android.os.ICancellationSignal;
 */
interface ICredentialManager {

    @nullable ICancellationSignal executeGetCredential(in GetCredentialRequest request, in IGetCredentialCallback callback);
    @nullable ICancellationSignal executeGetCredential(in GetCredentialRequest request, in IGetCredentialCallback callback, String callingPackage);

    @nullable ICancellationSignal executeCreateCredential(in CreateCredentialRequest request, in ICreateCredentialCallback callback);
    @nullable ICancellationSignal executeCreateCredential(in CreateCredentialRequest request, in ICreateCredentialCallback callback, String callingPackage);
}
+22 −21
Original line number Diff line number Diff line
@@ -43,10 +43,10 @@ public class ProviderData implements Parcelable {
            "android.credentials.ui.extra.PROVIDER_DATA_LIST";

    @NonNull
    private final String mProviderId;
    private final String mProviderFlattenedComponentName;
    @NonNull
    private final String mProviderDisplayName;
    @NonNull
    @Nullable
    private final Icon mIcon;
    @NonNull
    private final List<Entry> mCredentialEntries;
@@ -58,11 +58,11 @@ public class ProviderData implements Parcelable {
    private final @CurrentTimeMillisLong long mLastUsedTimeMillis;

    public ProviderData(
            @NonNull String providerId, @NonNull String providerDisplayName,
            @NonNull Icon icon, @NonNull List<Entry> credentialEntries,
            @NonNull String providerFlattenedComponentName, @NonNull String providerDisplayName,
            @Nullable Icon icon, @NonNull List<Entry> credentialEntries,
            @NonNull List<Entry> actionChips, @Nullable Entry authenticationEntry,
            @CurrentTimeMillisLong long lastUsedTimeMillis) {
        mProviderId = providerId;
        mProviderFlattenedComponentName = providerFlattenedComponentName;
        mProviderDisplayName = providerDisplayName;
        mIcon = icon;
        mCredentialEntries = credentialEntries;
@@ -73,8 +73,8 @@ public class ProviderData implements Parcelable {

    /** Returns the unique provider id. */
    @NonNull
    public String getProviderId() {
        return mProviderId;
    public String getProviderFlattenedComponentName() {
        return mProviderFlattenedComponentName;
    }

    @NonNull
@@ -82,7 +82,7 @@ public class ProviderData implements Parcelable {
        return mProviderDisplayName;
    }

    @NonNull
    @Nullable
    public Icon getIcon() {
        return mIcon;
    }
@@ -108,9 +108,9 @@ public class ProviderData implements Parcelable {
    }

    protected ProviderData(@NonNull Parcel in) {
        String providerId = in.readString8();
        mProviderId = providerId;
        AnnotationValidations.validate(NonNull.class, null, mProviderId);
        String providerFlattenedComponentName = in.readString8();
        mProviderFlattenedComponentName = providerFlattenedComponentName;
        AnnotationValidations.validate(NonNull.class, null, mProviderFlattenedComponentName);

        String providerDisplayName = in.readString8();
        mProviderDisplayName = providerDisplayName;
@@ -118,7 +118,6 @@ public class ProviderData implements Parcelable {

        Icon icon = in.readTypedObject(Icon.CREATOR);
        mIcon = icon;
        AnnotationValidations.validate(NonNull.class, null, mIcon);

        List<Entry> credentialEntries = new ArrayList<>();
        in.readTypedList(credentialEntries, Entry.CREATOR);
@@ -139,7 +138,7 @@ public class ProviderData implements Parcelable {

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        dest.writeString8(mProviderId);
        dest.writeString8(mProviderFlattenedComponentName);
        dest.writeString8(mProviderDisplayName);
        dest.writeTypedObject(mIcon, flags);
        dest.writeTypedList(mCredentialEntries);
@@ -171,26 +170,27 @@ public class ProviderData implements Parcelable {
     * @hide
     */
    public static class Builder {
        private @NonNull String mProviderId;
        private @NonNull String mProviderFlattenedComponentName;
        private @NonNull String mProviderDisplayName;
        private @NonNull Icon mIcon;
        private @Nullable Icon mIcon;
        private @NonNull List<Entry> mCredentialEntries = new ArrayList<>();
        private @NonNull List<Entry> mActionChips = new ArrayList<>();
        private @Nullable Entry mAuthenticationEntry = null;
        private @CurrentTimeMillisLong long mLastUsedTimeMillis = 0L;

        /** Constructor with required properties. */
        public Builder(@NonNull String providerId, @NonNull String providerDisplayName,
                @NonNull Icon icon) {
            mProviderId = providerId;
        public Builder(@NonNull String providerFlattenedComponentName,
                @NonNull String providerDisplayName,
                @Nullable Icon icon) {
            mProviderFlattenedComponentName = providerFlattenedComponentName;
            mProviderDisplayName = providerDisplayName;
            mIcon = icon;
        }

        /** Sets the unique provider id. */
        @NonNull
        public Builder setProviderId(@NonNull String providerId) {
            mProviderId = providerId;
        public Builder setProviderFlattenedComponentName(@NonNull String providerFlattenedComponentName) {
            mProviderFlattenedComponentName = providerFlattenedComponentName;
            return this;
        }

@@ -239,7 +239,8 @@ public class ProviderData implements Parcelable {
        /** Builds a {@link ProviderData}. */
        @NonNull
        public ProviderData build() {
            return new ProviderData(mProviderId, mProviderDisplayName, mIcon, mCredentialEntries,
            return new ProviderData(mProviderFlattenedComponentName, mProviderDisplayName,
                    mIcon, mCredentialEntries,
                mActionChips, mAuthenticationEntry, mLastUsedTimeMillis);
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -140,8 +140,8 @@ public final class CredentialEntry implements Parcelable {
    public static final class Builder {
        private String mType;
        private Slice mSlice;
        private PendingIntent mPendingIntent;
        private Credential mCredential;
        private PendingIntent mPendingIntent = null;
        private Credential mCredential = null;
        private boolean mAutoSelectAllowed = false;

        /**
+18 −0
Original line number Diff line number Diff line
@@ -30,6 +30,22 @@ import java.lang.annotation.RetentionPolicy;
public class CredentialProviderException extends Exception {
    public static final int ERROR_UNKNOWN = 0;

    /**
     * For internal use only.
     * Error code to be used when the provider request times out.
     *
     * @hide
     */
    public static final int ERROR_TIMEOUT = 1;

    /**
     * For internal use only.
     * Error code to be used when the async task is canceled internally.
     *
     * @hide
     */
    public static final int ERROR_TASK_CANCELED = 2;

    private final int mErrorCode;

    /**
@@ -37,6 +53,8 @@ public class CredentialProviderException extends Exception {
     */
    @IntDef(prefix = {"ERROR_"}, value = {
            ERROR_UNKNOWN,
            ERROR_TIMEOUT,
            ERROR_TASK_CANCELED
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface CredentialProviderError { }
Loading