Accumulate network statistics based on deltas.
Network stats are now read out of the kernel in one sweep, instead of reading per-UID. We now accumulate the delta traffic between each stats snapshot using the well-tested SamplingCounter pattern. Since Wi-Fi and mobile traffic have different costs, track each separately. Avoids counting misc interfaces like loopback and ethernet under total. Bug: 5543387 Change-Id: I642004dc530113c27ef79f2abbae51d8af30117f
This commit is contained in:
@@ -463,6 +463,21 @@ public class ConnectivityManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the given network type is backed by a Wi-Fi radio.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static boolean isNetworkTypeWifi(int networkType) {
|
||||||
|
switch (networkType) {
|
||||||
|
case TYPE_WIFI:
|
||||||
|
case TYPE_WIFI_P2P:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the preferred network type. When the device has more
|
* Specifies the preferred network type. When the device has more
|
||||||
* than one type available the preferred network type will be used.
|
* than one type available the preferred network type will be used.
|
||||||
|
|||||||
Reference in New Issue
Block a user