diff options
Diffstat (limited to 'PermissionController/src/com/android/permissioncontroller/permission/ui/model/GrantPermissionsViewModel.kt')
-rw-r--r-- | PermissionController/src/com/android/permissioncontroller/permission/ui/model/GrantPermissionsViewModel.kt | 10 |
1 files changed, 6 insertions, 4 deletions
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 64549703f..9749a814c 100644 --- a/PermissionController/src/com/android/permissioncontroller/permission/ui/model/GrantPermissionsViewModel.kt +++ b/PermissionController/src/com/android/permissioncontroller/permission/ui/model/GrantPermissionsViewModel.kt @@ -237,7 +237,8 @@ class GrantPermissionsViewModel( // some requests might have been granted, check for that for ((key, state) in states) { val allAffectedGranted = state.affectedPermissions.all { perm -> - appPermGroup.permissions[perm]?.isGrantedIncludingAppOp == true + appPermGroup.permissions[perm]?.isGrantedIncludingAppOp == true && + appPermGroup.permissions[perm]?.isRevokeWhenRequested == false } if (allAffectedGranted) { groupStates[key]!!.state = STATE_ALLOWED @@ -654,7 +655,8 @@ class GrantPermissionsViewModel( // Do not attempt to grant background access if foreground access is not either already // granted or requested - if (isBackground && !group.foreground.isGranted && !hasForegroundRequest) { + if (isBackground && !group.foreground.isGrantedExcludeRevokeWhenRequestedPermissions && + !hasForegroundRequest) { Log.w(LOG_TAG, "Cannot grant $perm as the matching foreground permission is not " + "already granted.") val affectedPermissions = groupRequestedPermissions.filter { @@ -665,8 +667,8 @@ class GrantPermissionsViewModel( return STATE_SKIPPED } - if (isBackground && group.background.isGranted || - !isBackground && group.foreground.isGranted) { + if (isBackground && group.background.isGrantedExcludeRevokeWhenRequestedPermissions || + !isBackground && group.foreground.isGrantedExcludeRevokeWhenRequestedPermissions) { // If FINE location is not granted, do not grant it automatically when COARSE // location is already granted. if (group.permGroupName == LOCATION && |