revert android changes
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
package com.hiddify.hiddify.bg
|
package com.hiddify.hiddify.bg
|
||||||
|
import android.util.Log
|
||||||
|
|
||||||
import com.hiddify.hiddify.Settings
|
import com.hiddify.hiddify.Settings
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
@@ -51,6 +52,25 @@ class VPNService : VpnService(), PlatformInterfaceWrapper {
|
|||||||
|
|
||||||
var systemProxyAvailable = false
|
var systemProxyAvailable = false
|
||||||
var systemProxyEnabled = false
|
var systemProxyEnabled = false
|
||||||
|
fun addIncludePackage(builder: Builder, packageName: String) {
|
||||||
|
if (packageName == this.packageName) {
|
||||||
|
Log.d("VpnService","Cannot include myself: $packageName")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Log.d("VpnService","Including $packageName")
|
||||||
|
builder.addAllowedApplication(packageName)
|
||||||
|
} catch (e: NameNotFoundException) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun addExcludePackage(builder: Builder, packageName: String) {
|
||||||
|
try {
|
||||||
|
Log.d("VpnService","Excluding $packageName")
|
||||||
|
builder.addDisallowedApplication(packageName)
|
||||||
|
} catch (e: NameNotFoundException) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun openTun(options: TunOptions): Int {
|
override fun openTun(options: TunOptions): Int {
|
||||||
if (prepare(this) != null) error("android: missing vpn permission")
|
if (prepare(this) != null) error("android: missing vpn permission")
|
||||||
@@ -128,47 +148,30 @@ class VPNService : VpnService(), PlatformInterfaceWrapper {
|
|||||||
val appList = Settings.perAppProxyList
|
val appList = Settings.perAppProxyList
|
||||||
if (Settings.perAppProxyMode == PerAppProxyMode.INCLUDE) {
|
if (Settings.perAppProxyMode == PerAppProxyMode.INCLUDE) {
|
||||||
appList.forEach {
|
appList.forEach {
|
||||||
try {
|
addIncludePackage(builder,it)
|
||||||
builder.addAllowedApplication(it)
|
|
||||||
} catch (_: NameNotFoundException) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//builder.addAllowedApplication(packageName)
|
addIncludePackage(builder,packageName)
|
||||||
} else {
|
} else {
|
||||||
appList.forEach {
|
appList.forEach {
|
||||||
try {
|
addExcludePackage(builder,it)
|
||||||
builder.addDisallowedApplication(it)
|
|
||||||
} catch (_: NameNotFoundException) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
//builder.addDisallowedApplication(packageName)
|
|
||||||
} catch (_: NameNotFoundException) {
|
|
||||||
}
|
}
|
||||||
|
//addExcludePackage(builder,packageName)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val includePackage = options.includePackage
|
val includePackage = options.includePackage
|
||||||
if (includePackage.hasNext()) {
|
if (includePackage.hasNext()) {
|
||||||
while (includePackage.hasNext()) {
|
while (includePackage.hasNext()) {
|
||||||
try {
|
addIncludePackage(builder,includePackage.next())
|
||||||
builder.addAllowedApplication(includePackage.next())
|
|
||||||
} catch (_: NameNotFoundException) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val excludePackage = options.excludePackage
|
val excludePackage = options.excludePackage
|
||||||
if (excludePackage.hasNext()) {
|
if (excludePackage.hasNext()) {
|
||||||
while (excludePackage.hasNext()) {
|
while (excludePackage.hasNext()) {
|
||||||
try {
|
addExcludePackage(builder,excludePackage.next())
|
||||||
builder.addDisallowedApplication(excludePackage.next())
|
|
||||||
} catch (_: NameNotFoundException) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
//addExcludePackage(builder,packageName)
|
||||||
//builder.addDisallowedApplication(packageName)
|
|
||||||
} catch (_: NameNotFoundException) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
libcore
2
libcore
Submodule libcore updated: e4510270f3...51ae4a6a4d
Reference in New Issue
Block a user