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

Commit 246a8eb3 authored by Reema Bajwa's avatar Reema Bajwa
Browse files

Address API council review feedback

This change removes a constructor on CreateCredentialRequest, and adds null checks on non-null constructor parameter for CallingAppInfo.

Bug: 268419158
Bug: 268300217

Test: built & deployed locally

Change-Id: If9d7fe9d9bccc21b937f4aec7829548bf00c0fbc
parent f1780e12
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -13529,7 +13529,6 @@ package android.credentials {
  public final class CreateCredentialRequest implements android.os.Parcelable {
    ctor public CreateCredentialRequest(@NonNull String, @NonNull android.os.Bundle, @NonNull android.os.Bundle, boolean, boolean);
    ctor public CreateCredentialRequest(@NonNull String, @NonNull android.os.Bundle, @NonNull android.os.Bundle, boolean);
    method public boolean alwaysSendAppInfoToProvider();
    method public int describeContents();
    method @NonNull public android.os.Bundle getCandidateQueryData();
+0 −21
Original line number Diff line number Diff line
@@ -182,27 +182,6 @@ public final class CreateCredentialRequest implements Parcelable {
        mAlwaysSendAppInfoToProvider = alwaysSendAppInfoToProvider;
    }

    /**
     * Constructs a {@link CreateCredentialRequest}.
     *
     * @param type the requested credential type
     * @param credentialData the full credential creation request data
     * @param candidateQueryData the partial request data that will be sent to the provider
     *                           during the initial creation candidate query stage
     * @param isSystemProviderRequired whether the request must only be fulfilled by a system
     *                                provider
     *
     * @throws IllegalArgumentException If type is empty.
     */
    public CreateCredentialRequest(
            @NonNull String type,
            @NonNull Bundle credentialData,
            @NonNull Bundle candidateQueryData,
            boolean isSystemProviderRequired) {
        this(type, credentialData, candidateQueryData, isSystemProviderRequired,
                /*mAlwaysSendAppInfoToProvider=*/true);
    }

    private CreateCredentialRequest(@NonNull Parcel in) {
        String type = in.readString8();
        Bundle credentialData = in.readBundle();
+7 −1
Original line number Diff line number Diff line
@@ -100,7 +100,13 @@ public class BeginCreateCredentialRequest implements Parcelable {
        dest.writeBundle(mData);
    }

    /** Returns the info pertaining to the calling app. */
    /**
     * Returns the info pertaining to the calling app.
     *
     * This value can be null when this instance is set on a {@link BeginGetCredentialRequest} or
     * a {@link BeginCreateCredentialRequest} if the caller of the API does not wish to propagate
     * this information to a credential provider.
     */
    @Nullable
    public CallingAppInfo getCallingAppInfo() {
        return mCallingAppInfo;
+7 −2
Original line number Diff line number Diff line
@@ -21,6 +21,10 @@ import android.content.pm.SigningInfo;
import android.os.Parcel;
import android.os.Parcelable;

import com.android.internal.util.Preconditions;

import java.util.Objects;

/**
 * Information pertaining to the calling application, including the package name and a list of
 * app signatures.
@@ -37,8 +41,9 @@ public final class CallingAppInfo implements Parcelable {
     */
    public CallingAppInfo(@NonNull String packageName,
            @NonNull SigningInfo signingInfo) {
        mPackageName = packageName;
        mSigningInfo = signingInfo;
        mPackageName = Preconditions.checkStringNotEmpty(packageName, "package name"
                + "must not be null or empty");
        mSigningInfo = Objects.requireNonNull(signingInfo);
    }

    private CallingAppInfo(@NonNull Parcel in) {
+6 −3
Original line number Diff line number Diff line
@@ -402,7 +402,8 @@ class CredentialManagerRepo(
                "androidx.credentials.TYPE_PUBLIC_KEY_CREDENTIAL",
                credentialData,
                /*candidateQueryData=*/ Bundle(),
                /*isSystemProviderRequired=*/ false
                /*isSystemProviderRequired=*/ false,
                /*alwaysSendAppInfoToProvider=*/ true
            ),
            "com.google.android.youtube"
        )
@@ -416,7 +417,8 @@ class CredentialManagerRepo(
                TYPE_PASSWORD_CREDENTIAL,
                request.credentialData,
                request.candidateQueryData,
                /*isSystemProviderRequired=*/ false
                /*isSystemProviderRequired=*/ false,
                /*alwaysSendAppInfoToProvider=*/ true
            ),
            "com.google.android.youtube"
        )
@@ -434,7 +436,8 @@ class CredentialManagerRepo(
                "other-sign-ins",
                data,
                /*candidateQueryData=*/ Bundle(),
                /*isSystemProviderRequired=*/ false
                /*isSystemProviderRequired=*/ false,
                /*alwaysSendAppInfoToProvider=*/ true
            ),
            "com.google.android.youtube"
        )