diff --git a/core/java/android/app/usage/NetworkStats.java b/core/java/android/app/usage/NetworkStats.java index 5622207941..9f1a9cf01e 100644 --- a/core/java/android/app/usage/NetworkStats.java +++ b/core/java/android/app/usage/NetworkStats.java @@ -48,7 +48,6 @@ public final class NetworkStats implements AutoCloseable { */ private final long mEndTimeStamp; - /** * Non-null array indicates the query enumerates over uids. */ @@ -165,7 +164,18 @@ public final class NetworkStats implements AutoCloseable { */ public static final int ROAMING_ROAMING = 0x2; + /** + * Special TAG value matching any tag. + */ + public static final int TAG_ANY = android.net.NetworkStats.TAG_ALL; + + /** + * Special TAG value for total data across all tags + */ + public static final int TAG_ALL = android.net.NetworkStats.TAG_NONE; + private int mUid; + private int mTag; private int mState; private int mRoaming; private long mBeginTimeStamp; @@ -192,6 +202,14 @@ public final class NetworkStats implements AutoCloseable { return uid; } + private static int convertTag(int tag) { + switch (tag) { + case android.net.NetworkStats.TAG_ALL: return TAG_ANY; + case android.net.NetworkStats.TAG_NONE: return TAG_ALL; + } + return tag; + } + private static int convertRoaming(int roaming) { switch (roaming) { case android.net.NetworkStats.ROAMING_ALL : return ROAMING_ALL; @@ -217,6 +235,14 @@ public final class NetworkStats implements AutoCloseable { return mUid; } + /** + * Tag of the bucket.

+ * @return Bucket tag. + */ + public int getTag() { + return mTag; + } + /** * Usage state. One of the following values:

*