diff options
author | Nate Myren <ntmyren@google.com> | 2023-04-25 17:45:41 +0000 |
---|---|---|
committer | Nate Myren <ntmyren@google.com> | 2023-04-26 22:44:54 +0000 |
commit | 74c239a20c1098aaceafe8b1ea9554089f0e1207 (patch) | |
tree | 183529757040e84dc1b4b26568333c62d72e8989 | |
parent | 13ad2b5827109a8b1d75fc086f418d1edbd53246 (diff) | |
download | Permission-74c239a20c1098aaceafe8b1ea9554089f0e1207.tar.gz |
Revert "Ensure compat storage grant is viewed as grant by dialog"
This reverts commit 13ad2b5827109a8b1d75fc086f418d1edbd53246.
Reason for revert: After discussion, this behavior is no longer desired.
Bug: 274740329
Change-Id: I2169d6f9edd5a85ce25095e0951666b1435c5204
-rw-r--r-- | PermissionController/src/com/android/permissioncontroller/permission/ui/model/GrantPermissionsViewModel.kt | 26 |
1 files changed, 3 insertions, 23 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 1863c7816..b43074898 100644 --- a/PermissionController/src/com/android/permissioncontroller/permission/ui/model/GrantPermissionsViewModel.kt +++ b/PermissionController/src/com/android/permissioncontroller/permission/ui/model/GrantPermissionsViewModel.kt @@ -304,9 +304,8 @@ class GrantPermissionsViewModel( appPermGroup.permissions[perm]?.isGrantedIncludingAppOp == true && appPermGroup.permissions[perm]?.isRevokeWhenRequested == false } - if (allAffectedGranted || isCompatStorageGrant(appPermGroup)) { - groupStates[key] = GroupState(appPermGroup, state.isBackground, - state.affectedPermissions, STATE_ALLOWED) + if (allAffectedGranted) { + groupStates[key]!!.state = STATE_ALLOWED } } } else { @@ -811,11 +810,6 @@ class GrantPermissionsViewModel( // then skip the request return STATE_SKIPPED } - // If the "false grant" for apps that don't support the permission has been applied, - // treat the permission as already granted - if (isCompatStorageGrant(group)) { - return STATE_ALLOWED - } } val isBackground = perm in group.backgroundPermNames @@ -888,7 +882,7 @@ class GrantPermissionsViewModel( * ACCESS_MEDIA_LOCATION granted */ private fun isPartialStorageGrant(group: LightAppPermGroup): Boolean { - if (group.permGroupName != READ_MEDIA_VISUAL || !KotlinUtils.isPhotoPickerPromptEnabled()) { + if (!KotlinUtils.isPhotoPickerPromptEnabled() || group.permGroupName != READ_MEDIA_VISUAL) { return false } @@ -898,20 +892,6 @@ class GrantPermissionsViewModel( } } - /** - * A compat storage grant is provided when the user selects "select photos" on an app that does - * not explicitly request the READ_MEDIA_VISUAL_USER_SELECTED permission. It grants RMVUS, and - * applies the "revoked compat" state to all other permissions in the group. - */ - private fun isCompatStorageGrant(group: LightAppPermGroup): Boolean { - if (group.permGroupName != READ_MEDIA_VISUAL || !KotlinUtils.isPhotoPickerPromptEnabled()) { - return false - } - return group.permissions[READ_MEDIA_VISUAL_USER_SELECTED] - ?.isGrantedIncludingAppOp == true && - group.permissions.values.any { it.isCompatRevoked } - } - private fun getStateFromPolicy(perm: String, group: LightAppPermGroup): Int { val isBackground = perm in group.backgroundPermNames var skipGroup = false |