Add some null checks in various credentials classes
Bug: 262614404 Test: other CLs Change-Id: I366771db613f0d5ba9088f170544c102d28dd3ba
This commit is contained in:
@@ -332,6 +332,7 @@ public final class CredentialManager {
|
||||
@Nullable CancellationSignal cancellationSignal,
|
||||
@CallbackExecutor @NonNull Executor executor,
|
||||
@NonNull OutcomeReceiver<Void, ClearCredentialStateException> callback) {
|
||||
requireNonNull(request, "request must not be null");
|
||||
requireNonNull(executor, "executor must not be null");
|
||||
requireNonNull(callback, "callback must not be null");
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ public class CredentialEntry implements Parcelable {
|
||||
}
|
||||
|
||||
private CredentialEntry(@NonNull Parcel in) {
|
||||
requireNonNull(in, "parcel must not be null");
|
||||
mType = in.readString8();
|
||||
mSlice = in.readTypedObject(Slice.CREATOR);
|
||||
mBeginGetCredentialOption = in.readTypedObject(BeginGetCredentialOption.CREATOR);
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package android.service.credentials;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
@@ -112,10 +114,9 @@ public final class CredentialProviderInfo {
|
||||
"Provider is not a valid system provider: " + serviceInfo);
|
||||
}
|
||||
}
|
||||
|
||||
mIsSystemProvider = isSystemProvider;
|
||||
mContext = context;
|
||||
mServiceInfo = serviceInfo;
|
||||
mContext = requireNonNull(context, "context must not be null");
|
||||
mServiceInfo = requireNonNull(serviceInfo, "serviceInfo must not be null");
|
||||
mCapabilities = new ArrayList<>();
|
||||
mIcon = mServiceInfo.loadIcon(mContext.getPackageManager());
|
||||
mLabel =
|
||||
@@ -300,6 +301,7 @@ public final class CredentialProviderInfo {
|
||||
@NonNull Context context,
|
||||
@UserIdInt int userId,
|
||||
boolean disableSystemAppVerificationForTests) {
|
||||
requireNonNull(context, "context must not be null");
|
||||
final List<CredentialProviderInfo> providerInfos = new ArrayList<>();
|
||||
for (ServiceInfo si :
|
||||
getAvailableSystemServiceInfos(
|
||||
@@ -381,6 +383,8 @@ public final class CredentialProviderInfo {
|
||||
int userId,
|
||||
boolean disableSystemAppVerificationForTests,
|
||||
int providerFilter) {
|
||||
requireNonNull(context, "context must not be null");
|
||||
|
||||
// Get the device policy.
|
||||
PackagePolicy pp = getDeviceManagerPolicy(context);
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@ import android.os.Parcelable;
|
||||
|
||||
import com.android.internal.util.AnnotationValidations;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Request for getting user's credential from a given credential provider.
|
||||
*
|
||||
@@ -43,8 +45,10 @@ public final class GetCredentialRequest implements Parcelable {
|
||||
|
||||
public GetCredentialRequest(@NonNull CallingAppInfo callingAppInfo,
|
||||
@NonNull CredentialOption credentialOption) {
|
||||
this.mCallingAppInfo = callingAppInfo;
|
||||
this.mCredentialOption = credentialOption;
|
||||
this.mCallingAppInfo = Objects.requireNonNull(callingAppInfo,
|
||||
"callingAppInfo must not be null");
|
||||
this.mCredentialOption = Objects.requireNonNull(credentialOption,
|
||||
"credentialOption must not be null");
|
||||
}
|
||||
|
||||
private GetCredentialRequest(@NonNull Parcel in) {
|
||||
|
||||
Reference in New Issue
Block a user