Skip to content
Commit 7f3d1b6f authored by Jay Thomas Sullivan's avatar Jay Thomas Sullivan Committed by Jay Sullivan
Browse files

[ECM] Block restricted permission requests (first)

When a permission request occurs for a permission which ECM considers
"restricted" from the app, block it. This means don't actually show the
grant dialog, and instead just show the EnhancedConfirmationDialog
(a.k.a "ECM dialog" or "'Restricted setting' dialog").

If multiple permissions are requested at once, things are a little more
complicated, in that there were different ways we could have chosen to
handle them. We decided to reorder the permission requests as follows:

1. First show the ECM dialog for each of the restricted permissions.
   One dialog should be shown per permission group.
2. Then, move on to normal grant dialog behavior for the remaining ones.

The way that this change implements this is:

1. Intercept GrantPermissionsActivity::onCreate, checking to see if any
   restricted permissions were requested
2. If so, divide the requestedPermissions array into two: restricted and
   unrestricted.
3. For each restricted permission group, show the ECM dialog. This is a
   cross-activity loop, which we handle here using onSaveInstanceState
   to persist our progress, startActivityForResult to wait for each ECM
   dialog instance to end, and finally recreate() which brings us back
   into onCreate.
4. For each remaining unrestricted permission, proceed to normal
   GrantPermissionActivity behavior.

Also, restrict the SMS and Phone permission groups.

Bug: 325684196
Test: atest CtsPermissionUiTestCases:android.permissionui.cts.EnhancedConfirmationManagerTest
LOW_COVERAGE_REASON=327271398
Change-Id: I79cd0a387ca8ae6125888283db280fcfb36a6013
parent 8207849b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment