diff options
| author | Jeff Sharkey <jsharkey@android.com> | 2013-06-04 12:29:00 -0700 |
|---|---|---|
| committer | Jeff Sharkey <jsharkey@android.com> | 2013-06-06 14:35:34 -0700 |
| commit | 7a1c3fce478122b9f03464117dc94d44f7c1995e (patch) | |
| tree | e7496e9b8041c361eb9201d139e05f9c00975796 /core/java/android/net/ConnectivityManager.java | |
| parent | 34bff87b32a10f6267e76a7de0b287eb6a4633f9 (diff) | |
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
Diffstat (limited to 'core/java/android/net/ConnectivityManager.java')
| -rw-r--r-- | core/java/android/net/ConnectivityManager.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 78bf9afcbb40..ffcc2974cd0d 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -464,6 +464,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 * than one type available the preferred network type will be used. * Note that this made sense when we only had 2 network types, |
