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 Original line Diff line number Diff line
@@ -85,7 +85,7 @@ public final class CredentialManager {
        ICancellationSignal cancelRemote = null;
        ICancellationSignal cancelRemote = null;
        try {
        try {
            cancelRemote = mService.executeGetCredential(request,
            cancelRemote = mService.executeGetCredential(request,
                    new GetCredentialTransport(executor, callback));
                    new GetCredentialTransport(executor, callback), mContext.getOpPackageName());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
            e.rethrowFromSystemServer();
        }
        }
@@ -124,7 +124,8 @@ public final class CredentialManager {
        ICancellationSignal cancelRemote = null;
        ICancellationSignal cancelRemote = null;
        try {
        try {
            cancelRemote = mService.executeCreateCredential(request,
            cancelRemote = mService.executeCreateCredential(request,
                    new CreateCredentialTransport(executor, callback));
                    new CreateCredentialTransport(executor, callback),
                    mContext.getOpPackageName());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
            e.rethrowFromSystemServer();
        }
        }
+2 −2
Original line number Original line Diff line number Diff line
@@ -29,7 +29,7 @@ import android.os.ICancellationSignal;
 */
 */
interface ICredentialManager {
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 Original line Diff line number Diff line
@@ -43,10 +43,10 @@ public class ProviderData implements Parcelable {
            "android.credentials.ui.extra.PROVIDER_DATA_LIST";
            "android.credentials.ui.extra.PROVIDER_DATA_LIST";


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


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


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


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


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


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


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


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


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


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


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


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


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


        /**
        /**
+18 −0
Original line number Original line Diff line number Diff line
@@ -30,6 +30,22 @@ import java.lang.annotation.RetentionPolicy;
public class CredentialProviderException extends Exception {
public class CredentialProviderException extends Exception {
    public static final int ERROR_UNKNOWN = 0;
    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;
    private final int mErrorCode;


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