diff options
author | Nate Myren <ntmyren@google.com> | 2023-11-30 15:21:08 -0800 |
---|---|---|
committer | Nate Myren <ntmyren@google.com> | 2023-12-04 17:26:21 +0000 |
commit | 9e16bf68f649beac055c8c34bcf107dbee108716 (patch) | |
tree | 994b19291a7b4c74ae4768f797d29a77a7f9b923 | |
parent | 23571f936525dca9f6560cbf866f9df7bb2f37dc (diff) | |
download | Permission-9e16bf68f649beac055c8c34bcf107dbee108716.tar.gz |
Disable the permissions screen for fixed photos permissions
A bug was causing the system fixed behavior to incorrectly not apply
Fixes: 314199291
Test: manual
Change-Id: I6c0634ee995d88caeb3ee0a3f66c69b8542c462c
Relnote: Fix bug in permissions screen
(cherry picked from commit 9cc131d6e180b45de9ac0ef4262194b74b0e3937)
-rw-r--r-- | PermissionController/src/com/android/permissioncontroller/permission/ui/model/AppPermissionViewModel.kt | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/permission/ui/model/AppPermissionViewModel.kt b/PermissionController/src/com/android/permissioncontroller/permission/ui/model/AppPermissionViewModel.kt index cc29acbd7..d2142a855 100644 --- a/PermissionController/src/com/android/permissioncontroller/permission/ui/model/AppPermissionViewModel.kt +++ b/PermissionController/src/com/android/permissioncontroller/permission/ui/model/AppPermissionViewModel.kt @@ -255,7 +255,6 @@ class AppPermissionViewModel( mutableMapOf<String, LightAppPermGroupLiveData>() init { - addSource(appPermGroupLiveData) { appPermGroup -> lightAppPermGroup = appPermGroup if (permGroupName in PermissionMapping.STORAGE_SUPERGROUP_PERMISSIONS) { @@ -398,6 +397,17 @@ class AppPermissionViewModel( deniedState.isChecked = !group.isGranted selectState.isChecked = isPartialStorageGrant(group) allowedState.isChecked = group.isGranted && !isPartialStorageGrant(group) + if (group.foreground.isPolicyFixed || group.foreground.isSystemFixed) { + allowedState.isEnabled = false + selectState.isEnabled = false + deniedState.isEnabled = false + showAdminSupportLiveData.value = admin + val detailId = + getDetailResIdForFixedByPolicyPermissionGroup(group, admin != null) + if (detailId != 0) { + detailResIdLiveData.value = detailId to null + } + } } else { // Allow / Deny case allowedState.isShown = true @@ -656,8 +666,12 @@ class AppPermissionViewModel( fun openPhotoPicker(fragment: Fragment) { val appPermGroup = lightAppPermGroup ?: return - openPhotoPickerForApp(fragment.requireActivity(), appPermGroup.packageInfo.uid, - appPermGroup.foregroundPermNames, 0) + openPhotoPickerForApp( + fragment.requireActivity(), + appPermGroup.packageInfo.uid, + appPermGroup.foregroundPermNames, + 0 + ) } /** |