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

Commit dce41027 authored by Becca Hughes's avatar Becca Hughes Committed by Android (Google) Code Review
Browse files

Merge "Use isPrimary bit when determining settings data change" into main

parents ba14b4b5 0335c228
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -317,10 +317,15 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
                null);
    }

    private Set<ComponentName> buildComponentNameSet(List<CredentialProviderInfo> providers) {
    private Set<ComponentName> buildComponentNameSet(
            List<CredentialProviderInfo> providers, boolean removeNonPrimary) {
        Set<ComponentName> 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<CredentialProviderInfo> newProviders =
                mCredentialManager.getCredentialProviderServices(
                        getUser(), CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY);
        Set<ComponentName> newComponents = buildComponentNameSet(newProviders);
        Set<ComponentName> newComponents = buildComponentNameSet(newProviders, false);
        Set<ComponentName> newPrimaryComponents = buildComponentNameSet(newProviders, true);

        // Get the list of old components
        Set<ComponentName> oldComponents = buildComponentNameSet(mServices);
        Set<ComponentName> oldComponents = buildComponentNameSet(mServices, false);
        Set<ComponentName> 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;
        }