Do null check to account for the case where provider is only autofill
provider.
Test: local build
Bug: 281047738
Change-Id: I9f3dca118a0d4182e2d727fa011dcb48db2a553f
diff --git a/src/com/android/settings/applications/credentials/CombinedProviderInfo.java b/src/com/android/settings/applications/credentials/CombinedProviderInfo.java
index 0446c20..89a13ef 100644
--- a/src/com/android/settings/applications/credentials/CombinedProviderInfo.java
+++ b/src/com/android/settings/applications/credentials/CombinedProviderInfo.java
@@ -51,7 +51,11 @@
@Nullable AutofillServiceInfo asi,
boolean isDefaultAutofillProvider,
boolean IsPrimaryCredmanProvider) {
- mCredentialProviderInfos = new ArrayList<>(cpis);
+ if (cpis == null) {
+ mCredentialProviderInfos = new ArrayList<>();
+ } else {
+ mCredentialProviderInfos = new ArrayList<>(cpis);
+ }
mAutofillServiceInfo = asi;
mIsDefaultAutofillProvider = isDefaultAutofillProvider;
mIsPrimaryCredmanProvider = IsPrimaryCredmanProvider;
@@ -257,7 +261,7 @@
// Check if we have any enabled cred man services.
boolean isPrimaryCredmanProvider = false;
- if (!cpi.isEmpty()) {
+ if (cpi != null && !cpi.isEmpty()) {
isPrimaryCredmanProvider = cpi.get(0).isPrimary();
}