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

Commit 72dc40e4 authored by Becca Hughes's avatar Becca Hughes
Browse files

Only update settings UI if data changes

The flashing was caused by overzealous
reloading which should be fixed by this
CL.

Test: flash device
Bug: 299329723
Change-Id: I7d97da7f3c699ebea280a337bc64b8fe2f351126
parent 7cd9300c
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -302,8 +302,36 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
                null);
    }

    private Set<ComponentName> buildComponentNameSet(List<CredentialProviderInfo> providers) {
        Set<ComponentName> output = new HashSet<>();

        for (CredentialProviderInfo cpi : providers) {
            output.add(cpi.getComponentName());
        }

        return output;
    }

    private void updateFromExternal() {
        update();
        if (mCredentialManager == null) {
            return;
        }

        // Get the list of new providers and components.
        List<CredentialProviderInfo> newProviders =
                mCredentialManager.getCredentialProviderServices(
                        getUser(), CredentialManager.PROVIDER_FILTER_USER_PROVIDERS_ONLY);
        Set<ComponentName> newComponents = buildComponentNameSet(newProviders);

        // Get the list of old components
        Set<ComponentName> oldComponents = buildComponentNameSet(mServices);

        // If the sets are equal then don't update the UI.
        if (oldComponents.equals(newComponents)) {
            return;
        }

        setAvailableServices(newProviders, null);

        if (mPreferenceScreen != null) {
            displayPreference(mPreferenceScreen);