diff options
Diffstat (limited to 'privacymodule-api/src/main/java/foundation')
2 files changed, 18 insertions, 3 deletions
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<ApplicationDescription> + + fun getWorkProfileApplications( + filter: ((PackageInfo) -> Boolean)?, + withIcon: Boolean + ): List<ApplicationDescription> + /** * List the installed application on the device which have not the FLAGS_SYSTEM. * @return list of filled up [ApplicationDescription] |