Check for underlying network

pull/147/head
M66B 6 years ago
parent b1039f1ba5
commit f88c0e44c2

@ -354,8 +354,7 @@ public class Helper {
if (caps == null) {
if (log)
EntityLog.log(context, "isMetered: active no caps");
// Assume metered
return true;
return null; // network unknown
}
if (log)
@ -370,6 +369,7 @@ public class Helper {
// VPN: evaluate underlying networks
boolean underlying = false;
Network[] networks = cm.getAllNetworks();
if (networks != null)
for (Network network : networks) {
@ -381,13 +381,15 @@ public class Helper {
if (caps == null) {
if (log)
EntityLog.log(context, "isMetered: no underlying caps");
continue;
continue; // network unknown
}
if (log)
Log.i(Helper.TAG, "isMetered: underlying caps=" + caps);
if (caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)) {
underlying = true;
if (log)
Log.i(Helper.TAG, "isMetered: underlying caps=" + caps);
@ -407,6 +409,11 @@ public class Helper {
}
}
if (!underlying) {
EntityLog.log(context, "isMetered: no underlying network");
return null;
}
if (log)
EntityLog.log(context, "isMetered: underlying assume metered");
// Assume metered

Loading…
Cancel
Save