From f1d5b12dd11019508208571db5e5f57f43e3c4b6 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquart Date: Mon, 2 Jan 2023 08:35:20 +0000 Subject: 5648: display trackers for pro-profile app instances. --- .../permissions/PermissionsPrivacyModule.kt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'permissionsstandalone') 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 { + 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 { + return emptyList() + } + /** * @see IPermissionsPrivacyModule.toggleDangerousPermission * Return an ManualAction to go toggle manually the permission in the ap page of the settings. -- cgit v1.2.1