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