From 20295c603e367497a5f52a42cc7dbcf2aba9b06b Mon Sep 17 00:00:00 2001 From: Vinod Krishnan Date: Tue, 27 Dec 2016 17:26:06 -0800 Subject: Remove Intent added for Clockwork - Added in: https://googleplex-android-review.googlesource.com/#/c/760931/3/AndroidManifest.xml - This is no longer used in ClockworkHome Bug: 33662137 Change-Id: Ic6e921dd9bc489ce903fb83ebd8998d496c74092 --- AndroidManifest.xml | 1 - .../permission/model/PermissionStatusReceiver.java | 109 --------------------- 2 files changed, 110 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 5977bb95..a10496ae 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -162,7 +162,6 @@ android:permission="android.permission.GRANT_RUNTIME_PERMISSIONS"> - diff --git a/src/com/android/packageinstaller/permission/model/PermissionStatusReceiver.java b/src/com/android/packageinstaller/permission/model/PermissionStatusReceiver.java index a87976a6..7203b073 100644 --- a/src/com/android/packageinstaller/permission/model/PermissionStatusReceiver.java +++ b/src/com/android/packageinstaller/permission/model/PermissionStatusReceiver.java @@ -65,23 +65,6 @@ public class PermissionStatusReceiver extends BroadcastReceiver { public static final String ACTION_GET_PERMISSIONS_COUNT = "android.intent.action.GET_PERMISSIONS_COUNT"; - /** - * Broadcast action that requests list of all apps that have runtime permissions. It will - * respond to the request by sending a broadcast with action defined by - * {@link #EXTRA_GET_PERMISSIONS_PACKAGES_RESPONSE_INTENT}. The response will contain - * {@link #EXTRA_GET_PERMISSIONS_APP_LIST_RESULT}, as well as - * {@link #EXTRA_GET_PERMISSIONS_APP_LABEL_LIST_RESULT}, with contents described below or - * a null upon failure. - * - *

{@link #EXTRA_GET_PERMISSIONS_APP_LIST_RESULT} will contain a list of package names of - * apps that have runtime permissions. {@link #EXTRA_GET_PERMISSIONS_APP_LABEL_LIST_RESULT} - * will contain the list of app labels corresponding ot the apps in the first list. - * - * @hide - */ - public static final String ACTION_GET_PERMISSIONS_PACKAGES - = "android.intent.action.GET_PERMISSIONS_PACKAGES"; - /** * Extra included in response to {@link #ACTION_GET_PERMISSIONS_COUNT}. * @hide @@ -96,28 +79,6 @@ public class PermissionStatusReceiver extends BroadcastReceiver { public static final String EXTRA_GET_PERMISSIONS_GROUP_LIST_RESULT = "android.intent.extra.GET_PERMISSIONS_GROUP_LIST_RESULT"; - /** - * String list of apps that have one or more runtime permissions. - * @hide - */ - public static final String EXTRA_GET_PERMISSIONS_APP_LIST_RESULT - = "android.intent.extra.GET_PERMISSIONS_APP_LIST_RESULT"; - - /** - * String list of app labels for apps that have one or more runtime permissions. - * @hide - */ - public static final String EXTRA_GET_PERMISSIONS_APP_LABEL_LIST_RESULT - = "android.intent.extra.GET_PERMISSIONS_APP_LABEL_LIST_RESULT"; - - /** - * Boolean list describing if the app is a system app for apps that have one or more runtime - * permissions. - * @hide - */ - public static final String EXTRA_GET_PERMISSIONS_IS_SYSTEM_APP_LIST_RESULT - = "android.intent.extra.GET_PERMISSIONS_IS_SYSTEM_APP_LIST_RESULT"; - /** * Required extra to be sent with {@link #ACTION_GET_PERMISSIONS_COUNT} broadcasts. * @hide @@ -125,13 +86,6 @@ public class PermissionStatusReceiver extends BroadcastReceiver { public static final String EXTRA_GET_PERMISSIONS_RESPONSE_INTENT = "android.intent.extra.GET_PERMISSIONS_RESONSE_INTENT"; - /** - * Required extra to be sent with {@link #ACTION_GET_PERMISSIONS_PACKAGES} broadcasts. - * @hide - */ - public static final String EXTRA_GET_PERMISSIONS_PACKAGES_RESPONSE_INTENT - = "android.intent.extra.GET_PERMISSIONS_PACKAGES_RESONSE_INTENT"; - @Override public void onReceive(Context context, Intent intent) { if (ACTION_GET_PERMISSIONS_COUNT.equals(intent.getAction())) { @@ -160,23 +114,6 @@ public class PermissionStatusReceiver extends BroadcastReceiver { } } context.sendBroadcast(responseIntent); - } else if (ACTION_GET_PERMISSIONS_PACKAGES.equals(intent.getAction())) { - Intent responseIntent = new Intent(intent.getStringExtra( - EXTRA_GET_PERMISSIONS_PACKAGES_RESPONSE_INTENT)); - responseIntent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND); - - List appsList = new ArrayList<>(); - List appLabelsList = new ArrayList<>(); - List isSystemAppList = new ArrayList<>(); - if (getAppsWithRuntimePermissions(context, appsList, appLabelsList, isSystemAppList)) { - responseIntent.putExtra(EXTRA_GET_PERMISSIONS_APP_LIST_RESULT, - appsList.toArray(new String[appsList.size()])); - responseIntent.putExtra(EXTRA_GET_PERMISSIONS_APP_LABEL_LIST_RESULT, - appLabelsList.toArray(new String[appLabelsList.size()])); - responseIntent.putExtra(EXTRA_GET_PERMISSIONS_IS_SYSTEM_APP_LIST_RESULT, - toPrimitiveBoolArray(isSystemAppList)); - } - context.sendBroadcast(responseIntent); } } @@ -222,42 +159,6 @@ public class PermissionStatusReceiver extends BroadcastReceiver { } } - public boolean getAppsWithRuntimePermissions(Context context, List appsList, - List appLabelsList, List isSystemAppList) { - final List appInfos = Utils.getAllInstalledApplications(context); - if (appInfos == null) { - return false; - } - final int appInfosSize = appInfos.size(); - try { - ArraySet launcherPackages = Utils.getLauncherPackages(context); - for (int i = 0; i < appInfosSize; ++i) { - final String packageName = appInfos.get(i).packageName; - PackageInfo packageInfo = context.getPackageManager().getPackageInfo( - packageName, PackageManager.GET_PERMISSIONS); - AppPermissions appPermissions = - new AppPermissions(context, packageInfo, null, false, null); - - boolean shouldShow = false; - for (AppPermissionGroup group : appPermissions.getPermissionGroups()) { - if (Utils.shouldShowPermission(group, packageName)) { - shouldShow = true; - break; - } - } - if (shouldShow) { - appsList.add(packageName); - appLabelsList.add(appPermissions.getAppLabel()); - isSystemAppList.add(Utils.isSystem(appPermissions, launcherPackages)); - } - } - } catch (NameNotFoundException e) { - return false; - } - - return true; - } - public boolean getAppsWithPermissionsCount(Context context, int[] counts) { ArraySet launcherPkgs = Utils.getLauncherPackages(context); // Indexed by uid. @@ -283,14 +184,4 @@ public class PermissionStatusReceiver extends BroadcastReceiver { counts[1] = allApps.size(); return true; } - - private boolean[] toPrimitiveBoolArray(final List 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; - } } -- cgit v1.2.3