diff options
author | Martijn Coenen <maco@google.com> | 2022-05-27 12:05:36 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2022-05-27 12:05:36 +0000 |
commit | 49951f2a52838092fbe9999c5385d8052d32340b (patch) | |
tree | ecbe8f94d696136f1810ab7f7d26e8a945fc7157 | |
parent | ea6997d367808a1a196109175dde07f41db0d3d3 (diff) | |
parent | dc6441feacf59907debfb063d1e283c52917c8f2 (diff) | |
download | Permission-49951f2a52838092fbe9999c5385d8052d32340b.tar.gz |
Merge "Revert "Fix auto-grant for groups with solely R_W_R perms"" into tm-dev
2 files changed, 7 insertions, 11 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/permission/model/livedatatypes/LightAppPermGroup.kt b/PermissionController/src/com/android/permissioncontroller/permission/model/livedatatypes/LightAppPermGroup.kt index 64d63bd1a..356f4e52f 100644 --- a/PermissionController/src/com/android/permissioncontroller/permission/model/livedatatypes/LightAppPermGroup.kt +++ b/PermissionController/src/com/android/permissioncontroller/permission/model/livedatatypes/LightAppPermGroup.kt @@ -189,15 +189,11 @@ data class LightAppPermGroup( val isGranted = specialLocationGrant ?: permissions.any { it.value.isGrantedIncludingAppOp } /** - * Whether this App Permission SubGroup should be treated as granted. This means either: - * 1) At least one permission was granted excluding auto-granted permissions (i.e., granted - * during install time with flag RevokeWhenRequested.) Or, - * 2) All permissions were auto-granted (all permissions are all granted and all - * RevokeWhenRequested.) + * Whether any of this App Permission SubGroup's permissions are granted excluding + * auto granted permissions during install time with flag RevokeWhenRequested */ - val isGrantedExcludingRWROrAllRWR = specialLocationGrant ?: (permissions - .any { it.value.isGrantedIncludingAppOp && !it.value.isRevokeWhenRequested } || - permissions.all { it.value.isGrantedIncludingAppOp && it.value.isRevokeWhenRequested }) + val isGrantedExcludeRevokeWhenRequestedPermissions = specialLocationGrant ?: permissions + .any { it.value.isGrantedIncludingAppOp && !it.value.isRevokeWhenRequested } /** * Whether any of this App Permission SubGroup's permissions are granted by default diff --git a/PermissionController/src/com/android/permissioncontroller/permission/ui/model/GrantPermissionsViewModel.kt b/PermissionController/src/com/android/permissioncontroller/permission/ui/model/GrantPermissionsViewModel.kt index 2f0921f09..a27bd5bba 100644 --- a/PermissionController/src/com/android/permissioncontroller/permission/ui/model/GrantPermissionsViewModel.kt +++ b/PermissionController/src/com/android/permissioncontroller/permission/ui/model/GrantPermissionsViewModel.kt @@ -710,7 +710,7 @@ class GrantPermissionsViewModel( // Do not attempt to grant background access if foreground access is not either already // granted or requested - if (isBackground && !group.foreground.isGrantedExcludingRWROrAllRWR && + if (isBackground && !group.foreground.isGrantedExcludeRevokeWhenRequestedPermissions && !hasForegroundRequest) { Log.w(LOG_TAG, "Cannot grant $perm as the matching foreground permission is not " + "already granted.") @@ -724,8 +724,8 @@ class GrantPermissionsViewModel( // TODO(b/205888750): remove isRuntimePermReview line once confident in // REVIEW_REQUIRED flag setting - if ((isBackground && group.background.isGrantedExcludingRWROrAllRWR || - !isBackground && group.foreground.isGrantedExcludingRWROrAllRWR) && + if ((isBackground && group.background.isGrantedExcludeRevokeWhenRequestedPermissions || + !isBackground && group.foreground.isGrantedExcludeRevokeWhenRequestedPermissions) && !group.isRuntimePermReviewRequired) { // If FINE location is not granted, do not grant it automatically when COARSE // location is already granted. |