Sometimes it is just simple

This commit is contained in:
M66B 2018-12-09 19:09:06 +01:00
parent ea895040f5
commit 542376d0be
1 changed files with 7 additions and 0 deletions

View File

@ -310,6 +310,11 @@ public class Helper {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.M)
return cm.isActiveNetworkMetered();
if (!cm.isActiveNetworkMetered()) {
Log.i(Helper.TAG, "isMetered: active network is unmetered");
return false;
}
Network active = cm.getActiveNetwork();
if (active == null) {
Log.i(Helper.TAG, "isMetered: no active network");
@ -372,6 +377,8 @@ public class Helper {
}
if (caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)) {
Log.i(Helper.TAG, "isMetered: underlying caps=" + caps);
if (ni.isConnected()) {
connected = true;
Log.i(Helper.TAG, "isMetered: underlying is connected");