Add TrafficStats integration

Allow Request subclasses to set their TrafficStats tags. By default,
this is the hostname's hashCode() so that requests to different hosts
have different colors in DDMS.

Change-Id: Ibedf06fdcee108dcd170f5eb70aaecea5647d55d
diff --git a/src/com/android/volley/NetworkDispatcher.java b/src/com/android/volley/NetworkDispatcher.java
index 53fa288..0a82c81 100644
--- a/src/com/android/volley/NetworkDispatcher.java
+++ b/src/com/android/volley/NetworkDispatcher.java
@@ -16,6 +16,8 @@
 
 package com.android.volley;
 
+import android.net.TrafficStats;
+import android.os.Build;
 import android.os.Process;
 
 import java.util.concurrent.BlockingQueue;
@@ -94,6 +96,11 @@
                     continue;
                 }
 
+                // Tag the request (if API >= 14)
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+                    TrafficStats.setThreadStatsTag(request.getTrafficStatsTag());
+                }
+
                 // Perform the network request.
                 NetworkResponse networkResponse = mNetwork.performRequest(request);
                 request.addMarker("network-http-complete");