diff --git a/core/api/current.txt b/core/api/current.txt index 9274c0fd9ac2a..7fdc7b5072e10 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -13615,7 +13615,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(); diff --git a/core/java/android/credentials/CreateCredentialRequest.java b/core/java/android/credentials/CreateCredentialRequest.java index aec88b9c6f6b3..1e2a86f2ed118 100644 --- a/core/java/android/credentials/CreateCredentialRequest.java +++ b/core/java/android/credentials/CreateCredentialRequest.java @@ -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(); diff --git a/core/java/android/service/credentials/BeginCreateCredentialRequest.java b/core/java/android/service/credentials/BeginCreateCredentialRequest.java index 2eed998b73392..1ca0049550525 100644 --- a/core/java/android/service/credentials/BeginCreateCredentialRequest.java +++ b/core/java/android/service/credentials/BeginCreateCredentialRequest.java @@ -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; diff --git a/core/java/android/service/credentials/CallingAppInfo.java b/core/java/android/service/credentials/CallingAppInfo.java index 53d24b1d645b0..fba91d457236d 100644 --- a/core/java/android/service/credentials/CallingAppInfo.java +++ b/core/java/android/service/credentials/CallingAppInfo.java @@ -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) { diff --git a/packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt b/packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt index 0bcccd7f57b75..0d25bece62a62 100644 --- a/packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt +++ b/packages/CredentialManager/src/com/android/credentialmanager/CredentialManagerRepo.kt @@ -407,7 +407,8 @@ class CredentialManagerRepo( "androidx.credentials.TYPE_PUBLIC_KEY_CREDENTIAL", credentialData, /*candidateQueryData=*/ Bundle(), - /*isSystemProviderRequired=*/ false + /*isSystemProviderRequired=*/ false, + /*alwaysSendAppInfoToProvider=*/ true ), "com.google.android.youtube" ) @@ -421,7 +422,8 @@ class CredentialManagerRepo( TYPE_PASSWORD_CREDENTIAL, request.credentialData, request.candidateQueryData, - /*isSystemProviderRequired=*/ false + /*isSystemProviderRequired=*/ false, + /*alwaysSendAppInfoToProvider=*/ true ), "com.google.android.youtube" ) @@ -440,7 +442,8 @@ class CredentialManagerRepo( "other-sign-ins", data, /*candidateQueryData=*/ Bundle(), - /*isSystemProviderRequired=*/ false + /*isSystemProviderRequired=*/ false, + /*alwaysSendAppInfoToProvider=*/ true ), "com.google.android.youtube" )