From 50caba660663b489b05f32b2795516b6e00e91de Mon Sep 17 00:00:00 2001 From: Michael Zh Date: Wed, 23 Jul 2025 18:41:20 -0400 Subject: [PATCH] Fix compile Co-Authored-By: Isira Seneviratne <31027858+Isira-Seneviratne@users.noreply.github.com> --- .../player/mediabrowser/PackageValidator.kt | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/mediabrowser/PackageValidator.kt b/app/src/main/java/org/schabi/newpipe/player/mediabrowser/PackageValidator.kt index 436bcc43d..05719b6d4 100644 --- a/app/src/main/java/org/schabi/newpipe/player/mediabrowser/PackageValidator.kt +++ b/app/src/main/java/org/schabi/newpipe/player/mediabrowser/PackageValidator.kt @@ -151,16 +151,11 @@ internal class PackageValidator(context: Context) { val uid = packageInfo.applicationInfo?.uid ?: -1 val signature = getSignature(packageInfo) - val requestedPermissions = packageInfo.requestedPermissions - val permissionFlags = packageInfo.requestedPermissionsFlags - val activePermissions = mutableSetOf() - if (permissionFlags != null) { - requestedPermissions?.forEachIndexed { index, permission -> - if (permissionFlags[index] and REQUESTED_PERMISSION_GRANTED != 0) { - activePermissions += permission - } - } - } + val requestedPermissions = packageInfo.requestedPermissions?.asSequence().orEmpty() + val permissionFlags = packageInfo.requestedPermissionsFlags?.asSequence().orEmpty() + val activePermissions = (requestedPermissions zip permissionFlags) + .filter { (permission, flag) -> flag and REQUESTED_PERMISSION_GRANTED != 0 } + .mapTo(mutableSetOf()) { (permission, flag) -> permission } return CallerPackageInfo(appName, callingPackage, uid, signature, activePermissions.toSet()) }