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
This commit is contained in:
@@ -302,8 +302,36 @@ public class CredentialManagerPreferenceController extends BasePreferenceControl
|
|||||||
null);
|
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() {
|
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) {
|
if (mPreferenceScreen != null) {
|
||||||
displayPreference(mPreferenceScreen);
|
displayPreference(mPreferenceScreen);
|
||||||
|
Reference in New Issue
Block a user