diff --git a/core/api/current.txt b/core/api/current.txt index 357778106ceb8..2f23c581c07cf 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -39520,9 +39520,9 @@ package android.service.credentials { } public final class BeginCreateCredentialRequest implements android.os.Parcelable { - ctor public BeginCreateCredentialRequest(@NonNull String, @NonNull String, @NonNull android.os.Bundle); + ctor public BeginCreateCredentialRequest(@NonNull android.service.credentials.CallingAppInfo, @NonNull String, @NonNull android.os.Bundle); method public int describeContents(); - method @NonNull public String getCallingPackage(); + method @NonNull public android.service.credentials.CallingAppInfo getCallingAppInfo(); method @NonNull public android.os.Bundle getData(); method @NonNull public String getType(); method public void writeToParcel(@NonNull android.os.Parcel, int); @@ -39554,29 +39554,29 @@ package android.service.credentials { field @NonNull public static final android.os.Parcelable.Creator CREATOR; } - public final class BeginGetCredentialsRequest implements android.os.Parcelable { + public final class BeginGetCredentialRequest implements android.os.Parcelable { method public int describeContents(); method @NonNull public java.util.List getBeginGetCredentialOptions(); - method @NonNull public String getCallingPackage(); + method @NonNull public android.service.credentials.CallingAppInfo getCallingAppInfo(); method public void writeToParcel(@NonNull android.os.Parcel, int); - field @NonNull public static final android.os.Parcelable.Creator CREATOR; + field @NonNull public static final android.os.Parcelable.Creator CREATOR; } - public static final class BeginGetCredentialsRequest.Builder { - ctor public BeginGetCredentialsRequest.Builder(@NonNull String); - method @NonNull public android.service.credentials.BeginGetCredentialsRequest.Builder addBeginGetCredentialOption(@NonNull android.service.credentials.BeginGetCredentialOption); - method @NonNull public android.service.credentials.BeginGetCredentialsRequest build(); - method @NonNull public android.service.credentials.BeginGetCredentialsRequest.Builder setBeginGetCredentialOptions(@NonNull java.util.List); + public static final class BeginGetCredentialRequest.Builder { + ctor public BeginGetCredentialRequest.Builder(@NonNull android.service.credentials.CallingAppInfo); + method @NonNull public android.service.credentials.BeginGetCredentialRequest.Builder addBeginGetCredentialOption(@NonNull android.service.credentials.BeginGetCredentialOption); + method @NonNull public android.service.credentials.BeginGetCredentialRequest build(); + method @NonNull public android.service.credentials.BeginGetCredentialRequest.Builder setBeginGetCredentialOptions(@NonNull java.util.List); } - public final class BeginGetCredentialsResponse implements android.os.Parcelable { - method @NonNull public static android.service.credentials.BeginGetCredentialsResponse createWithAuthentication(@NonNull android.service.credentials.Action); - method @NonNull public static android.service.credentials.BeginGetCredentialsResponse createWithResponseContent(@NonNull android.service.credentials.CredentialsResponseContent); + public final class BeginGetCredentialResponse implements android.os.Parcelable { + method @NonNull public static android.service.credentials.BeginGetCredentialResponse createWithAuthentication(@NonNull android.service.credentials.Action); + method @NonNull public static android.service.credentials.BeginGetCredentialResponse createWithResponseContent(@NonNull android.service.credentials.CredentialsResponseContent); method public int describeContents(); method @Nullable public android.service.credentials.Action getAuthenticationAction(); method @Nullable public android.service.credentials.CredentialsResponseContent getCredentialsResponseContent(); method public void writeToParcel(@NonNull android.os.Parcel, int); - field @NonNull public static final android.os.Parcelable.Creator CREATOR; + field @NonNull public static final android.os.Parcelable.Creator CREATOR; } public final class CallingAppInfo implements android.os.Parcelable { @@ -39589,9 +39589,9 @@ package android.service.credentials { } public final class CreateCredentialRequest implements android.os.Parcelable { - ctor public CreateCredentialRequest(@NonNull String, @NonNull String, @NonNull android.os.Bundle); + ctor public CreateCredentialRequest(@NonNull android.service.credentials.CallingAppInfo, @NonNull String, @NonNull android.os.Bundle); method public int describeContents(); - method @NonNull public String getCallingPackage(); + method @NonNull public android.service.credentials.CallingAppInfo getCallingAppInfo(); method @NonNull public android.os.Bundle getData(); method @NonNull public String getType(); method public void writeToParcel(@NonNull android.os.Parcel, int); @@ -39623,19 +39623,10 @@ package android.service.credentials { method @NonNull public android.service.credentials.CredentialEntry.Builder setAutoSelectAllowed(@NonNull boolean); } - public class CredentialProviderException extends java.lang.Exception { - ctor public CredentialProviderException(int, @NonNull String, @NonNull Throwable); - ctor public CredentialProviderException(int, @NonNull String); - ctor public CredentialProviderException(int, @NonNull Throwable); - ctor public CredentialProviderException(int); - method public int getErrorCode(); - field public static final int ERROR_UNKNOWN = 0; // 0x0 - } - public abstract class CredentialProviderService extends android.app.Service { ctor public CredentialProviderService(); - method public abstract void onBeginCreateCredential(@NonNull android.service.credentials.BeginCreateCredentialRequest, @NonNull android.os.CancellationSignal, @NonNull android.os.OutcomeReceiver); - method public abstract void onBeginGetCredentials(@NonNull android.service.credentials.BeginGetCredentialsRequest, @NonNull android.os.CancellationSignal, @NonNull android.os.OutcomeReceiver); + method public abstract void onBeginCreateCredential(@NonNull android.service.credentials.BeginCreateCredentialRequest, @NonNull android.os.CancellationSignal, @NonNull android.os.OutcomeReceiver); + method public abstract void onBeginGetCredential(@NonNull android.service.credentials.BeginGetCredentialRequest, @NonNull android.os.CancellationSignal, @NonNull android.os.OutcomeReceiver); method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent); field public static final String CAPABILITY_META_DATA_KEY = "android.credentials.capabilities"; field public static final String EXTRA_CREATE_CREDENTIAL_EXCEPTION = "android.service.credentials.extra.CREATE_CREDENTIAL_EXCEPTION"; @@ -39669,14 +39660,14 @@ package android.service.credentials { public final class GetCredentialRequest implements android.os.Parcelable { method public int describeContents(); - method @NonNull public String getCallingPackage(); + method @NonNull public android.service.credentials.CallingAppInfo getCallingAppInfo(); method @NonNull public java.util.List getGetCredentialOptions(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator CREATOR; } public static final class GetCredentialRequest.Builder { - ctor public GetCredentialRequest.Builder(@NonNull String); + ctor public GetCredentialRequest.Builder(@NonNull android.service.credentials.CallingAppInfo); method @NonNull public android.service.credentials.GetCredentialRequest.Builder addGetCredentialOption(@NonNull android.credentials.GetCredentialOption); method @NonNull public android.service.credentials.GetCredentialRequest build(); method @NonNull public android.service.credentials.GetCredentialRequest.Builder setGetCredentialOptions(@NonNull java.util.List); diff --git a/core/java/android/service/credentials/Action.java b/core/java/android/service/credentials/Action.java index 42dd528405756..878df4baf1f83 100644 --- a/core/java/android/service/credentials/Action.java +++ b/core/java/android/service/credentials/Action.java @@ -42,7 +42,7 @@ public final class Action implements Parcelable { * level authentication before displaying any content etc. * *

See details on usage of {@code Action} for various actionable entries in - * {@link BeginCreateCredentialResponse} and {@link BeginGetCredentialsResponse}. + * {@link BeginCreateCredentialResponse} and {@link BeginGetCredentialResponse}. * * @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 diff --git a/core/java/android/service/credentials/BeginCreateCredentialRequest.java b/core/java/android/service/credentials/BeginCreateCredentialRequest.java index 1918d8c88cccd..d976813de7809 100644 --- a/core/java/android/service/credentials/BeginCreateCredentialRequest.java +++ b/core/java/android/service/credentials/BeginCreateCredentialRequest.java @@ -31,28 +31,28 @@ import java.util.Objects; * See {@link BeginCreateCredentialResponse} for the counterpart response */ public final class BeginCreateCredentialRequest implements Parcelable { - private final @NonNull String mCallingPackage; + private final @NonNull CallingAppInfo mCallingAppInfo; private final @NonNull String mType; private final @NonNull Bundle mData; /** * Constructs a new instance. * - * @throws IllegalArgumentException If {@code callingPackage}, or {@code type} string is + * @throws IllegalArgumentException If {@code callingAppInfo}, or {@code type} string is * null or empty. * @throws NullPointerException If {@code data} is null. */ - public BeginCreateCredentialRequest(@NonNull String callingPackage, + public BeginCreateCredentialRequest(@NonNull CallingAppInfo callingAppInfo, @NonNull String type, @NonNull Bundle data) { - mCallingPackage = Preconditions.checkStringNotEmpty(callingPackage, - "callingPackage must not be null or empty"); + mCallingAppInfo = Objects.requireNonNull(callingAppInfo, + "callingAppInfo must not be null"); mType = Preconditions.checkStringNotEmpty(type, "type must not be null or empty"); mData = Objects.requireNonNull(data, "data must not be null"); } private BeginCreateCredentialRequest(@NonNull Parcel in) { - mCallingPackage = in.readString8(); + mCallingAppInfo = in.readTypedObject(CallingAppInfo.CREATOR); mType = in.readString8(); mData = in.readBundle(Bundle.class.getClassLoader()); } @@ -77,15 +77,15 @@ public final class BeginCreateCredentialRequest implements Parcelable { @Override public void writeToParcel(@NonNull Parcel dest, int flags) { - dest.writeString8(mCallingPackage); + dest.writeTypedObject(mCallingAppInfo, flags); dest.writeString8(mType); dest.writeBundle(mData); } - /** Returns the calling package of the calling app. */ + /** Returns the info pertaining to the calling app. */ @NonNull - public String getCallingPackage() { - return mCallingPackage; + public CallingAppInfo getCallingAppInfo() { + return mCallingAppInfo; } /** Returns the type of the credential to be created. */ diff --git a/core/java/android/service/credentials/BeginGetCredentialOption.java b/core/java/android/service/credentials/BeginGetCredentialOption.java index c82b445d19e0d..74ac6c4ab8c26 100644 --- a/core/java/android/service/credentials/BeginGetCredentialOption.java +++ b/core/java/android/service/credentials/BeginGetCredentialOption.java @@ -29,7 +29,7 @@ import com.android.internal.util.Preconditions; /** * A specific type of credential request to be sent to the provider during the query phase of * a get flow. This request contains limited parameters needed to populate a list of - * {@link CredentialEntry} on the {@link BeginGetCredentialsResponse}. + * {@link CredentialEntry} on the {@link BeginGetCredentialResponse}. */ public final class BeginGetCredentialOption implements Parcelable { @@ -56,7 +56,7 @@ public final class BeginGetCredentialOption implements Parcelable { /** * Returns the request candidate query data, denoting a set of parameters * that can be used to populate a candidate list of credentials, as - * {@link CredentialEntry} on {@link BeginGetCredentialsResponse}. This list + * {@link CredentialEntry} on {@link BeginGetCredentialResponse}. This list * of entries is then presented to the user on a selector. * *

This data does not contain any sensitive parameters, and will be sent diff --git a/core/java/android/service/credentials/BeginGetCredentialsRequest.aidl b/core/java/android/service/credentials/BeginGetCredentialRequest.aidl similarity index 50% rename from core/java/android/service/credentials/BeginGetCredentialsRequest.aidl rename to core/java/android/service/credentials/BeginGetCredentialRequest.aidl index 5e1fe8abc2aab..9fb54b0741359 100644 --- a/core/java/android/service/credentials/BeginGetCredentialsRequest.aidl +++ b/core/java/android/service/credentials/BeginGetCredentialRequest.aidl @@ -1,3 +1,3 @@ package android.service.credentials; -parcelable BeginGetCredentialsRequest; \ No newline at end of file +parcelable BeginGetCredentialRequest; \ No newline at end of file diff --git a/core/java/android/service/credentials/BeginGetCredentialsRequest.java b/core/java/android/service/credentials/BeginGetCredentialRequest.java similarity index 72% rename from core/java/android/service/credentials/BeginGetCredentialsRequest.java rename to core/java/android/service/credentials/BeginGetCredentialRequest.java index 795840b42f2a2..e375cdd56b082 100644 --- a/core/java/android/service/credentials/BeginGetCredentialsRequest.java +++ b/core/java/android/service/credentials/BeginGetCredentialRequest.java @@ -35,16 +35,16 @@ import java.util.Objects; * *

This request contains a list of {@link GetCredentialOption} that have parameters * to be used to query credentials, and return a list of {@link CredentialEntry} to be set - * on the {@link BeginGetCredentialsResponse}. This list is then shown to the user on a selector. + * on the {@link BeginGetCredentialResponse}. This list is then shown to the user on a selector. * * If a {@link PendingIntent} is set on a {@link CredentialEntry}, and the user selects that * entry, a {@link GetCredentialRequest} with all parameters needed to get the actual * {@link android.credentials.Credential} will be sent as part of the {@link Intent} fired * through the {@link PendingIntent}. */ -public final class BeginGetCredentialsRequest implements Parcelable { - /** Calling package of the app requesting for credentials. */ - @NonNull private final String mCallingPackage; +public final class BeginGetCredentialRequest implements Parcelable { + /** Info pertaining to the app requesting for credentials. */ + @NonNull private final CallingAppInfo mCallingAppInfo; /** * List of credential options. Each {@link BeginGetCredentialOption} object holds parameters to @@ -52,35 +52,36 @@ public final class BeginGetCredentialsRequest implements Parcelable { * * This request does not reveal sensitive parameters. Complete list of parameters * is retrieved through the {@link PendingIntent} set on each {@link CredentialEntry} - * on {@link CredentialsResponseContent} set on {@link BeginGetCredentialsResponse}, + * on {@link CredentialsResponseContent} set on {@link BeginGetCredentialResponse}, * when the user selects one of these entries. */ @NonNull private final List mBeginGetCredentialOptions; - private BeginGetCredentialsRequest(@NonNull String callingPackage, + private BeginGetCredentialRequest(@NonNull CallingAppInfo callingAppInfo, @NonNull List getBeginCredentialOptions) { - this.mCallingPackage = callingPackage; + this.mCallingAppInfo = callingAppInfo; this.mBeginGetCredentialOptions = getBeginCredentialOptions; } - private BeginGetCredentialsRequest(@NonNull Parcel in) { - mCallingPackage = in.readString8(); + private BeginGetCredentialRequest(@NonNull Parcel in) { + mCallingAppInfo = in.readTypedObject(CallingAppInfo.CREATOR); List getBeginCredentialOptions = new ArrayList<>(); in.readTypedList(getBeginCredentialOptions, BeginGetCredentialOption.CREATOR); mBeginGetCredentialOptions = getBeginCredentialOptions; AnnotationValidations.validate(NonNull.class, null, mBeginGetCredentialOptions); } - public static final @NonNull Creator CREATOR = - new Creator() { + @NonNull + public static final Creator CREATOR = + new Creator() { @Override - public BeginGetCredentialsRequest createFromParcel(Parcel in) { - return new BeginGetCredentialsRequest(in); + public BeginGetCredentialRequest createFromParcel(Parcel in) { + return new BeginGetCredentialRequest(in); } @Override - public BeginGetCredentialsRequest[] newArray(int size) { - return new BeginGetCredentialsRequest[size]; + public BeginGetCredentialRequest[] newArray(int size) { + return new BeginGetCredentialRequest[size]; } }; @@ -91,40 +92,40 @@ public final class BeginGetCredentialsRequest implements Parcelable { @Override public void writeToParcel(@NonNull Parcel dest, int flags) { - dest.writeString8(mCallingPackage); + dest.writeTypedObject(mCallingAppInfo, flags); dest.writeTypedList(mBeginGetCredentialOptions); } /** - * Returns the calling package of the app requesting credentials. + * Returns info pertaining to the app requesting credentials. */ - public @NonNull String getCallingPackage() { - return mCallingPackage; + public @NonNull CallingAppInfo getCallingAppInfo() { + return mCallingAppInfo; } /** * Returns the list of type specific credential options to list credentials for in - * {@link BeginGetCredentialsResponse}. + * {@link BeginGetCredentialResponse}. */ public @NonNull List getBeginGetCredentialOptions() { return mBeginGetCredentialOptions; } /** - * Builder for {@link BeginGetCredentialsRequest}. + * Builder for {@link BeginGetCredentialRequest}. */ public static final class Builder { - private String mCallingPackage; + private CallingAppInfo mCallingAppInfo; private List mBeginGetCredentialOptions = new ArrayList<>(); /** * Creates a new builder. - * @param callingPackage the calling package of the app requesting credentials + * @param callingAppInfo info pertaining to the app requesting credentials * - * @throws IllegalArgumentException If {@code callingPackage} is null or empty. + * @throws IllegalArgumentException If {@code callingAppInfo} is null or empty. */ - public Builder(@NonNull String callingPackage) { - mCallingPackage = Preconditions.checkStringNotEmpty(callingPackage); + public Builder(@NonNull CallingAppInfo callingAppInfo) { + mCallingAppInfo = Objects.requireNonNull(callingAppInfo); } /** @@ -158,18 +159,17 @@ public final class BeginGetCredentialsRequest implements Parcelable { } /** - * Builds a new {@link BeginGetCredentialsRequest} instance. + * Builds a new {@link BeginGetCredentialRequest} instance. * * @throws NullPointerException If {@code beginGetCredentialOptions} is null. * @throws IllegalArgumentException If {@code beginGetCredentialOptions} is empty, or if - * {@code callingPackage} is null or empty. + * {@code callingAppInfo} is null or empty. */ - public @NonNull BeginGetCredentialsRequest build() { - Preconditions.checkStringNotEmpty(mCallingPackage, - "Must set the calling package"); + public @NonNull BeginGetCredentialRequest build() { + Objects.requireNonNull(mCallingAppInfo, "callingAppInfo"); Preconditions.checkCollectionNotEmpty(mBeginGetCredentialOptions, "beginGetCredentialOptions"); - return new BeginGetCredentialsRequest(mCallingPackage, mBeginGetCredentialOptions); + return new BeginGetCredentialRequest(mCallingAppInfo, mBeginGetCredentialOptions); } } } diff --git a/core/java/android/service/credentials/BeginGetCredentialResponse.aidl b/core/java/android/service/credentials/BeginGetCredentialResponse.aidl new file mode 100644 index 0000000000000..d73a747db38af --- /dev/null +++ b/core/java/android/service/credentials/BeginGetCredentialResponse.aidl @@ -0,0 +1,3 @@ +package android.service.credentials; + +parcelable BeginGetCredentialResponse; \ No newline at end of file diff --git a/core/java/android/service/credentials/BeginGetCredentialsResponse.java b/core/java/android/service/credentials/BeginGetCredentialResponse.java similarity index 79% rename from core/java/android/service/credentials/BeginGetCredentialsResponse.java rename to core/java/android/service/credentials/BeginGetCredentialResponse.java index 2cda56067ba8c..85e8d85036fd8 100644 --- a/core/java/android/service/credentials/BeginGetCredentialsResponse.java +++ b/core/java/android/service/credentials/BeginGetCredentialResponse.java @@ -27,7 +27,7 @@ import java.util.Objects; * Response from a credential provider, containing credential entries and other associated * data to be shown on the account selector UI. */ -public final class BeginGetCredentialsResponse implements Parcelable { +public final class BeginGetCredentialResponse implements Parcelable { /** Content to be used for the UI. */ private final @Nullable CredentialsResponseContent mCredentialsResponseContent; @@ -38,7 +38,7 @@ public final class BeginGetCredentialsResponse implements Parcelable { private final @Nullable Action mAuthenticationAction; /** - * Creates a {@link BeginGetCredentialsResponse} instance with an authentication + * Creates a {@link BeginGetCredentialResponse} instance with an authentication * {@link Action} set. Providers must use this method when no content can be shown * before authentication. * @@ -55,49 +55,49 @@ public final class BeginGetCredentialsResponse implements Parcelable { * * @throws NullPointerException If {@code authenticationAction} is null. */ - public static @NonNull BeginGetCredentialsResponse createWithAuthentication( + public static @NonNull BeginGetCredentialResponse createWithAuthentication( @NonNull Action authenticationAction) { Objects.requireNonNull(authenticationAction, "authenticationAction must not be null"); - return new BeginGetCredentialsResponse(null, authenticationAction); + return new BeginGetCredentialResponse(null, authenticationAction); } /** - * Creates a {@link BeginGetCredentialsRequest} instance with content to be shown on the UI. + * Creates a {@link BeginGetCredentialRequest} instance with content to be shown on the UI. * Providers must use this method when there is content to be shown without top level * authentication required, including credential entries, action entries or a remote entry, * * @throws NullPointerException If {@code credentialsResponseContent} is null. */ - public static @NonNull BeginGetCredentialsResponse createWithResponseContent( + public static @NonNull BeginGetCredentialResponse createWithResponseContent( @NonNull CredentialsResponseContent credentialsResponseContent) { Objects.requireNonNull(credentialsResponseContent, "credentialsResponseContent must not be null"); - return new BeginGetCredentialsResponse(credentialsResponseContent, null); + return new BeginGetCredentialResponse(credentialsResponseContent, null); } - private BeginGetCredentialsResponse(@Nullable CredentialsResponseContent + private BeginGetCredentialResponse(@Nullable CredentialsResponseContent credentialsResponseContent, @Nullable Action authenticationAction) { mCredentialsResponseContent = credentialsResponseContent; mAuthenticationAction = authenticationAction; } - private BeginGetCredentialsResponse(@NonNull Parcel in) { + private BeginGetCredentialResponse(@NonNull Parcel in) { mCredentialsResponseContent = in.readTypedObject(CredentialsResponseContent.CREATOR); mAuthenticationAction = in.readTypedObject(Action.CREATOR); } - public static final @NonNull Creator CREATOR = - new Creator() { + public static final @NonNull Creator CREATOR = + new Creator() { @Override - public BeginGetCredentialsResponse createFromParcel(Parcel in) { - return new BeginGetCredentialsResponse(in); + public BeginGetCredentialResponse createFromParcel(Parcel in) { + return new BeginGetCredentialResponse(in); } @Override - public BeginGetCredentialsResponse[] newArray(int size) { - return new BeginGetCredentialsResponse[size]; + public BeginGetCredentialResponse[] newArray(int size) { + return new BeginGetCredentialResponse[size]; } }; diff --git a/core/java/android/service/credentials/BeginGetCredentialsResponse.aidl b/core/java/android/service/credentials/BeginGetCredentialsResponse.aidl deleted file mode 100644 index ca69bcaa866bb..0000000000000 --- a/core/java/android/service/credentials/BeginGetCredentialsResponse.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package android.service.credentials; - -parcelable BeginGetCredentialsResponse; \ No newline at end of file diff --git a/core/java/android/service/credentials/CallingAppInfo.java b/core/java/android/service/credentials/CallingAppInfo.java index 1914a247548b8..6116726959ba0 100644 --- a/core/java/android/service/credentials/CallingAppInfo.java +++ b/core/java/android/service/credentials/CallingAppInfo.java @@ -22,7 +22,6 @@ import android.os.Parcel; import android.os.Parcelable; import android.util.ArraySet; -import com.android.internal.util.AnnotationValidations; import com.android.internal.util.Preconditions; import java.util.Objects; diff --git a/core/java/android/service/credentials/CreateCredentialRequest.java b/core/java/android/service/credentials/CreateCredentialRequest.java index aee85abcc8b80..603f95ce3b669 100644 --- a/core/java/android/service/credentials/CreateCredentialRequest.java +++ b/core/java/android/service/credentials/CreateCredentialRequest.java @@ -29,28 +29,28 @@ import java.util.Objects; * Request for creating a credential. */ public final class CreateCredentialRequest implements Parcelable { - private final @NonNull String mCallingPackage; + private final @NonNull CallingAppInfo mCallingAppInfo; private final @NonNull String mType; private final @NonNull Bundle mData; /** * Constructs a new instance. * - * @throws IllegalArgumentException If {@code callingPackage}, or {@code type} string is + * @throws IllegalArgumentException If {@code callingAppInfo}, or {@code type} string is * null or empty. * @throws NullPointerException If {@code data} is null. */ - public CreateCredentialRequest(@NonNull String callingPackage, + public CreateCredentialRequest(@NonNull CallingAppInfo callingAppInfo, @NonNull String type, @NonNull Bundle data) { - mCallingPackage = Preconditions.checkStringNotEmpty(callingPackage, - "callingPackage must not be null or empty"); + mCallingAppInfo = Objects.requireNonNull(callingAppInfo, + "callingAppInfo must not be null"); mType = Preconditions.checkStringNotEmpty(type, "type must not be null or empty"); mData = Objects.requireNonNull(data, "data must not be null"); } private CreateCredentialRequest(@NonNull Parcel in) { - mCallingPackage = in.readString8(); + mCallingAppInfo = in.readTypedObject(CallingAppInfo.CREATOR); mType = in.readString8(); mData = in.readTypedObject(Bundle.CREATOR); } @@ -75,15 +75,15 @@ public final class CreateCredentialRequest implements Parcelable { @Override public void writeToParcel(@NonNull Parcel dest, int flags) { - dest.writeString8(mCallingPackage); + dest.writeTypedObject(mCallingAppInfo, flags); dest.writeString8(mType); dest.writeTypedObject(mData, flags); } - /** Returns the calling package of the calling app. */ + /** Returns info pertaining to the calling app. */ @NonNull - public String getCallingPackage() { - return mCallingPackage; + public CallingAppInfo getCallingAppInfo() { + return mCallingAppInfo; } /** Returns the type of the credential to be created. */ diff --git a/core/java/android/service/credentials/CredentialProviderException.java b/core/java/android/service/credentials/CredentialProviderException.java index 02b74430493cd..969bcb57ff906 100644 --- a/core/java/android/service/credentials/CredentialProviderException.java +++ b/core/java/android/service/credentials/CredentialProviderException.java @@ -24,6 +24,8 @@ import java.lang.annotation.RetentionPolicy; /** * Contains custom exceptions to be used by credential providers on failure. + * + * @hide */ public class CredentialProviderException extends Exception { public static final int ERROR_UNKNOWN = 0; @@ -44,6 +46,14 @@ public class CredentialProviderException extends Exception { */ public static final int ERROR_TASK_CANCELED = 2; + /** + * For internal use only. + * Error code to be used when the provider encounters a failure while processing the request. + * + * @hide + */ + public static final int ERROR_PROVIDER_FAILURE = 3; + private final int mErrorCode; /** diff --git a/core/java/android/service/credentials/CredentialProviderService.java b/core/java/android/service/credentials/CredentialProviderService.java index 416ddf1726165..7735e4cdb394e 100644 --- a/core/java/android/service/credentials/CredentialProviderService.java +++ b/core/java/android/service/credentials/CredentialProviderService.java @@ -24,6 +24,8 @@ import android.annotation.SdkConstant; import android.app.PendingIntent; import android.app.Service; import android.content.Intent; +import android.credentials.CreateCredentialException; +import android.credentials.GetCredentialException; import android.os.CancellationSignal; import android.os.Handler; import android.os.IBinder; @@ -54,7 +56,7 @@ public abstract class CredentialProviderService extends Service { /** * Intent extra: The {@link GetCredentialRequest} attached with * the {@code pendingIntent} that is invoked when the user selects a {@link CredentialEntry} - * returned as part of the {@link BeginGetCredentialsResponse} + * returned as part of the {@link BeginGetCredentialResponse} * *

* Type: {@link GetCredentialRequest} @@ -87,7 +89,7 @@ public abstract class CredentialProviderService extends Service { /** * Intent extra: The result of an authentication flow, to be set on finish of the * {@link android.app.Activity} invoked through the {@link android.app.PendingIntent} set on - * a {@link BeginGetCredentialsResponse}. This result should contain the actual content, + * a {@link BeginGetCredentialResponse}. This result should contain the actual content, * including credential entries and action entries, to be shown on the selector. * *

@@ -154,22 +156,21 @@ public abstract class CredentialProviderService extends Service { } private final ICredentialProviderService mInterface = new ICredentialProviderService.Stub() { - @Override - public ICancellationSignal onBeginGetCredentials(BeginGetCredentialsRequest request, - IBeginGetCredentialsCallback callback) { + public ICancellationSignal onBeginGetCredential(BeginGetCredentialRequest request, + IBeginGetCredentialCallback callback) { Objects.requireNonNull(request); Objects.requireNonNull(callback); ICancellationSignal transport = CancellationSignal.createTransport(); mHandler.sendMessage(obtainMessage( - CredentialProviderService::onBeginGetCredentials, + CredentialProviderService::onBeginGetCredential, CredentialProviderService.this, request, CancellationSignal.fromTransport(transport), - new OutcomeReceiver() { + new OutcomeReceiver() { @Override - public void onResult(BeginGetCredentialsResponse result) { + public void onResult(BeginGetCredentialResponse result) { try { callback.onSuccess(result); } catch (RemoteException e) { @@ -177,9 +178,9 @@ public abstract class CredentialProviderService extends Service { } } @Override - public void onError(CredentialProviderException e) { + public void onError(GetCredentialException e) { try { - callback.onFailure(e.getErrorCode(), e.getMessage()); + callback.onFailure(e.errorType, e.getMessage()); } catch (RemoteException ex) { ex.rethrowFromSystemServer(); } @@ -202,7 +203,7 @@ public abstract class CredentialProviderService extends Service { CredentialProviderService.this, request, CancellationSignal.fromTransport(transport), new OutcomeReceiver< - BeginCreateCredentialResponse, CredentialProviderException>() { + BeginCreateCredentialResponse, CreateCredentialException>() { @Override public void onResult(BeginCreateCredentialResponse result) { try { @@ -212,9 +213,9 @@ public abstract class CredentialProviderService extends Service { } } @Override - public void onError(CredentialProviderException e) { + public void onError(CreateCredentialException e) { try { - callback.onFailure(e.getErrorCode(), e.getMessage()); + callback.onFailure(e.errorType, e.getMessage()); } catch (RemoteException ex) { ex.rethrowFromSystemServer(); } @@ -229,13 +230,11 @@ public abstract class CredentialProviderService extends Service { * Called by the android system to retrieve user credentials from the connected provider * service. * - * - * *

This API denotes a query stage request for getting user's credentials from a given * credential provider. The request contains a list of * {@link android.credentials.GetCredentialOption} that have parameters to be used for * populating candidate credentials, as a list of {@link CredentialEntry} to be set - * on the {@link BeginGetCredentialsResponse}. This list is then shown to the user on a + * on the {@link BeginGetCredentialResponse}. This list is then shown to the user on a * selector. * *

If a {@link PendingIntent} is set on a {@link CredentialEntry}, and the user selects that @@ -247,10 +246,10 @@ public abstract class CredentialProviderService extends Service { * the android system * @param callback object used to relay the response of the credentials request */ - public abstract void onBeginGetCredentials(@NonNull BeginGetCredentialsRequest request, + public abstract void onBeginGetCredential(@NonNull BeginGetCredentialRequest request, @NonNull CancellationSignal cancellationSignal, @NonNull OutcomeReceiver< - BeginGetCredentialsResponse, CredentialProviderException> callback); + BeginGetCredentialResponse, GetCredentialException> callback); /** * Called by the android system to create a credential. @@ -262,5 +261,5 @@ public abstract class CredentialProviderService extends Service { public abstract void onBeginCreateCredential(@NonNull BeginCreateCredentialRequest request, @NonNull CancellationSignal cancellationSignal, @NonNull OutcomeReceiver callback); + CreateCredentialException> callback); } diff --git a/core/java/android/service/credentials/CredentialsResponseContent.java b/core/java/android/service/credentials/CredentialsResponseContent.java index c2f28cb1204c7..ce6972df88e1f 100644 --- a/core/java/android/service/credentials/CredentialsResponseContent.java +++ b/core/java/android/service/credentials/CredentialsResponseContent.java @@ -29,7 +29,7 @@ import java.util.Objects; /** * The content to be displayed on the account selector UI, including credential entries, - * actions etc. Returned as part of {@link BeginGetCredentialsResponse} + * actions etc. Returned as part of {@link BeginGetCredentialResponse} */ public final class CredentialsResponseContent implements Parcelable { /** List of credential entries to be displayed on the UI. */ diff --git a/core/java/android/service/credentials/GetCredentialRequest.java b/core/java/android/service/credentials/GetCredentialRequest.java index 1d6c83be0db13..5532b55d09ad2 100644 --- a/core/java/android/service/credentials/GetCredentialRequest.java +++ b/core/java/android/service/credentials/GetCredentialRequest.java @@ -33,7 +33,7 @@ import java.util.Objects; */ public final class GetCredentialRequest implements Parcelable { /** Calling package of the app requesting for credentials. */ - private final @NonNull String mCallingPackage; + private final @NonNull CallingAppInfo mCallingAppInfo; /** * List of credential options. Each {@link GetCredentialOption} object holds parameters to @@ -41,14 +41,14 @@ public final class GetCredentialRequest implements Parcelable { */ private final @NonNull List mGetCredentialOptions; - private GetCredentialRequest(@NonNull String callingPackage, + private GetCredentialRequest(@NonNull CallingAppInfo callingAppInfo, @NonNull List getCredentialOptions) { - this.mCallingPackage = callingPackage; + this.mCallingAppInfo = callingAppInfo; this.mGetCredentialOptions = getCredentialOptions; } private GetCredentialRequest(@NonNull Parcel in) { - mCallingPackage = in.readString8(); + mCallingAppInfo = in.readTypedObject(CallingAppInfo.CREATOR); List getCredentialOptions = new ArrayList<>(); in.readTypedList(getCredentialOptions, GetCredentialOption.CREATOR); mGetCredentialOptions = getCredentialOptions; @@ -75,15 +75,15 @@ public final class GetCredentialRequest implements Parcelable { @Override public void writeToParcel(@NonNull Parcel dest, int flags) { - dest.writeString8(mCallingPackage); + dest.writeTypedObject(mCallingAppInfo, flags); dest.writeTypedList(mGetCredentialOptions); } /** - * Returns the calling package of the app requesting credentials. + * Returns info pertaining to the app requesting credentials. */ - public @NonNull String getCallingPackage() { - return mCallingPackage; + public @NonNull CallingAppInfo getCallingAppInfo() { + return mCallingAppInfo; } /** @@ -97,17 +97,17 @@ public final class GetCredentialRequest implements Parcelable { * Builder for {@link GetCredentialRequest}. */ public static final class Builder { - private String mCallingPackage; + private CallingAppInfo mCallingAppInfo; private List mGetCredentialOptions = new ArrayList<>(); /** * Creates a new builder. - * @param callingPackage the calling package of the app requesting credentials + * @param callingAppInfo info pertaining to the app requesting credentials * * @throws IllegalArgumentException If {@code callingPackag}e is null or empty. */ - public Builder(@NonNull String callingPackage) { - mCallingPackage = Preconditions.checkStringNotEmpty(callingPackage); + public Builder(@NonNull CallingAppInfo callingAppInfo) { + mCallingAppInfo = Objects.requireNonNull(callingAppInfo); } /** @@ -145,14 +145,14 @@ public final class GetCredentialRequest implements Parcelable { * * @throws NullPointerException If {@code getCredentialOptions} is null. * @throws IllegalArgumentException If {@code getCredentialOptions} is empty, or if - * {@code callingPackage} is null or empty. + * {@code callingAppInfo} is null or empty. */ public @NonNull GetCredentialRequest build() { - Preconditions.checkStringNotEmpty(mCallingPackage, - "Must set the calling package"); + Objects.requireNonNull(mCallingAppInfo, + "mCallingAppInfo"); Preconditions.checkCollectionNotEmpty(mGetCredentialOptions, "getCredentialOptions"); - return new GetCredentialRequest(mCallingPackage, mGetCredentialOptions); + return new GetCredentialRequest(mCallingAppInfo, mGetCredentialOptions); } } } diff --git a/core/java/android/service/credentials/IBeginCreateCredentialCallback.aidl b/core/java/android/service/credentials/IBeginCreateCredentialCallback.aidl index ec0bc364a4577..ab855ef0b13fe 100644 --- a/core/java/android/service/credentials/IBeginCreateCredentialCallback.aidl +++ b/core/java/android/service/credentials/IBeginCreateCredentialCallback.aidl @@ -9,5 +9,5 @@ import android.service.credentials.BeginCreateCredentialResponse; */ oneway interface IBeginCreateCredentialCallback { void onSuccess(in BeginCreateCredentialResponse request); - void onFailure(int errorCode, in CharSequence message); + void onFailure(String errorType, in CharSequence message); } \ No newline at end of file diff --git a/core/java/android/service/credentials/IBeginGetCredentialCallback.aidl b/core/java/android/service/credentials/IBeginGetCredentialCallback.aidl new file mode 100644 index 0000000000000..73e98707d15e7 --- /dev/null +++ b/core/java/android/service/credentials/IBeginGetCredentialCallback.aidl @@ -0,0 +1,13 @@ +package android.service.credentials; + +import android.service.credentials.BeginGetCredentialResponse; + +/** + * Interface from the system to a credential provider service. + * + * @hide + */ +oneway interface IBeginGetCredentialCallback { + void onSuccess(in BeginGetCredentialResponse response); + void onFailure(String errorType, in CharSequence message); +} \ No newline at end of file diff --git a/core/java/android/service/credentials/IBeginGetCredentialsCallback.aidl b/core/java/android/service/credentials/IBeginGetCredentialsCallback.aidl deleted file mode 100644 index 9ac28f26059bf..0000000000000 --- a/core/java/android/service/credentials/IBeginGetCredentialsCallback.aidl +++ /dev/null @@ -1,13 +0,0 @@ -package android.service.credentials; - -import android.service.credentials.BeginGetCredentialsResponse; - -/** - * Interface from the system to a credential provider service. - * - * @hide - */ -oneway interface IBeginGetCredentialsCallback { - void onSuccess(in BeginGetCredentialsResponse response); - void onFailure(int errorCode, in CharSequence message); -} \ No newline at end of file diff --git a/core/java/android/service/credentials/ICredentialProviderService.aidl b/core/java/android/service/credentials/ICredentialProviderService.aidl index 1306882917958..24d253fa61efb 100644 --- a/core/java/android/service/credentials/ICredentialProviderService.aidl +++ b/core/java/android/service/credentials/ICredentialProviderService.aidl @@ -17,9 +17,9 @@ package android.service.credentials; import android.os.ICancellationSignal; -import android.service.credentials.BeginGetCredentialsRequest; +import android.service.credentials.BeginGetCredentialRequest; import android.service.credentials.BeginCreateCredentialRequest; -import android.service.credentials.IBeginGetCredentialsCallback; +import android.service.credentials.IBeginGetCredentialCallback; import android.service.credentials.IBeginCreateCredentialCallback; import android.os.ICancellationSignal; @@ -29,6 +29,6 @@ import android.os.ICancellationSignal; * @hide */ interface ICredentialProviderService { - ICancellationSignal onBeginGetCredentials(in BeginGetCredentialsRequest request, in IBeginGetCredentialsCallback callback); + ICancellationSignal onBeginGetCredential(in BeginGetCredentialRequest request, in IBeginGetCredentialCallback callback); ICancellationSignal onBeginCreateCredential(in BeginCreateCredentialRequest request, in IBeginCreateCredentialCallback callback); } diff --git a/packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt b/packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt index d2b29245517ee..37453c9bc8d49 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt @@ -22,6 +22,7 @@ import android.app.slice.Slice import android.app.slice.SliceSpec import android.content.Context import android.content.Intent +import android.content.pm.Signature import android.credentials.CreateCredentialRequest import android.credentials.GetCredentialOption import android.credentials.GetCredentialRequest @@ -40,6 +41,7 @@ import android.os.Binder import android.os.Bundle import android.os.ResultReceiver import android.service.credentials.CredentialProviderService +import android.util.ArraySet import com.android.credentialmanager.createflow.CreateCredentialUiState import com.android.credentialmanager.getflow.GetCredentialUiState import com.android.credentialmanager.jetpack.developer.CreatePasswordRequest.Companion.toBundle @@ -351,7 +353,8 @@ class CredentialManagerRepo( intent, (PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_ONE_SHOT)) val createPasswordRequest = android.service.credentials.CreateCredentialRequest( - context.applicationInfo.packageName, + android.service.credentials.CallingAppInfo( + context.applicationInfo.packageName, ArraySet()), TYPE_PASSWORD_CREDENTIAL, toBundle("beckett-bakert@gmail.com", "password123") ) diff --git a/services/credentials/java/com/android/server/credentials/CredentialManagerService.java b/services/credentials/java/com/android/server/credentials/CredentialManagerService.java index a92e4a18d6093..b4d7632371e7e 100644 --- a/services/credentials/java/com/android/server/credentials/CredentialManagerService.java +++ b/services/credentials/java/com/android/server/credentials/CredentialManagerService.java @@ -32,8 +32,8 @@ import android.credentials.ICreateCredentialCallback; import android.credentials.ICredentialManager; import android.credentials.IGetCredentialCallback; import android.credentials.IListEnabledProvidersCallback; -import android.credentials.ListEnabledProvidersResponse; import android.credentials.ISetEnabledProvidersCallback; +import android.credentials.ListEnabledProvidersResponse; import android.os.Binder; import android.os.CancellationSignal; import android.os.ICancellationSignal; @@ -41,7 +41,7 @@ import android.os.RemoteException; import android.os.UserHandle; import android.provider.Settings; import android.service.credentials.BeginCreateCredentialRequest; -import android.service.credentials.BeginGetCredentialsRequest; +import android.service.credentials.BeginGetCredentialRequest; import android.text.TextUtils; import android.util.Log; import android.util.Slog; @@ -183,15 +183,11 @@ public final class CredentialManagerService // TODO : Return error when no providers available // Iterate over all provider sessions and invoke the request - providerSessions.forEach( - providerGetSession -> { - providerGetSession - .getRemoteCredentialService() - .onBeginGetCredentials( - (BeginGetCredentialsRequest) - providerGetSession.getProviderRequest(), - /* callback= */ providerGetSession); - }); + providerSessions.forEach(providerGetSession -> { + providerGetSession.getRemoteCredentialService().onBeginGetCredential( + (BeginGetCredentialRequest) providerGetSession.getProviderRequest(), + /*callback=*/providerGetSession); + }); return cancelTransport; } diff --git a/services/credentials/java/com/android/server/credentials/ProviderCreateSession.java b/services/credentials/java/com/android/server/credentials/ProviderCreateSession.java index 8854453a61cd5..32e85b099c227 100644 --- a/services/credentials/java/com/android/server/credentials/ProviderCreateSession.java +++ b/services/credentials/java/com/android/server/credentials/ProviderCreateSession.java @@ -22,15 +22,18 @@ import android.annotation.UserIdInt; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; +import android.content.pm.Signature; import android.credentials.ui.CreateCredentialProviderData; import android.credentials.ui.Entry; import android.credentials.ui.ProviderPendingIntentResponse; import android.service.credentials.BeginCreateCredentialRequest; import android.service.credentials.BeginCreateCredentialResponse; +import android.service.credentials.CallingAppInfo; import android.service.credentials.CreateCredentialRequest; import android.service.credentials.CreateEntry; import android.service.credentials.CredentialProviderInfo; import android.service.credentials.CredentialProviderService; +import android.util.ArraySet; import android.util.Log; import android.util.Slog; @@ -65,11 +68,12 @@ public final class ProviderCreateSession extends ProviderSession< CreateCredentialRequest providerCreateRequest = createProviderRequest(providerInfo.getCapabilities(), createRequestSession.mClientRequest, - createRequestSession.mClientCallingPackage); + new CallingAppInfo(createRequestSession.mClientCallingPackage, + new ArraySet())); if (providerCreateRequest != null) { BeginCreateCredentialRequest providerBeginCreateRequest = new BeginCreateCredentialRequest( - providerCreateRequest.getCallingPackage(), + providerCreateRequest.getCallingAppInfo(), providerCreateRequest.getType(), createRequestSession.mClientRequest.getCandidateQueryData()); return new ProviderCreateSession(context, providerInfo, createRequestSession, userId, @@ -82,10 +86,10 @@ public final class ProviderCreateSession extends ProviderSession< @Nullable private static CreateCredentialRequest createProviderRequest(List providerCapabilities, android.credentials.CreateCredentialRequest clientRequest, - String clientCallingPackage) { + CallingAppInfo callingAppInfo) { String capability = clientRequest.getType(); if (providerCapabilities.contains(capability)) { - return new CreateCredentialRequest(clientCallingPackage, capability, + return new CreateCredentialRequest(callingAppInfo, capability, clientRequest.getCredentialData()); } Log.i(TAG, "Unable to create provider request - capabilities do not match"); @@ -120,7 +124,8 @@ public final class ProviderCreateSession extends ProviderSession< /** Called when the provider response resulted in a failure. */ @Override - public void onProviderResponseFailure(int errorCode, @Nullable CharSequence message) { + public void onProviderResponseFailure(int errorCode, @Nullable String errorType, + @Nullable CharSequence message) { updateStatusAndInvokeCallback(toStatus(errorCode)); } diff --git a/services/credentials/java/com/android/server/credentials/ProviderGetSession.java b/services/credentials/java/com/android/server/credentials/ProviderGetSession.java index 9888cc0a3732c..218fc21e73e3a 100644 --- a/services/credentials/java/com/android/server/credentials/ProviderGetSession.java +++ b/services/credentials/java/com/android/server/credentials/ProviderGetSession.java @@ -22,6 +22,7 @@ import android.annotation.UserIdInt; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; +import android.content.pm.Signature; import android.credentials.GetCredentialOption; import android.credentials.GetCredentialResponse; import android.credentials.ui.Entry; @@ -29,13 +30,15 @@ import android.credentials.ui.GetCredentialProviderData; import android.credentials.ui.ProviderPendingIntentResponse; import android.service.credentials.Action; import android.service.credentials.BeginGetCredentialOption; -import android.service.credentials.BeginGetCredentialsRequest; -import android.service.credentials.BeginGetCredentialsResponse; +import android.service.credentials.BeginGetCredentialRequest; +import android.service.credentials.BeginGetCredentialResponse; +import android.service.credentials.CallingAppInfo; import android.service.credentials.CredentialEntry; import android.service.credentials.CredentialProviderInfo; import android.service.credentials.CredentialProviderService; import android.service.credentials.CredentialsResponseContent; import android.service.credentials.GetCredentialRequest; +import android.util.ArraySet; import android.util.Log; import android.util.Pair; import android.util.Slog; @@ -53,10 +56,10 @@ import java.util.stream.Collectors; * * @hide */ -public final class ProviderGetSession extends ProviderSession +public final class ProviderGetSession extends ProviderSession implements - RemoteCredentialService.ProviderCallbacks { + RemoteCredentialService.ProviderCallbacks { private static final String TAG = "ProviderGetSession"; // Key to be used as an entry key for a credential entry @@ -90,9 +93,9 @@ public final class ProviderGetSession extends ProviderSession { @@ -104,7 +107,7 @@ public final class ProviderGetSession extends ProviderSession())).setGetCredentialOptions( filteredOptions).build(); } Log.i(TAG, "In createProviderRequest - returning null"); @@ -137,7 +142,7 @@ public final class ProviderGetSession extends ProviderSession callback) { + public void onBeginGetCredential(@NonNull BeginGetCredentialRequest request, + ProviderCallbacks callback) { Log.i(TAG, "In onGetCredentials in RemoteCredentialService"); AtomicReference cancellationSink = new AtomicReference<>(); - AtomicReference> futureRef = + AtomicReference> futureRef = new AtomicReference<>(); - CompletableFuture connectThenExecute = postAsync(service -> { - CompletableFuture getCredentials = + CompletableFuture connectThenExecute = postAsync(service -> { + CompletableFuture getCredentials = new CompletableFuture<>(); ICancellationSignal cancellationSignal = - service.onBeginGetCredentials(request, - new IBeginGetCredentialsCallback.Stub() { + service.onBeginGetCredential(request, + new IBeginGetCredentialCallback.Stub() { @Override - public void onSuccess(BeginGetCredentialsResponse response) { + public void onSuccess(BeginGetCredentialResponse response) { Log.i(TAG, "In onSuccess in RemoteCredentialService"); getCredentials.complete(response); } @Override - public void onFailure(@CredentialProviderError int errorCode, - CharSequence message) { + public void onFailure(String errorType, CharSequence message) { Log.i(TAG, "In onFailure in RemoteCredentialService"); String errorMsg = message == null ? "" : String.valueOf(message); - getCredentials.completeExceptionally(new CredentialProviderException( - errorCode, errorMsg)); + getCredentials.completeExceptionally( + new GetCredentialException(errorType, errorMsg)); } }); - CompletableFuture future = futureRef.get(); + CompletableFuture future = futureRef.get(); if (future != null && future.isCancelled()) { dispatchCancellationSignal(cancellationSignal); } else { @@ -175,12 +176,11 @@ public class RemoteCredentialService extends ServiceConnector.Impl future = futureRef.get(); if (future != null && future.isCancelled()) { @@ -209,22 +209,34 @@ public class RemoteCredentialService extends ServiceConnector.Impl