Ignore system proxy settings before Android 10

This commit is contained in:
世界
2023-12-25 18:12:41 +08:00
parent 4892c54313
commit 76eb0988f3

View File

@@ -163,19 +163,14 @@ class VPNService : VpnService(), PlatformInterfaceWrapper {
} }
} }
if (options.isHTTPProxyEnabled) { if (options.isHTTPProxyEnabled && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
systemProxyAvailable = true systemProxyAvailable = true
systemProxyEnabled = Settings.systemProxyEnabled systemProxyEnabled = Settings.systemProxyEnabled
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (systemProxyEnabled) builder.setHttpProxy(
if (systemProxyEnabled) builder.setHttpProxy( ProxyInfo.buildDirectProxy(
ProxyInfo.buildDirectProxy( options.httpProxyServer, options.httpProxyServerPort
options.httpProxyServer,
options.httpProxyServerPort
)
) )
} else { )
error("android: tun.platform.http_proxy requires android 10 or higher")
}
} else { } else {
systemProxyAvailable = false systemProxyAvailable = false
systemProxyEnabled = false systemProxyEnabled = false