1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-30 19:56:10 +00:00

Workaround invalid not metered indication

This commit is contained in:
M66B 2019-10-22 10:37:21 +02:00
parent 417ca4cb2a
commit b9e5a52f20

View file

@ -197,9 +197,10 @@ public class ConnectionHelper {
}
if (caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)) {
boolean unmetered = caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
Log.i("isMetered: active not VPN unmetered=" + unmetered);
return !unmetered;
// NET_CAPABILITY_NOT_METERED is unreliable on older Android versions
boolean metered = cm.isActiveNetworkMetered();
Log.i("isMetered: active not VPN metered=" + metered);
return metered;
}
// VPN: evaluate underlying networks