diff options
author | Jeff Sharkey <jsharkey@android.com> | 2011-06-28 18:02:12 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-28 18:02:12 -0700 |
commit | 8994730fe39570c7807561de38407a8b22230e8a (patch) | |
tree | 0154a39d8c1b08efb8d5291b8ff940cee9997e4c /core/java/android/net/TrafficStats.java | |
parent | eb8283d4b3eda3e1b9e670e0de615ac7605208e3 (diff) | |
parent | 4414cea13908b8230640f84ef39603d68ff9c377 (diff) | |
download | frameworks_base-8994730fe39570c7807561de38407a8b22230e8a.zip frameworks_base-8994730fe39570c7807561de38407a8b22230e8a.tar.gz frameworks_base-8994730fe39570c7807561de38407a8b22230e8a.tar.bz2 |
Merge "Better network stats parsing, integer tags, async."
Diffstat (limited to 'core/java/android/net/TrafficStats.java')
-rw-r--r-- | core/java/android/net/TrafficStats.java | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/core/java/android/net/TrafficStats.java b/core/java/android/net/TrafficStats.java index cb47193..040489e 100644 --- a/core/java/android/net/TrafficStats.java +++ b/core/java/android/net/TrafficStats.java @@ -16,7 +16,10 @@ package android.net; +import android.app.DownloadManager; +import android.app.backup.BackupManager; import android.content.Context; +import android.media.MediaPlayer; import android.os.IBinder; import android.os.INetworkManagementService; import android.os.RemoteException; @@ -50,6 +53,27 @@ public class TrafficStats { public static final int UID_REMOVED = -4; /** + * Default tag value for {@link DownloadManager} traffic. + * + * @hide + */ + public static final int TAG_SYSTEM_DOWNLOAD = 0xFFFF0001; + + /** + * Default tag value for {@link MediaPlayer} traffic. + * + * @hide + */ + public static final int TAG_SYSTEM_MEDIA = 0xFFFF0002; + + /** + * Default tag value for {@link BackupManager} traffic. + * + * @hide + */ + public static final int TAG_SYSTEM_BACKUP = 0xFFFF0003; + + /** * Snapshot of {@link NetworkStats} when the currently active profiling * session started, or {@code null} if no session active. * @@ -67,12 +91,20 @@ public class TrafficStats { * Changes only take effect during subsequent calls to * {@link #tagSocket(Socket)}. */ - public static void setThreadStatsTag(String tag) { + public static void setThreadStatsTag(int tag) { BlockGuard.setThreadSocketStatsTag(tag); } + /** + * @deprecated unsupported, will eventually be removed + */ + @Deprecated + public static void setThreadStatsTag(String tag) { + setThreadStatsTag(tag.hashCode()); + } + public static void clearThreadStatsTag() { - BlockGuard.setThreadSocketStatsTag(null); + BlockGuard.setThreadSocketStatsTag(-1); } /** @@ -103,7 +135,7 @@ public class TrafficStats { * parameters. When finished, call {@link #untagSocket(Socket)} to remove * statistics parameters. * - * @see #setThreadStatsTag(String) + * @see #setThreadStatsTag(int) * @see #setThreadStatsUid(int) */ public static void tagSocket(Socket socket) throws SocketException { |