Add tagging variants for DatagramSocket.
Oops, we missed these along the way.
Bug: 25799174
Change-Id: I4ad368f9faee4b1996d605534dce4c2b23dbe200
diff --git a/core/java/android/net/TrafficStats.java b/core/java/android/net/TrafficStats.java
index 2137c3a..e82485d 100644
--- a/core/java/android/net/TrafficStats.java
+++ b/core/java/android/net/TrafficStats.java
@@ -28,6 +28,7 @@
import dalvik.system.SocketTagger;
+import java.net.DatagramSocket;
import java.net.Socket;
import java.net.SocketException;
@@ -226,6 +227,27 @@
}
/**
+ * Tag the given {@link DatagramSocket} with any statistics parameters
+ * active for the current thread. Subsequent calls always replace any
+ * existing parameters. When finished, call
+ * {@link #untagDatagramSocket(DatagramSocket)} to remove statistics
+ * parameters.
+ *
+ * @see #setThreadStatsTag(int)
+ * @see #setThreadStatsUid(int)
+ */
+ public static void tagDatagramSocket(DatagramSocket socket) throws SocketException {
+ SocketTagger.get().tag(socket);
+ }
+
+ /**
+ * Remove any statistics parameters from the given {@link DatagramSocket}.
+ */
+ public static void untagDatagramSocket(DatagramSocket socket) throws SocketException {
+ SocketTagger.get().untag(socket);
+ }
+
+ /**
* Start profiling data usage for current UID. Only one profiling session
* can be active at a time.
*