diff options
author | Anthony Hugh <ahugh@google.com> | 2015-10-30 20:28:24 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-10-30 20:28:24 +0000 |
commit | d158e9d12388f3579f1b6d91e57d6cc9a023c81f (patch) | |
tree | e99c7c89dffdc3a7073a6cfe3582ee5cfddaa28c /src/com/android/packageinstaller/permission/model | |
parent | 3395cefbb565d1c52683af5ebe1638e998596802 (diff) | |
parent | 4ba106a392dccff3364249eef4596ecea9e71263 (diff) | |
download | android_packages_apps_PackageInstaller-d158e9d12388f3579f1b6d91e57d6cc9a023c81f.tar.gz android_packages_apps_PackageInstaller-d158e9d12388f3579f1b6d91e57d6cc9a023c81f.tar.bz2 android_packages_apps_PackageInstaller-d158e9d12388f3579f1b6d91e57d6cc9a023c81f.zip |
Merge "Add mechanism for determining if apps are system apps" into cw-e-dev am: ae6139679d am: 5b3d79ac1f
am: 4ba106a392
* commit '4ba106a392dccff3364249eef4596ecea9e71263':
Add mechanism for determining if apps are system apps
Diffstat (limited to 'src/com/android/packageinstaller/permission/model')
-rw-r--r-- | src/com/android/packageinstaller/permission/model/PermissionStatusReceiver.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/com/android/packageinstaller/permission/model/PermissionStatusReceiver.java b/src/com/android/packageinstaller/permission/model/PermissionStatusReceiver.java index 3604cd71..810ae8ec 100644 --- a/src/com/android/packageinstaller/permission/model/PermissionStatusReceiver.java +++ b/src/com/android/packageinstaller/permission/model/PermissionStatusReceiver.java @@ -69,11 +69,14 @@ public class PermissionStatusReceiver extends BroadcastReceiver { List<String> appsList = new ArrayList<>(); List<CharSequence> appLabelsList = new ArrayList<>(); - if (getAppsWithRuntimePermissions(context, appsList, appLabelsList)) { + List<Boolean> isSystemAppList = new ArrayList<>(); + if (getAppsWithRuntimePermissions(context, appsList, appLabelsList, isSystemAppList)) { responseIntent.putExtra(Intent.EXTRA_GET_PERMISSIONS_APP_LIST_RESULT, appsList.toArray(new String[appsList.size()])); responseIntent.putExtra(Intent.EXTRA_GET_PERMISSIONS_APP_LABEL_LIST_RESULT, appLabelsList.toArray(new String[appLabelsList.size()])); + responseIntent.putExtra(Intent.EXTRA_GET_PERMISSIONS_IS_SYSTEM_APP_LIST_RESULT, + toPrimitiveBoolArray(isSystemAppList)); } context.sendBroadcast(responseIntent); } @@ -122,13 +125,14 @@ public class PermissionStatusReceiver extends BroadcastReceiver { } public boolean getAppsWithRuntimePermissions(Context context, List<String> appsList, - List<CharSequence> appLabelsList) { + List<CharSequence> appLabelsList, List<Boolean> isSystemAppList) { final List<ApplicationInfo> appInfos = Utils.getAllInstalledApplications(context); if (appInfos == null) { return false; } final int appInfosSize = appInfos.size(); try { + ArraySet<String> launcherPackages = Utils.getLauncherPackages(context); for (int i = 0; i < appInfosSize; ++i) { final String packageName = appInfos.get(i).packageName; PackageInfo packageInfo = context.getPackageManager().getPackageInfo( @@ -146,6 +150,7 @@ public class PermissionStatusReceiver extends BroadcastReceiver { if (shouldShow) { appsList.add(packageName); appLabelsList.add(appPermissions.getAppLabel()); + isSystemAppList.add(Utils.isSystem(appPermissions, launcherPackages)); } } } catch (NameNotFoundException e) { @@ -180,4 +185,14 @@ public class PermissionStatusReceiver extends BroadcastReceiver { counts[1] = allApps.size(); return true; } + + private boolean[] toPrimitiveBoolArray(final List<Boolean> list) { + final int count = list.size(); + final boolean[] result = new boolean[count]; + for (int i = 0; i < count; ++i) { + result[i] = list.get(i); + } + + return result; + } } |