From fc5aae7e817e91d7dc6eee88bd381648800a1318 Mon Sep 17 00:00:00 2001 From: hiddify-com <114227601+hiddify-com@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:34:19 +0200 Subject: [PATCH] revert changes to android vpn service --- .../com/hiddify/hiddify/bg/VPNService.kt | 34 ++++++------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/android/app/src/main/kotlin/com/hiddify/hiddify/bg/VPNService.kt b/android/app/src/main/kotlin/com/hiddify/hiddify/bg/VPNService.kt index 2b0dc04a..7830c1e2 100644 --- a/android/app/src/main/kotlin/com/hiddify/hiddify/bg/VPNService.kt +++ b/android/app/src/main/kotlin/com/hiddify/hiddify/bg/VPNService.kt @@ -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) { - } } } }