diff options
author | Jeff Sharkey <jsharkey@android.com> | 2011-05-17 14:55:15 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2011-05-21 15:02:58 -0700 |
commit | eedcb9525ba5befee2ba6ebb7a9ee3f13395c2a3 (patch) | |
tree | 2753882abd3cd277dce4c30a1d6a59172f2c6f46 /core/java/android/net/NetworkPolicyManager.java | |
parent | 850ae9acda0d062f9a1836d159bdce819e0f8066 (diff) | |
download | frameworks_base-eedcb9525ba5befee2ba6ebb7a9ee3f13395c2a3.zip frameworks_base-eedcb9525ba5befee2ba6ebb7a9ee3f13395c2a3.tar.gz frameworks_base-eedcb9525ba5befee2ba6ebb7a9ee3f13395c2a3.tar.bz2 |
APIs to profile network usage for current UID.
Added startDataProfiling() and stopDataProfiling() to TrafficStats,
which can be used by apps to measure network usage delta between two
points in time. Currently takes two NetworkStats snapshots and returns
delta, which will eventually include tag-level granularity. Added
tests for NetworkStats delta subtraction.
Added NMS.getNetworkStatsUidDetail() that returns stats for specific
UID. Always gives stats access for the calling UID, otherwise enforces
that caller has permission. Fix readSingleLongFromFile(), since
/proc/ files don't have well-defined lengths.
Change-Id: Ic5b6414d8effbd66846e275b00d4b8a82c74589d
Diffstat (limited to 'core/java/android/net/NetworkPolicyManager.java')
-rw-r--r-- | core/java/android/net/NetworkPolicyManager.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/java/android/net/NetworkPolicyManager.java b/core/java/android/net/NetworkPolicyManager.java index 2312bd9..1913aa7 100644 --- a/core/java/android/net/NetworkPolicyManager.java +++ b/core/java/android/net/NetworkPolicyManager.java @@ -16,6 +16,7 @@ package android.net; +import android.content.Context; import android.os.RemoteException; /** @@ -43,6 +44,10 @@ public class NetworkPolicyManager { mService = service; } + public static NetworkPolicyManager getSystemService(Context context) { + return (NetworkPolicyManager) context.getSystemService(Context.NETWORK_POLICY_SERVICE); + } + /** * Set policy flags for specific UID. * |