fix: loop in android
This commit is contained in:
@@ -129,11 +129,13 @@ class VPNService : VpnService(), PlatformInterfaceWrapper {
|
||||
if (Settings.perAppProxyMode == PerAppProxyMode.INCLUDE) {
|
||||
appList.forEach {
|
||||
try {
|
||||
if (it != packageName)
|
||||
builder.addAllowedApplication(it)
|
||||
} catch (_: NameNotFoundException) {
|
||||
}
|
||||
}
|
||||
builder.addAllowedApplication(packageName)
|
||||
|
||||
|
||||
} else {
|
||||
appList.forEach {
|
||||
try {
|
||||
@@ -141,17 +143,24 @@ class VPNService : VpnService(), PlatformInterfaceWrapper {
|
||||
} catch (_: NameNotFoundException) {
|
||||
}
|
||||
}
|
||||
try {
|
||||
builder.addDisallowedApplication(packageName)
|
||||
} catch (_: NameNotFoundException) {
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
val includePackage = options.includePackage
|
||||
if (includePackage.hasNext()) {
|
||||
while (includePackage.hasNext()) {
|
||||
try {
|
||||
builder.addAllowedApplication(includePackage.next())
|
||||
val it = includePackage.next()
|
||||
if (it != packageName)
|
||||
builder.addAllowedApplication(it)
|
||||
} catch (_: NameNotFoundException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
val excludePackage = options.excludePackage
|
||||
if (excludePackage.hasNext()) {
|
||||
@@ -162,6 +171,11 @@ class VPNService : VpnService(), PlatformInterfaceWrapper {
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
builder.addDisallowedApplication(packageName)
|
||||
} catch (_: NameNotFoundException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user