summaryrefslogtreecommitdiffstats
path: root/core/java/android/net
diff options
context:
space:
mode:
authorZoltan Szatmary-Ban <szatmz@google.com>2015-02-23 17:20:20 +0000
committerZoltan Szatmary-Ban <szatmz@google.com>2015-03-25 15:53:38 +0000
commit9c5dfa5c79fff17f96bf977b86c0c9ceb8c3cf9b (patch)
treeae82308c7b8fb06588dc25038b99e291f71dfcbf /core/java/android/net
parent1181ed8a43c8364b19f4877ec58c4e2640d7dca8 (diff)
downloadframeworks_base-9c5dfa5c79fff17f96bf977b86c0c9ceb8c3cf9b.zip
frameworks_base-9c5dfa5c79fff17f96bf977b86c0c9ceb8c3cf9b.tar.gz
frameworks_base-9c5dfa5c79fff17f96bf977b86c0c9ceb8c3cf9b.tar.bz2
Data Usage public API
Added new API consisting of android.app.usage.NetworkUsageManager and android.app.usage.NetworkUsageStats. Through them data usage on a network interface can be programmatically queried. Both summary and details are available. Bug: 19208876 Change-Id: I0e0c4b37ae23ad1e589d4b0c955b93f28ba4333e
Diffstat (limited to 'core/java/android/net')
-rw-r--r--core/java/android/net/INetworkStatsService.aidl8
-rw-r--r--core/java/android/net/INetworkStatsSession.aidl6
2 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/net/INetworkStatsService.aidl b/core/java/android/net/INetworkStatsService.aidl
index 2c3881c..6436e42 100644
--- a/core/java/android/net/INetworkStatsService.aidl
+++ b/core/java/android/net/INetworkStatsService.aidl
@@ -27,6 +27,14 @@ interface INetworkStatsService {
/** Start a statistics query session. */
INetworkStatsSession openSession();
+ /** Start a statistics query session. If calling package is profile or device owner then it is
+ * granted automatic access if apiLevel is NetworkStatsManager.API_LEVEL_DPC_ALLOWED. If
+ * apiLevel is at least NetworkStatsManager.API_LEVEL_REQUIRES_PACKAGE_USAGE_STATS then
+ * PACKAGE_USAGE_STATS permission is always checked. If PACKAGE_USAGE_STATS is not granted
+ * READ_NETWORK_USAGE_STATS is checked for.
+ */
+ INetworkStatsSession openSessionForUsageStats(String callingPackage);
+
/** Return network layer usage total for traffic that matches template. */
long getNetworkTotalBytes(in NetworkTemplate template, long start, long end);
diff --git a/core/java/android/net/INetworkStatsSession.aidl b/core/java/android/net/INetworkStatsSession.aidl
index 1596fa2..7bcb043 100644
--- a/core/java/android/net/INetworkStatsSession.aidl
+++ b/core/java/android/net/INetworkStatsSession.aidl
@@ -23,6 +23,9 @@ import android.net.NetworkTemplate;
/** {@hide} */
interface INetworkStatsSession {
+ /** Return device aggregated network layer usage summary for traffic that matches template. */
+ NetworkStats getDeviceSummaryForNetwork(in NetworkTemplate template, long start, long end);
+
/** Return network layer usage summary for traffic that matches template. */
NetworkStats getSummaryForNetwork(in NetworkTemplate template, long start, long end);
/** Return historical network layer stats for traffic that matches template. */
@@ -33,6 +36,9 @@ interface INetworkStatsSession {
/** Return historical network layer stats for specific UID traffic that matches template. */
NetworkStatsHistory getHistoryForUid(in NetworkTemplate template, int uid, int set, int tag, int fields);
+ /** Return array of uids that have stats and are accessible to the calling user */
+ int[] getRelevantUids();
+
void close();
}