Commit 558a39ec authored by Max Lv's avatar Max Lv

refine per-app VPN

parent 5f95cccc
......@@ -132,25 +132,25 @@ class ShadowsocksVpnService extends VpnService with BaseService {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
builder.allowFamily(AF_INET6)
if (config.isBypassApps) {
builder.addDisallowedApplication(this.getPackageName)
}
if (!config.isGlobalProxy) {
val apps = AppManager.getProxiedApps(this, config.proxiedAppString)
val uidSet: mutable.HashSet[String] = new mutable.HashSet[String]
val pkgSet: mutable.HashSet[String] = new mutable.HashSet[String]
for (app <- apps) {
if (app.proxied) {
uidSet.add(app.name)
pkgSet.add(app.name)
}
}
for (uid <- uidSet) {
for (pkg <- pkgSet) {
if (!config.isBypassApps) {
builder.addAllowedApplication(uid)
builder.addAllowedApplication(pkg)
} else {
builder.addDisallowedApplication(uid)
builder.addDisallowedApplication(pkg)
}
}
if (!config.isBypassApps) {
builder.addAllowedApplication(this.getPackageName)
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment