From 74c239a20c1098aaceafe8b1ea9554089f0e1207 Mon Sep 17 00:00:00 2001 From: Nate Myren Date: Tue, 25 Apr 2023 17:45:41 +0000 Subject: 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 --- .../ui/model/GrantPermissionsViewModel.kt | 26 +++------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'PermissionController/src/com') 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 -- cgit v1.2.3