summaryrefslogtreecommitdiff
path: root/PermissionController/src/com/android/permissioncontroller/permission/service
diff options
context:
space:
mode:
authorKarishma Vakil <kvakil@google.com>2023-04-26 05:51:02 +0000
committerKarishma Vakil <kvakil@google.com>2023-05-05 00:00:58 +0000
commitf6a57699d42e2a5cbc3b532b91181cefa79d246e (patch)
treeb50695cc4c82173d2bd305bdd3d86c5db002ddc1 /PermissionController/src/com/android/permissioncontroller/permission/service
parentddb094c54794973d4ec42a406956c77df7335df3 (diff)
downloadPermission-f6a57699d42e2a5cbc3b532b91181cefa79d246e.tar.gz
[Safety Labels] Enable safety labels features for preloaded apps
This CL includes preloaded apps' safety labels to be displayed in the UI, if they have provided safety labels. Earlier, they were filtered out as only store-installed apps' safety labels were surfaced in the UI. Bug: 261607291 Test: atest CtsPermission3TestCases Test: atest PermissionControllerMockingTests:LightInstallSourceInfoTest Change-Id: I6ac5336fcc5441c31e38172fab29189be1761416
Diffstat (limited to 'PermissionController/src/com/android/permissioncontroller/permission/service')
-rw-r--r--PermissionController/src/com/android/permissioncontroller/permission/service/v34/SafetyLabelChangesJobService.kt10
1 files changed, 4 insertions, 6 deletions
diff --git a/PermissionController/src/com/android/permissioncontroller/permission/service/v34/SafetyLabelChangesJobService.kt b/PermissionController/src/com/android/permissioncontroller/permission/service/v34/SafetyLabelChangesJobService.kt
index 17c59a19a..be255809b 100644
--- a/PermissionController/src/com/android/permissioncontroller/permission/service/v34/SafetyLabelChangesJobService.kt
+++ b/PermissionController/src/com/android/permissioncontroller/permission/service/v34/SafetyLabelChangesJobService.kt
@@ -420,7 +420,7 @@ class SafetyLabelChangesJobService : JobService() {
private suspend fun getAllStoreInstalledPackagesRequestingLocation():
Set<Pair<String, UserHandle>> =
getAllPackagesRequestingLocation()
- .filter { isStoreInstalledPackage(it) }
+ .filter { isSafetyLabelSupported(it) }
.toSet()
private suspend fun getAllPackagesRequestingLocation(): Set<Pair<String, UserHandle>> =
@@ -437,12 +437,10 @@ class SafetyLabelChangesJobService : JobService() {
private fun AppPermGroupUiInfo.isPermissionGranted() =
permGrantState in setOf(PERMS_ALLOWED_ALWAYS, PERMS_ALLOWED_FOREGROUND_ONLY)
- private suspend fun isStoreInstalledPackage(
- pkg: Pair<String, UserHandle>
- ): Boolean {
+ private suspend fun isSafetyLabelSupported(packageUser: Pair<String, UserHandle>): Boolean {
val lightInstallSourceInfo =
- LightInstallSourceInfoLiveData[pkg].getInitializedValue()
- return lightInstallSourceInfo.isStoreInstalled()
+ LightInstallSourceInfoLiveData[packageUser].getInitializedValue()
+ return lightInstallSourceInfo.supportsSafetyLabel
}
private suspend fun postSafetyLabelChangedNotification() {