From 48b8b8fd1866f867fa995b69ee07b557c9eb766e Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Thu, 6 Jun 2013 14:48:07 -0700 Subject: [PATCH] Allow hidden apps to opt-out When a system app doesn't have any UI, it wasn't being considered for opt-out. Check for all system apps that want to opt-out and mark them for uninstallation. Bug: 8908632 Change-Id: Iad7ccbe544cc7c7ebf73f430fbab8d295eb40219 --- .../settings/users/AppRestrictionsFragment.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/com/android/settings/users/AppRestrictionsFragment.java b/src/com/android/settings/users/AppRestrictionsFragment.java index 3d68024f0ec..95d3496ad71 100644 --- a/src/com/android/settings/users/AppRestrictionsFragment.java +++ b/src/com/android/settings/users/AppRestrictionsFragment.java @@ -513,6 +513,17 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen info.activityName = info.appName; info.icon = app.loadIcon(pm); mVisibleApps.add(info); + } else { + try { + PackageInfo pi = pm.getPackageInfo(app.packageName, 0); + // If it's a system app that requires an account and doesn't see restricted + // accounts, mark for removal. It might get shown in the UI if it has an icon + // but will still be marked as false and immutable. + if (pi.requiredAccountType != null && pi.restrictedAccountType == null) { + mSelectedPackages.put(app.packageName, false); + } + } catch (NameNotFoundException re) { + } } }