diff options
| author | Jeff Sharkey <jsharkey@android.com> | 2017-01-19 11:55:54 -0700 |
|---|---|---|
| committer | Jeff Sharkey <jsharkey@android.com> | 2017-01-19 20:52:05 -0700 |
| commit | 619a511d4f5b5cc74b9a8ab853db386489e02e6f (patch) | |
| tree | 593636cd2498365ef73f092c3819016f9f87f36b /core/java/android/net/SntpClient.java | |
| parent | 063c454b07f7d4079731c60cff1ba4bf97d1f7ef (diff) | |
StrictMode to detect untagged network traffic.
Network usage is tracked by the kernel at the UID level, which is
granular enough for normal apps, but large components (such as the
system server) are impossible to debug without adding additional
socket tagging to help identify subsystems within a UID.
To help ensure that system components tag all their network traffic,
this change offers a new StrictMode option to detect and report
untagged sockets.
Test: builds, boots, all common traffic tagged
Bug: 30943431, 30414041
Change-Id: I825c7941076054732264690247de2863342638e2
Diffstat (limited to 'core/java/android/net/SntpClient.java')
| -rw-r--r-- | core/java/android/net/SntpClient.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/core/java/android/net/SntpClient.java b/core/java/android/net/SntpClient.java index cea56b53d763..ffc735c93aef 100644 --- a/core/java/android/net/SntpClient.java +++ b/core/java/android/net/SntpClient.java @@ -96,6 +96,7 @@ public class SntpClient { public boolean requestTime(InetAddress address, int port, int timeout) { DatagramSocket socket = null; + final int oldTag = TrafficStats.getAndSetThreadStatsTag(TrafficStats.TAG_SYSTEM_NTP); try { socket = new DatagramSocket(); socket.setSoTimeout(timeout); @@ -161,6 +162,7 @@ public class SntpClient { if (socket != null) { socket.close(); } + TrafficStats.setThreadStatsTag(oldTag); } return true; |
