From 709e40027d92f988d9e19cf1d05cdf99cc981013 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Sun, 12 Jun 2011 21:13:51 -0700 Subject: [PATCH] External mutation of full NetworkPolicy set. Instead of embedding complex template coexistence rules into policy service, rely on external editors to enforce, and offer atomic get/set operations for full policy sets. Generate default mobile policy when none exists, using default of 4GB warning and cycle reset of current day. Dispatch listener events through Handler when holding internal lock, and catch CLASS_UNKNOWN networks in 3G_LOWER template. Change-Id: I063cf1eaf330e32b75d0697b89fc04488e6dfaea --- core/java/android/net/TrafficStats.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/core/java/android/net/TrafficStats.java b/core/java/android/net/TrafficStats.java index 8a688d55f7..3725fa64eb 100644 --- a/core/java/android/net/TrafficStats.java +++ b/core/java/android/net/TrafficStats.java @@ -41,11 +41,9 @@ public class TrafficStats { */ public final static int UNSUPPORTED = -1; - // TODO: find better home for these template constants - /** * Template to combine all {@link ConnectivityManager#TYPE_MOBILE} style - * networks together. Only uses statistics for currently active IMSI. + * networks together. Only uses statistics for requested IMSI. * * @hide */ @@ -54,7 +52,7 @@ public class TrafficStats { /** * Template to combine all {@link ConnectivityManager#TYPE_MOBILE} style * networks together that roughly meet a "3G" definition, or lower. Only - * uses statistics for currently active IMSI. + * uses statistics for requested IMSI. * * @hide */ @@ -63,7 +61,7 @@ public class TrafficStats { /** * Template to combine all {@link ConnectivityManager#TYPE_MOBILE} style * networks together that meet a "4G" definition. Only uses statistics for - * currently active IMSI. + * requested IMSI. * * @hide */ @@ -184,6 +182,17 @@ public class TrafficStats { } } + /** {@hide} */ + public static boolean isNetworkTemplateMobile(int networkTemplate) { + switch (networkTemplate) { + case TEMPLATE_MOBILE_3G_LOWER: + case TEMPLATE_MOBILE_4G: + case TEMPLATE_MOBILE_ALL: + return true; + } + return false; + } + /** * Get the total number of packets transmitted through the mobile interface. *