summaryrefslogtreecommitdiff
path: root/PermissionController/src/com/android/permissioncontroller/Constants.java
diff options
context:
space:
mode:
authorEran Messeri <eranm@google.com>2020-01-31 15:14:41 +0000
committerEran Messeri <eranm@google.com>2020-02-10 20:10:46 +0000
commit7c935aba22cc07a4de6befac323c2e908d4432cd (patch)
tree3a95ee37de1d33ab336b32613f00254de2b7e561 /PermissionController/src/com/android/permissioncontroller/Constants.java
parent22dfed264f710b160a87b6e05d4546fed7ccf508 (diff)
downloadPermission-7c935aba22cc07a4de6befac323c2e908d4432cd.tar.gz
Notify users when location permissions are auto granted
When the admin has set an auto-accept permissions policy, notify the user when an app is granted location-related permissions due to this policy. Implementation: A new class, AutoGrantPermissionsNotifier, was created, to present the notification to the user. The GrantPermissionsActivity class calls the AutoGrantPermissionsNotifier every time a permission was auto-granted, and once at the end of dealing with all permission requests by the app (so notifications can be coalesced and displayed only once). Tapping the notification sends the user to the Settings screen where app permissions can be seen (but not controlled, because of the admin-set policy). Testing: * Install TestDPC. * Set TestDPC as Device Owner * Find "Get/Set permissions policy" and toggle to "Auto accept" * Get the BasicLocation app by checking out https://github.com/android/location-samples and building it from there. * Install the app onto the device and start it. * Observe notification Bug: 148631522 Test: Manual, see above Change-Id: Iffbef902a936404f7d8df7e6264ed829c040df9f
Diffstat (limited to 'PermissionController/src/com/android/permissioncontroller/Constants.java')
-rw-r--r--PermissionController/src/com/android/permissioncontroller/Constants.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/Constants.java b/PermissionController/src/com/android/permissioncontroller/Constants.java
index 974efdad9..e6055235a 100644
--- a/PermissionController/src/com/android/permissioncontroller/Constants.java
+++ b/PermissionController/src/com/android/permissioncontroller/Constants.java
@@ -154,4 +154,15 @@ public class Constants {
* Invalid session id.
*/
public static final long INVALID_SESSION_ID = 0;
+
+ /**
+ * Key for NotificationManager.notify for the auto-granted permissions notification.
+ */
+ public static final String ADMIN_AUTO_GRANTED_PERMISSIONS_NOTIFICATION_CHANNEL_ID =
+ "auto granted permissions";
+ /**
+ * ID for notification of auto-granted permissions shown by
+ * {@link com.android.permissioncontroller.permission.ui.AutoGrantPermissionsNotifier}.
+ */
+ public static final int PERMISSION_GRANTED_BY_ADMIN_NOTIFICATION_ID = 1;
}