mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-21 21:57:19 +00:00
Check for underlying network
This commit is contained in:
parent
b1039f1ba5
commit
f88c0e44c2
1 changed files with 10 additions and 3 deletions
|
@ -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…
Reference in a new issue