|
|
@ -236,6 +236,11 @@ public class ConnectionHelper {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// VPN: evaluate underlying networks
|
|
|
|
// VPN: evaluate underlying networks
|
|
|
|
|
|
|
|
Integer transport = null;
|
|
|
|
|
|
|
|
if (caps.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR))
|
|
|
|
|
|
|
|
transport = NetworkCapabilities.TRANSPORT_CELLULAR;
|
|
|
|
|
|
|
|
else if (caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI))
|
|
|
|
|
|
|
|
transport = NetworkCapabilities.TRANSPORT_WIFI;
|
|
|
|
|
|
|
|
|
|
|
|
boolean underlying = false;
|
|
|
|
boolean underlying = false;
|
|
|
|
Network[] networks = cm.getAllNetworks();
|
|
|
|
Network[] networks = cm.getAllNetworks();
|
|
|
@ -264,6 +269,14 @@ public class ConnectionHelper {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!caps.hasTransport(NetworkCapabilities.TRANSPORT_VPN) &&
|
|
|
|
|
|
|
|
(caps.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) ||
|
|
|
|
|
|
|
|
caps.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) &&
|
|
|
|
|
|
|
|
(transport != null && !caps.hasTransport(transport))) {
|
|
|
|
|
|
|
|
Log.i("isMetered: underlying other transport");
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)) {
|
|
|
|
if (caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)) {
|
|
|
|
underlying = true;
|
|
|
|
underlying = true;
|
|
|
|
Log.i("isMetered: underlying is connected");
|
|
|
|
Log.i("isMetered: underlying is connected");
|
|
|
|