diff options
author | Arne Schwabe <arne@rfc2549.org> | 2020-09-21 14:27:11 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2020-09-21 14:27:11 +0200 |
commit | 25fabb3af600711aee548d7755a75fee41af50b1 (patch) | |
tree | 98b231262f90ff36a4c13607e0d9387c549644c6 | |
parent | d845eebc680c903e2280edc47b341cbeb095e55c (diff) |
Set OpenVPN metered to false (closes #1227)
See also https://developer.android.com/reference/android/net/VpnService.Builder#setMetered(boolean)
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java index eb88e0cc..8cbed0ac 100644 --- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java +++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java @@ -899,6 +899,11 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac builder.setUnderlyingNetworks(null); } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + // Setting this false, will cause the VPN to inherit the underlying network metered + // value + builder.setMetered(false); + } String session = mProfile.mName; if (mLocalIP != null && mLocalIPv6 != null) |