From 7e59ec499c633162297344ef2d318ca80fb09f28 Mon Sep 17 00:00:00 2001 From: Suprabh Shukla Date: Thu, 1 Jun 2017 14:54:38 -0700 Subject: [PATCH] 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 --- .../settings/applications/ExternalSourcesDetails.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/com/android/settings/applications/ExternalSourcesDetails.java b/src/com/android/settings/applications/ExternalSourcesDetails.java index 7158900398a..36ce8f803bd 100644 --- a/src/com/android/settings/applications/ExternalSourcesDetails.java +++ b/src/com/android/settings/applications/ExternalSourcesDetails.java @@ -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);