revert changes to android vpn service

This commit is contained in:
hiddify-com
2024-08-05 13:34:19 +02:00
parent 53aa0e4203
commit fc5aae7e81

View File

@@ -129,13 +129,11 @@ class VPNService : VpnService(), PlatformInterfaceWrapper {
if (Settings.perAppProxyMode == PerAppProxyMode.INCLUDE) {
appList.forEach {
try {
if (it != packageName)
builder.addAllowedApplication(it)
builder.addAllowedApplication(it)
} catch (_: NameNotFoundException) {
}
}
builder.addAllowedApplication(packageName)
} else {
appList.forEach {
try {
@@ -143,38 +141,26 @@ class VPNService : VpnService(), PlatformInterfaceWrapper {
} catch (_: NameNotFoundException) {
}
}
try {
builder.addDisallowedApplication(packageName)
} catch (_: NameNotFoundException) {
}
}
} else {
val includePackage = options.includePackage
if (includePackage.hasNext()) {
while (includePackage.hasNext()) {
try {
val it = includePackage.next()
if (it != packageName)
builder.addAllowedApplication(it)
builder.addAllowedApplication(includePackage.next())
} catch (_: NameNotFoundException) {
}
}
} else {
}
val excludePackage = options.excludePackage
if (excludePackage.hasNext()) {
while (excludePackage.hasNext()) {
try {
builder.addDisallowedApplication(excludePackage.next())
} catch (_: NameNotFoundException) {
}
val excludePackage = options.excludePackage
if (excludePackage.hasNext()) {
while (excludePackage.hasNext()) {
try {
builder.addDisallowedApplication(excludePackage.next())
} catch (_: NameNotFoundException) {
}
}
try {
builder.addDisallowedApplication(packageName)
} catch (_: NameNotFoundException) {
}
}
}
}