diff options
author | Nate Myren <ntmyren@google.com> | 2023-11-30 15:21:08 -0800 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-07 21:20:48 +0000 |
commit | 46f1d0498816f8c0a310cfcc5f725208610bf1c1 (patch) | |
tree | e5d677c46eea3791233e52d943b9314a71c4f6e3 /PermissionController/src/com | |
parent | e5acd08c75fc0a18d49c364dd582097294da901b (diff) | |
download | Permission-46f1d0498816f8c0a310cfcc5f725208610bf1c1.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
Relnote: Fix bug in permissions screen
(cherry picked from commit 9cc131d6e180b45de9ac0ef4262194b74b0e3937)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:9e16bf68f649beac055c8c34bcf107dbee108716)
Merged-In: I6c0634ee995d88caeb3ee0a3f66c69b8542c462c
Change-Id: I6c0634ee995d88caeb3ee0a3f66c69b8542c462c
Diffstat (limited to 'PermissionController/src/com')
-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 + ) } /** |