diff options
author | Jordan Jozwiak <jjoz@google.com> | 2022-01-11 19:04:41 -0800 |
---|---|---|
committer | Jordan Jozwiak <jjoz@google.com> | 2022-01-11 19:04:41 -0800 |
commit | c4d052256058846aead65102ea09f8abeb4dddbf (patch) | |
tree | 0f89b58f33fada52470b7b85c9879f7366932fe2 /PermissionController/src/com/android/permissioncontroller/permission/ui/auto/dashboard/AutoPermissionUsageFragment.kt | |
parent | 2c48bf066e94a2834119965b337fab9cd65eef87 (diff) | |
download | Permission-c4d052256058846aead65102ea09f8abeb4dddbf.tar.gz |
Don't filter permission groups by showSystem
After feedback from UX, we're not going to filter the permission groups
that are shown based on whether they are only used by a system app.
Initially the idea was that we wouldn't show groups that are irrelevant,
just as we did with Permission Decluttering, but since the UI here
updates dynamically we decided that it's more confusing in this case.
Also clarify that we're initially not showing last 7 days at this time.
Bug: 193446466
Test: Manual testing
Change-Id: Ic68b1e2e70bbd5c220f51329c9fd283e45a2737c
Diffstat (limited to 'PermissionController/src/com/android/permissioncontroller/permission/ui/auto/dashboard/AutoPermissionUsageFragment.kt')
-rw-r--r-- | PermissionController/src/com/android/permissioncontroller/permission/ui/auto/dashboard/AutoPermissionUsageFragment.kt | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/permission/ui/auto/dashboard/AutoPermissionUsageFragment.kt b/PermissionController/src/com/android/permissioncontroller/permission/ui/auto/dashboard/AutoPermissionUsageFragment.kt index 6484500e1..2351c06ca 100644 --- a/PermissionController/src/com/android/permissioncontroller/permission/ui/auto/dashboard/AutoPermissionUsageFragment.kt +++ b/PermissionController/src/com/android/permissioncontroller/permission/ui/auto/dashboard/AutoPermissionUsageFragment.kt @@ -60,7 +60,9 @@ class AutoPermissionUsageFragment : AutoSettingsFrameFragment(), PermissionsUsag private var permissionGroups: List<PermGroupPackagesUiInfo> = listOf() private var showSystem = false - // TODO(b/193446466) properly support toggle for 24-hour/7day switching + // Auto currently doesn't show last 7 days due to the UX constraint that there is no pattern to + // support multiple actions (showSystem & show7Days). Support will likely be added once this + // pattern is resolved. private val show7Days = false private var finishedInitialLoad = false private var hasSystemApps = false @@ -177,18 +179,21 @@ class AutoPermissionUsageFragment : AutoSettingsFrameFragment(), PermissionsUsag permApps: java.util.ArrayList<PermissionApp> ) { AppDataLoader(context) { + // Show permission groups with permissions granted to an app, including groups + // where the permission is only granted to a system app. This still excludes groups + // that don't have grants from any apps. Showing the same groups regardless of + // whether showSystem is selected avoids permission groups hiding and appearing, + // which is a confusing user experience. + val usedPermissionGroups = permissionGroups + .filter { + (it.nonSystemUserSetOrPreGranted > 0) or + (it.systemUserSetOrPreGranted > 0) + } + .filterNot { it.onlyShellPackageGranted } + for (i in usages.indices) { val (groupName, count) = usages[i] - // Only show permission groups with permissions granted to an app. Only show groups - // that are only granted to system apps if show system apps is enabled. - if ((permissionGroups - .filter { - (it.nonSystemUserSetOrPreGranted > 0) or - (showSystem && it.systemUserSetOrPreGranted > 0) - } - .filterNot { it.onlyShellPackageGranted } - .filter { it.name == groupName }) - .isEmpty()) { + if ((usedPermissionGroups.filter { it.name == groupName }).isEmpty()) { continue } val permissionUsagePreference = CarUiPreference(requireContext()) |