Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Remove no internet permission restrictions when apps are selected
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust authored and AnGgIt86 committed Sep 26, 2024
1 parent f92cd13 commit 5fef5a3
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions app/src/main/kotlin/com/neko/v2ray/util/AppManagerUtil.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package com.neko.v2ray.util

import android.Manifest
import android.content.Context
import android.content.pm.ApplicationInfo
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import com.neko.v2ray.dto.AppInfo
import io.reactivex.rxjava3.core.Observable

object AppManagerUtil {
fun loadNetworkAppList(ctx: Context): ArrayList<AppInfo> {
private fun loadNetworkAppList(ctx: Context): ArrayList<AppInfo> {
val packageManager = ctx.packageManager
val packages = packageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS)
val apps = ArrayList<AppInfo>()

for (pkg in packages) {
if (!pkg.hasInternetPermission && pkg.packageName != "android") continue
//if (!pkg.hasInternetPermission && pkg.packageName != "android") continue

val applicationInfo = pkg.applicationInfo

Expand All @@ -35,9 +33,9 @@ object AppManagerUtil {
it.onNext(loadNetworkAppList(ctx))
}

val PackageInfo.hasInternetPermission: Boolean
get() {
val permissions = requestedPermissions
return permissions?.any { it == Manifest.permission.INTERNET } ?: false
}
// val PackageInfo.hasInternetPermission: Boolean
// get() {
// val permissions = requestedPermissions
// return permissions?.any { it == Manifest.permission.INTERNET } ?: false
// }
}

0 comments on commit 5fef5a3

Please sign in to comment.