Always returning the updated preference summary

AppEntry is not being updated when opening nested app info activities,
which led to stale preference summary being returned for external
sources details.

Test: Manually checked the preference summary is correctly reflecting
the state of the switch.
Existing test ExternalSourcesSettingsTest passes.

Bug: 37487637
Change-Id: Id3c665c7cc7231023f4110725b3b15e43284de97
This commit is contained in:
Suprabh Shukla
2017-06-01 14:54:38 -07:00
parent 10534456ed
commit 7e59ec499c

View File

@@ -89,13 +89,9 @@ public class ExternalSourcesDetails extends AppInfoWithHeader
return context.getString(R.string.disabled);
}
final InstallAppsState appsState;
if (entry.extraInfo instanceof InstallAppsState) {
appsState = (InstallAppsState) entry.extraInfo;
} else {
appsState = new AppStateInstallAppsBridge(context, null, null)
.createInstallAppsStateFor(entry.info.packageName, entry.info.uid);
}
final InstallAppsState appsState = new AppStateInstallAppsBridge(context, null, null)
.createInstallAppsStateFor(entry.info.packageName, entry.info.uid);
return context.getString(appsState.canInstallApps()
? R.string.app_permission_summary_allowed
: R.string.app_permission_summary_not_allowed);