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

Commit 68042a43 authored by Helen Qin's avatar Helen Qin
Browse files

Add more error types for get/create/clear credential flows.

One is used for when the user intentionally cenceled a flow. Another
for when the flow was interrupted and should be retried (example: the
user navigates from the selector ui to settings to tweak enabled
providers). And a last one for unknown typed error.

Bug: 253153298
CTS-Coverage-Bug: 263109618
API-Coverage-Bug: 263109618
Test: Local Build & Deployment
Change-Id: I4960770b6f7b249d78649506c5d4fc93e52d4ece
parent e81111ff
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -13251,6 +13251,7 @@ package android.credentials {
    ctor public ClearCredentialStateException(@NonNull String, @Nullable Throwable);
    ctor public ClearCredentialStateException(@NonNull String);
    method @NonNull public String getType();
    field @NonNull public static final String TYPE_UNKNOWN = "android.credentials.ClearCredentialStateException.TYPE_UNKNOWN";
  }
  public final class ClearCredentialStateRequest implements android.os.Parcelable {
@@ -13267,7 +13268,10 @@ package android.credentials {
    ctor public CreateCredentialException(@NonNull String, @Nullable Throwable);
    ctor public CreateCredentialException(@NonNull String);
    method @NonNull public String getType();
    field @NonNull public static final String TYPE_INTERRUPTED = "android.credentials.CreateCredentialException.TYPE_INTERRUPTED";
    field @NonNull public static final String TYPE_NO_CREDENTIAL = "android.credentials.CreateCredentialException.TYPE_NO_CREDENTIAL";
    field @NonNull public static final String TYPE_UNKNOWN = "android.credentials.CreateCredentialException.TYPE_UNKNOWN";
    field @NonNull public static final String TYPE_USER_CANCELED = "android.credentials.CreateCredentialException.TYPE_USER_CANCELED";
  }
  public final class CreateCredentialRequest implements android.os.Parcelable {
@@ -13311,7 +13315,10 @@ package android.credentials {
    ctor public GetCredentialException(@NonNull String, @Nullable Throwable);
    ctor public GetCredentialException(@NonNull String);
    method @NonNull public String getType();
    field @NonNull public static final String TYPE_INTERRUPTED = "android.credentials.GetCredentialException.TYPE_INTERRUPTED";
    field @NonNull public static final String TYPE_NO_CREDENTIAL = "android.credentials.GetCredentialException.TYPE_NO_CREDENTIAL";
    field @NonNull public static final String TYPE_UNKNOWN = "android.credentials.GetCredentialException.TYPE_UNKNOWN";
    field @NonNull public static final String TYPE_USER_CANCELED = "android.credentials.GetCredentialException.TYPE_USER_CANCELED";
  }
  public final class GetCredentialOption implements android.os.Parcelable {
+6 −0
Original line number Diff line number Diff line
@@ -31,6 +31,12 @@ import java.util.concurrent.Executor;
 * CancellationSignal, Executor, OutcomeReceiver)} operation.
 */
public class ClearCredentialStateException extends Exception {
    /**
     * The error type value for when the given operation failed due to an unknown reason.
     */
    @NonNull
    public static final String TYPE_UNKNOWN =
            "android.credentials.ClearCredentialStateException.TYPE_UNKNOWN";

    @NonNull
    private final String mType;
+23 −0
Original line number Diff line number Diff line
@@ -32,6 +32,13 @@ import java.util.concurrent.Executor;
 * Activity, CancellationSignal, Executor, OutcomeReceiver)} operation.
 */
public class CreateCredentialException extends Exception {
    /**
     * The error type value for when the given operation failed due to an unknown reason.
     */
    @NonNull
    public static final String TYPE_UNKNOWN =
            "android.credentials.CreateCredentialException.TYPE_UNKNOWN";

    /**
     * The error type value for when no credential is available for the given {@link
     * CredentialManager#executeCreateCredential(CreateCredentialRequest, Activity,
@@ -40,6 +47,22 @@ public class CreateCredentialException extends Exception {
    @NonNull
    public static final String TYPE_NO_CREDENTIAL =
            "android.credentials.CreateCredentialException.TYPE_NO_CREDENTIAL";
    /**
     * The error type value for when the user intentionally cancelled the request.
     *
     * <p>This is a strong indicator that your app should refrain from making the same api call for
     * a certain amount of time to provide a better user experience.
     */
    @NonNull
    public static final String TYPE_USER_CANCELED =
            "android.credentials.CreateCredentialException.TYPE_USER_CANCELED";
    /**
     * The error type value for when the given operation failed due to internal interruption.
     * Retrying the same operation should fix the error.
     */
    @NonNull
    public static final String TYPE_INTERRUPTED =
            "android.credentials.CreateCredentialException.TYPE_INTERRUPTED";

    @NonNull
    private final String mType;
+23 −0
Original line number Diff line number Diff line
@@ -32,6 +32,13 @@ import java.util.concurrent.Executor;
 * Activity, CancellationSignal, Executor, OutcomeReceiver)} operation.
 */
public class GetCredentialException extends Exception {
    /**
     * The error type value for when the given operation failed due to an unknown reason.
     */
    @NonNull
    public static final String TYPE_UNKNOWN =
            "android.credentials.GetCredentialException.TYPE_UNKNOWN";

    /**
     * The error type value for when no credential is found available for the given {@link
     * CredentialManager#executeGetCredential(GetCredentialRequest, Activity, CancellationSignal,
@@ -40,6 +47,22 @@ public class GetCredentialException extends Exception {
    @NonNull
    public static final String TYPE_NO_CREDENTIAL =
            "android.credentials.GetCredentialException.TYPE_NO_CREDENTIAL";
    /**
     * The error type value for when the user intentionally cancelled the request.
     *
     * <p>This is a strong indicator that your app should refrain from making the same api call for
     * a certain amount of time to provide a better user experience.
     */
    @NonNull
    public static final String TYPE_USER_CANCELED =
            "android.credentials.GetCredentialException.TYPE_USER_CANCELED";
    /**
     * The error type value for when the given operation failed due to internal interruption.
     * Retrying the same operation should fix the error.
     */
    @NonNull
    public static final String TYPE_INTERRUPTED =
            "android.credentials.GetCredentialException.TYPE_INTERRUPTED";

    @NonNull
    private final String mType;