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

Commit aeaca1f3 authored by Helen Qin's avatar Helen Qin
Browse files

Unhide framework constants and renamed errorType to type.

Constants:
1. The password credential type constant
2. The no-credential error type.

Bug: 246564035
CTS-Coverage-Bug: 263109618
API-Coverage-Bug: 263109618
Test: Local Build & Deployment
Change-Id: Ib858c31ba96e4a3fd7f4b13c9dc6c39ac268d5ab
parent 2f33b2e4
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -13222,7 +13222,7 @@ package android.credentials {
    ctor public ClearCredentialStateException(@NonNull String, @Nullable String, @Nullable Throwable);
    ctor public ClearCredentialStateException(@NonNull String, @Nullable Throwable);
    ctor public ClearCredentialStateException(@NonNull String);
    field @NonNull public final String errorType;
    method @NonNull public String getType();
  }
  public final class ClearCredentialStateRequest implements android.os.Parcelable {
@@ -13238,7 +13238,8 @@ package android.credentials {
    ctor public CreateCredentialException(@NonNull String, @Nullable String, @Nullable Throwable);
    ctor public CreateCredentialException(@NonNull String, @Nullable Throwable);
    ctor public CreateCredentialException(@NonNull String);
    field @NonNull public final String errorType;
    method @NonNull public String getType();
    field @NonNull public static final String TYPE_NO_CREDENTIAL = "android.credentials.CreateCredentialException.TYPE_NO_CREDENTIAL";
  }
  public final class CreateCredentialRequest implements android.os.Parcelable {
@@ -13267,6 +13268,7 @@ package android.credentials {
    method @NonNull public String getType();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.credentials.Credential> CREATOR;
    field @NonNull public static final String TYPE_PASSWORD_CREDENTIAL = "android.credentials.TYPE_PASSWORD_CREDENTIAL";
  }
  public final class CredentialManager {
@@ -13280,7 +13282,8 @@ package android.credentials {
    ctor public GetCredentialException(@NonNull String, @Nullable String, @Nullable Throwable);
    ctor public GetCredentialException(@NonNull String, @Nullable Throwable);
    ctor public GetCredentialException(@NonNull String);
    field @NonNull public final String errorType;
    method @NonNull public String getType();
    field @NonNull public static final String TYPE_NO_CREDENTIAL = "android.credentials.GetCredentialException.TYPE_NO_CREDENTIAL";
  }
  public final class GetCredentialOption implements android.os.Parcelable {
+20 −14
Original line number Diff line number Diff line
@@ -33,44 +33,50 @@ import java.util.concurrent.Executor;
public class ClearCredentialStateException extends Exception {

    @NonNull
    public final String errorType;
    private final String mType;

    /** Returns the specific exception type. */
    @NonNull
    public String getType() {
        return mType;
    }

    /**
     * Constructs a {@link ClearCredentialStateException}.
     *
     * @throws IllegalArgumentException If errorType is empty.
     * @throws IllegalArgumentException If type is empty.
     */
    public ClearCredentialStateException(@NonNull String errorType, @Nullable String message) {
        this(errorType, message, null);
    public ClearCredentialStateException(@NonNull String type, @Nullable String message) {
        this(type, message, null);
    }

    /**
     * Constructs a {@link ClearCredentialStateException}.
     *
     * @throws IllegalArgumentException If errorType is empty.
     * @throws IllegalArgumentException If type is empty.
     */
    public ClearCredentialStateException(
            @NonNull String errorType, @Nullable String message, @Nullable Throwable cause) {
            @NonNull String type, @Nullable String message, @Nullable Throwable cause) {
        super(message, cause);
        this.errorType = Preconditions.checkStringNotEmpty(errorType,
                "errorType must not be empty");
        this.mType = Preconditions.checkStringNotEmpty(type,
                "type must not be empty");
    }

    /**
     * Constructs a {@link ClearCredentialStateException}.
     *
     * @throws IllegalArgumentException If errorType is empty.
     * @throws IllegalArgumentException If type is empty.
     */
    public ClearCredentialStateException(@NonNull String errorType, @Nullable Throwable cause) {
        this(errorType, null, cause);
    public ClearCredentialStateException(@NonNull String type, @Nullable Throwable cause) {
        this(type, null, cause);
    }

    /**
     * Constructs a {@link ClearCredentialStateException}.
     *
     * @throws IllegalArgumentException If errorType is empty.
     * @throws IllegalArgumentException If type is empty.
     */
    public ClearCredentialStateException(@NonNull String errorType) {
        this(errorType, null, null);
    public ClearCredentialStateException(@NonNull String type) {
        this(type, null, null);
    }
}
+28 −14
Original line number Diff line number Diff line
@@ -32,46 +32,60 @@ import java.util.concurrent.Executor;
 * Activity, CancellationSignal, Executor, OutcomeReceiver)} operation.
 */
public class CreateCredentialException extends Exception {
    /**
     * The error type value for when no credential is available for the given {@link
     * CredentialManager#executeCreateCredential(CreateCredentialRequest, Activity,
     * CancellationSignal, Executor, OutcomeReceiver)} request.
     */
    @NonNull
    public static final String TYPE_NO_CREDENTIAL =
            "android.credentials.CreateCredentialException.TYPE_NO_CREDENTIAL";

    @NonNull
    public final String errorType;
    private final String mType;

    /** Returns the specific exception type. */
    @NonNull
    public String getType() {
        return mType;
    }

    /**
     * Constructs a {@link CreateCredentialException}.
     *
     * @throws IllegalArgumentException If errorType is empty.
     * @throws IllegalArgumentException If type is empty.
     */
    public CreateCredentialException(@NonNull String errorType, @Nullable String message) {
        this(errorType, message, null);
    public CreateCredentialException(@NonNull String type, @Nullable String message) {
        this(type, message, null);
    }

    /**
     * Constructs a {@link CreateCredentialException}.
     *
     * @throws IllegalArgumentException If errorType is empty.
     * @throws IllegalArgumentException If type is empty.
     */
    public CreateCredentialException(
            @NonNull String errorType, @Nullable String message, @Nullable Throwable cause) {
            @NonNull String type, @Nullable String message, @Nullable Throwable cause) {
        super(message, cause);
        this.errorType = Preconditions.checkStringNotEmpty(errorType,
                "errorType must not be empty");
        this.mType = Preconditions.checkStringNotEmpty(type,
                "type must not be empty");
    }

    /**
     * Constructs a {@link CreateCredentialException}.
     *
     * @throws IllegalArgumentException If errorType is empty.
     * @throws IllegalArgumentException If type is empty.
     */
    public CreateCredentialException(@NonNull String errorType, @Nullable Throwable cause) {
        this(errorType, null, cause);
    public CreateCredentialException(@NonNull String type, @Nullable Throwable cause) {
        this(type, null, cause);
    }

    /**
     * Constructs a {@link CreateCredentialException}.
     *
     * @throws IllegalArgumentException If errorType is empty.
     * @throws IllegalArgumentException If type is empty.
     */
    public CreateCredentialException(@NonNull String errorType) {
        this(errorType, null, null);
    public CreateCredentialException(@NonNull String type) {
        this(type, null, null);
    }
}
+0 −2
Original line number Diff line number Diff line
@@ -33,8 +33,6 @@ public final class Credential implements Parcelable {

    /**
     * The type value for password credential related operations.
     *
     * @hide
     */
    @NonNull public static final String TYPE_PASSWORD_CREDENTIAL =
            "android.credentials.TYPE_PASSWORD_CREDENTIAL";
+28 −14
Original line number Diff line number Diff line
@@ -32,46 +32,60 @@ import java.util.concurrent.Executor;
 * Activity, CancellationSignal, Executor, OutcomeReceiver)} operation.
 */
public class GetCredentialException extends Exception {
    /**
     * The error type value for when no credential is found available for the given {@link
     * CredentialManager#executeGetCredential(GetCredentialRequest, Activity, CancellationSignal,
     * Executor, OutcomeReceiver)} request.
     */
    @NonNull
    public static final String TYPE_NO_CREDENTIAL =
            "android.credentials.GetCredentialException.TYPE_NO_CREDENTIAL";

    @NonNull
    public final String errorType;
    private final String mType;

    /** Returns the specific exception type. */
    @NonNull
    public String getType() {
        return mType;
    }

    /**
     * Constructs a {@link GetCredentialException}.
     *
     * @throws IllegalArgumentException If errorType is empty.
     * @throws IllegalArgumentException If type is empty.
     */
    public GetCredentialException(@NonNull String errorType, @Nullable String message) {
        this(errorType, message, null);
    public GetCredentialException(@NonNull String type, @Nullable String message) {
        this(type, message, null);
    }

    /**
     * Constructs a {@link GetCredentialException}.
     *
     * @throws IllegalArgumentException If errorType is empty.
     * @throws IllegalArgumentException If type is empty.
     */
    public GetCredentialException(
            @NonNull String errorType, @Nullable String message, @Nullable Throwable cause) {
            @NonNull String type, @Nullable String message, @Nullable Throwable cause) {
        super(message, cause);
        this.errorType = Preconditions.checkStringNotEmpty(errorType,
                "errorType must not be empty");
        this.mType = Preconditions.checkStringNotEmpty(type,
                "type must not be empty");
    }

    /**
     * Constructs a {@link GetCredentialException}.
     *
     * @throws IllegalArgumentException If errorType is empty.
     * @throws IllegalArgumentException If type is empty.
     */
    public GetCredentialException(@NonNull String errorType, @Nullable Throwable cause) {
        this(errorType, null, cause);
    public GetCredentialException(@NonNull String type, @Nullable Throwable cause) {
        this(type, null, cause);
    }

    /**
     * Constructs a {@link GetCredentialException}.
     *
     * @throws IllegalArgumentException If errorType is empty.
     * @throws IllegalArgumentException If type is empty.
     */
    public GetCredentialException(@NonNull String errorType) {
        this(errorType, null, null);
    public GetCredentialException(@NonNull String type) {
        this(type, null, null);
    }
}
Loading