Update the BroadcastQueue logic for runtime permissions
Previously, we were skipping a broadcast when either the permission or
the app op was granted. However, for runtime permissions to be
considered "granted" both the permission and the app op need to be
granted. This change updates taking this into account.
Test: manual
Bug: 202436287
Bug: 183537857
Change-Id: I9f12f9e17e61246d723d18ead93c6115bbf6d5cf
Merged-In: I9f12f9e17e61246d723d18ead93c6115bbf6d5cf
(cherry picked from commit 1e6a968126)
This commit is contained in:
committed by
Hui Wang
parent
5b73d12920
commit
8517603de4
@@ -1568,17 +1568,23 @@ public final class BroadcastQueue {
|
||||
perm = PackageManager.PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
if (perm == PackageManager.PERMISSION_GRANTED) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
|
||||
int appOp = AppOpsManager.permissionToOpCode(excludedPermission);
|
||||
if (appOp != AppOpsManager.OP_NONE) {
|
||||
if (mService.getAppOpsManager().checkOpNoThrow(appOp,
|
||||
// When there is an app op associated with the permission,
|
||||
// skip when both the permission and the app op are
|
||||
// granted.
|
||||
if ((perm == PackageManager.PERMISSION_GRANTED) && (
|
||||
mService.getAppOpsManager().checkOpNoThrow(appOp,
|
||||
info.activityInfo.applicationInfo.uid,
|
||||
info.activityInfo.packageName)
|
||||
== AppOpsManager.MODE_ALLOWED) {
|
||||
== AppOpsManager.MODE_ALLOWED)) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// When there is no app op associated with the permission,
|
||||
// skip when permission is granted.
|
||||
if (perm == PackageManager.PERMISSION_GRANTED) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user