summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/users
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2013-08-27 21:42:57 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-08-27 21:42:58 +0000
commitcb6ba728c5f872bc66e3b8ac3682b350cb7501f0 (patch)
treeb6805a2c38b94bb5159c97f7f42e0a6d5c45897a /src/com/android/settings/users
parent9066b9140c376cb1b66a3eee830d9dfa177c6056 (diff)
parent928191881df05c6520c1da8c208b6a7f47f52d45 (diff)
downloadpackages_apps_Settings-cb6ba728c5f872bc66e3b8ac3682b350cb7501f0.tar.gz
packages_apps_Settings-cb6ba728c5f872bc66e3b8ac3682b350cb7501f0.tar.bz2
packages_apps_Settings-cb6ba728c5f872bc66e3b8ac3682b350cb7501f0.zip
Merge "Don't list apps that are disabled by the system" into klp-dev
Diffstat (limited to 'src/com/android/settings/users')
-rw-r--r--src/com/android/settings/users/AppRestrictionsFragment.java28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/com/android/settings/users/AppRestrictionsFragment.java b/src/com/android/settings/users/AppRestrictionsFragment.java
index ff69f2b0f..96a7b47e3 100644
--- a/src/com/android/settings/users/AppRestrictionsFragment.java
+++ b/src/com/android/settings/users/AppRestrictionsFragment.java
@@ -479,13 +479,24 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
PackageManager.GET_DISABLED_COMPONENTS | PackageManager.GET_UNINSTALLED_PACKAGES);
for (ResolveInfo app : launchableApps) {
if (app.activityInfo != null && app.activityInfo.applicationInfo != null) {
+ final String packageName = app.activityInfo.packageName;
int flags = app.activityInfo.applicationInfo.flags;
if ((flags & ApplicationInfo.FLAG_SYSTEM) != 0
|| (flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
// System app
// Skip excluded packages
- if (excludePackages.contains(app.activityInfo.packageName)) continue;
-
+ if (excludePackages.contains(packageName)) continue;
+ int enabled = pm.getApplicationEnabledSetting(packageName);
+ if (enabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED
+ || enabled == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) {
+ // Check if the app is already enabled for the target user
+ ApplicationInfo targetUserAppInfo = getAppInfoForUser(packageName,
+ 0, mUser);
+ if (targetUserAppInfo == null
+ || (targetUserAppInfo.flags&ApplicationInfo.FLAG_INSTALLED) == 0) {
+ continue;
+ }
+ }
SelectableAppInfo info = new SelectableAppInfo();
info.packageName = app.activityInfo.packageName;
info.appName = app.activityInfo.applicationInfo.loadLabel(pm);
@@ -499,6 +510,16 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
}
}
+ private ApplicationInfo getAppInfoForUser(String packageName, int flags, UserHandle user) {
+ try {
+ ApplicationInfo targetUserAppInfo = mIPm.getApplicationInfo(packageName, flags,
+ user.getIdentifier());
+ return targetUserAppInfo;
+ } catch (RemoteException re) {
+ return null;
+ }
+ }
+
private class AppLoadingTask extends AsyncTask<Void, Void, Void> {
@Override
@@ -567,6 +588,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
}
}
+ // Get the list of apps already installed for the user
mUserApps = null;
try {
mUserApps = ipm.getInstalledApplications(
@@ -590,6 +612,8 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
}
}
}
+
+ // Sort the list of visible apps
Collections.sort(mVisibleApps, new AppLabelComparator());
// Remove dupes