summaryrefslogtreecommitdiff
path: root/permissionsstandalone/src
diff options
context:
space:
mode:
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.