summaryrefslogtreecommitdiff
path: root/permissionsstandalone/src
diff options
context:
space:
mode:
authorGuillaume Jacquart <guillaume.jacquart@hoodbrains.com>2023-01-02 08:35:21 +0000
committerGuillaume Jacquart <guillaume.jacquart@hoodbrains.com>2023-01-02 08:35:21 +0000
commitf1e0961daf535628252f18c06fe22001f84015b5 (patch)
tree78a37bc4da310662f44c4e6c362c0d58de2cc2e6 /permissionsstandalone/src
parent7333a0d80ef3fb879fb6d261988deb78b4857393 (diff)
parentf1d5b12dd11019508208571db5e5f57f43e3c4b6 (diff)
Merge branch '5648-apps_pro_profile' into 'main'
5648: display trackers for pro-profile app instances. See merge request e/os/advanced-privacy!100
Diffstat (limited to 'permissionsstandalone/src')
-rw-r--r--permissionsstandalone/src/main/java/foundation/e/privacymodules/permissions/PermissionsPrivacyModule.kt20
1 files changed, 19 insertions, 1 deletions
diff --git a/permissionsstandalone/src/main/java/foundation/e/privacymodules/permissions/PermissionsPrivacyModule.kt b/permissionsstandalone/src/main/java/foundation/e/privacymodules/permissions/PermissionsPrivacyModule.kt
index 52dfd08..da7c73e 100644
--- a/permissionsstandalone/src/main/java/foundation/e/privacymodules/permissions/PermissionsPrivacyModule.kt
+++ b/permissionsstandalone/src/main/java/foundation/e/privacymodules/permissions/PermissionsPrivacyModule.kt
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 E FOUNDATION
+ * Copyright (C) 2022 MURENA SAS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,6 +19,8 @@ package foundation.e.privacymodules.permissions
import android.app.NotificationChannel
import android.content.Context
+import android.content.pm.PackageInfo
+import android.content.pm.PackageManager
import foundation.e.privacymodules.permissions.data.AppOpModes
import foundation.e.privacymodules.permissions.data.ApplicationDescription
@@ -26,6 +28,22 @@ import foundation.e.privacymodules.permissions.data.ApplicationDescription
* Implements [IPermissionsPrivacyModule] using only API authorized on the PlayStore.
*/
class PermissionsPrivacyModule(context: Context) : APermissionsPrivacyModule(context) {
+ override fun getApplications(
+ filter: ((PackageInfo) -> Boolean)?,
+ withIcon: Boolean
+ ): List<ApplicationDescription> {
+ return context.packageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS)
+ .filter { filter?.invoke(it) == true }
+ .map { buildApplicationDescription(it.applicationInfo, withIcon = withIcon) }
+ }
+
+ override fun getWorkProfileApplications(
+ filter: ((PackageInfo) -> Boolean)?,
+ withIcon: Boolean
+ ): List<ApplicationDescription> {
+ return emptyList()
+ }
+
/**
* @see IPermissionsPrivacyModule.toggleDangerousPermission
* Return an ManualAction to go toggle manually the permission in the ap page of the settings.