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. --- .../privacymodules/permissions/APermissionsPrivacyModule.kt | 8 ++++++-- .../privacymodules/permissions/IPermissionsPrivacyModule.kt | 13 ++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'privacymodule-api/src') diff --git a/privacymodule-api/src/main/java/foundation/e/privacymodules/permissions/APermissionsPrivacyModule.kt b/privacymodule-api/src/main/java/foundation/e/privacymodules/permissions/APermissionsPrivacyModule.kt index 9d7e675..d0e2e75 100644 --- a/privacymodule-api/src/main/java/foundation/e/privacymodules/permissions/APermissionsPrivacyModule.kt +++ b/privacymodule-api/src/main/java/foundation/e/privacymodules/permissions/APermissionsPrivacyModule.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 E FOUNDATION + * Copyright (C) 2021 E FOUNDATION, 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 @@ -150,7 +150,7 @@ abstract class APermissionsPrivacyModule(protected val context: Context) : IPerm packageName = appInfo.packageName, uid = appInfo.uid, label = getAppLabel(appInfo), - icon = if (withIcon) getApplicationIcon(appInfo.packageName) else null + icon = if (withIcon) getApplicationIcon(appInfo) else null ) } @@ -158,6 +158,10 @@ abstract class APermissionsPrivacyModule(protected val context: Context) : IPerm return context.packageManager.getApplicationLabel(appInfo) } + private fun getApplicationIcon(appInfo: ApplicationInfo): Drawable? { + return context.packageManager.getApplicationIcon(appInfo) + } + override fun getApplicationIcon(packageName: String): Drawable? { return context.packageManager.getApplicationIcon(packageName) } diff --git a/privacymodule-api/src/main/java/foundation/e/privacymodules/permissions/IPermissionsPrivacyModule.kt b/privacymodule-api/src/main/java/foundation/e/privacymodules/permissions/IPermissionsPrivacyModule.kt index ff0b3d7..b64762f 100644 --- a/privacymodule-api/src/main/java/foundation/e/privacymodules/permissions/IPermissionsPrivacyModule.kt +++ b/privacymodule-api/src/main/java/foundation/e/privacymodules/permissions/IPermissionsPrivacyModule.kt @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 E FOUNDATION + * Copyright (C) 2021 E FOUNDATION, 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,7 @@ package foundation.e.privacymodules.permissions import android.app.NotificationChannel import android.content.pm.ApplicationInfo +import android.content.pm.PackageInfo import android.graphics.drawable.Drawable import foundation.e.privacymodules.permissions.data.AppOpModes import foundation.e.privacymodules.permissions.data.ApplicationDescription @@ -34,6 +35,16 @@ interface IPermissionsPrivacyModule { withIcon: Boolean = true ): ApplicationDescription + fun getApplications( + filter: ((PackageInfo) -> Boolean)?, + withIcon: Boolean + ): List + + fun getWorkProfileApplications( + filter: ((PackageInfo) -> Boolean)?, + withIcon: Boolean + ): List + /** * List the installed application on the device which have not the FLAGS_SYSTEM. * @return list of filled up [ApplicationDescription] -- cgit v1.2.1