Skip to content

Commit a148a7a

Browse files
author
freeinternet865
committed
fix(android): keep empty ONLY split lists self-excluded
When ONLY mode contains only this app or stale packages, no allowed application is successfully added. Android then treats the VPN as applying to every app, which can route more traffic than requested and can also include our own proxy traffic in the TUN path. Count successful addAllowedApplication calls and fall back to the existing ALL-mode self-exclusion behavior when none are usable.
1 parent d73639a commit a148a7a

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎android/app/src/main/java/com/therealaleph/mhrv/MhrvVpnService.kt‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,22 @@ class MhrvVpnService : VpnService() {
191191
builder.addDisallowedApplication(packageName)
192192
} catch (_: Throwable) {}
193193
} else {
194+
var allowed = 0
194195
for (pkg in cfg.splitApps) {
195196
if (pkg == packageName) continue // can't tunnel ourselves
196-
try { builder.addAllowedApplication(pkg) } catch (e: Throwable) {
197+
try {
198+
builder.addAllowedApplication(pkg)
199+
allowed++
200+
} catch (e: Throwable) {
197201
Log.w(TAG, "addAllowedApplication($pkg) failed: ${e.message}")
198202
}
199203
}
204+
if (allowed == 0) {
205+
Log.w(TAG, "ONLY mode had no usable apps — falling back to ALL")
206+
try {
207+
builder.addDisallowedApplication(packageName)
208+
} catch (_: Throwable) {}
209+
}
200210
}
201211
}
202212
SplitMode.EXCEPT -> {

0 commit comments

Comments
 (0)