mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-20 21:27:07 +00:00
Auto detect standalone VPN
This commit is contained in:
parent
bb9900e1e8
commit
9872700c56
1 changed files with 8 additions and 1 deletions
|
@ -336,6 +336,14 @@ public class ConnectionHelper {
|
|||
return metered;
|
||||
}
|
||||
|
||||
Network[] networks = cm.getAllNetworks();
|
||||
if (networks != null && networks.length == 1) {
|
||||
// Standalone VPN
|
||||
boolean metered = cm.isActiveNetworkMetered();
|
||||
Log.i("isMetered: active VPN metered=" + metered);
|
||||
return metered;
|
||||
}
|
||||
|
||||
// VPN: evaluate underlying networks
|
||||
Integer transport = null;
|
||||
if (caps.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR))
|
||||
|
@ -344,7 +352,6 @@ public class ConnectionHelper {
|
|||
transport = NetworkCapabilities.TRANSPORT_WIFI;
|
||||
|
||||
boolean underlying = false;
|
||||
Network[] networks = cm.getAllNetworks();
|
||||
for (Network network : networks) {
|
||||
caps = cm.getNetworkCapabilities(network);
|
||||
if (caps == null) {
|
||||
|
|
Loading…
Reference in a new issue