Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit e93050c4 authored by Eran Messeri's avatar Eran Messeri
Browse files

Notify users when admin grants location permission

When the admin grants a location-related permission to an app (using
DevicePolicyManager.setPermissionGrantState), notify the user that the
app got this permission.

Implementation: The AutoGrantPermissionsNotifier introduced in a
previous change is used to present the notification to the user.

In PermissionControllerServiceImpl.onSetRuntimePermissionGrantStateByDeviceAdmin,
when the permission is actually granted to the app, each permission is
logged. Before the method returns,
AutoGrantPermissionsNotifier.notifyOfAutoGrantPermissions method is called,
which issues the notification.

Tapping the notification sends the user to the Settings screen where app
permissions can be seen (but not controlled).

Note that this notification does vibrate and emit a sound, while the
notification shown for permissions granted via policy do not, as the
latter notification is shown in-context, when the app requests (and is
granted) the permission.

Testing:
* Install TestDPC.
* Set TestDPC as Device Owner
* Get the BasicLocation app by checking out
https://github.com/android/location-samples and building it from there.
* Install the app onto the device but do not start it.
* Find "Manage app permissions", choose "Basic Location Sample" from the
drop-down menu.
* Toggle each of the "ACCESS_COARSE_LOCATION" and
"ACCESS_BACKGROUND_LOCATION" to "Allow".
* Observe notification

Bug: 148631522
Test: Manual, see above
Change-Id: I4fef2d5d47718265bec6aaf9b485e86b9da91ec3
parent 2cc65ab4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment