From 0335c2281a9cbd201c0075d952d8a8dcb472bc17 Mon Sep 17 00:00:00 2001 From: Becca Hughes Date: Mon, 18 Sep 2023 13:59:02 -0700 Subject: [PATCH] Use isPrimary bit when determining settings data change Test: ondevice Bug: 300538357 Change-Id: Ic155835761f850358527648a0628b72aab9a2323 --- .../CredentialManagerPreferenceController.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java b/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java index 7aced03b32a..98d56ccb1a5 100644 --- a/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java +++ b/src/com/android/settings/applications/credentials/CredentialManagerPreferenceController.java @@ -317,10 +317,15 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl null); } - private Set buildComponentNameSet(List providers) { + private Set buildComponentNameSet( + List providers, boolean removeNonPrimary) { Set output = new HashSet<>(); for (CredentialProviderInfo cpi : providers) { + if (removeNonPrimary && !cpi.isPrimary()) { + continue; + } + output.add(cpi.getComponentName()); } @@ -336,13 +341,16 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl List newProviders = mCredentialManager.getCredentialProviderServices( getUser(), CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY); - Set newComponents = buildComponentNameSet(newProviders); + Set newComponents = buildComponentNameSet(newProviders, false); + Set newPrimaryComponents = buildComponentNameSet(newProviders, true); // Get the list of old components - Set oldComponents = buildComponentNameSet(mServices); + Set oldComponents = buildComponentNameSet(mServices, false); + Set oldPrimaryComponents = buildComponentNameSet(mServices, true); // If the sets are equal then don't update the UI. - if (oldComponents.equals(newComponents)) { + if (oldComponents.equals(newComponents) + && oldPrimaryComponents.equals(newPrimaryComponents)) { return; }