Merge "Merge "Docs: Gradle 2.1.0 Release Notes" into mnc-docs am: aa53fb1 am: c49e787 am: 4defc19 am: c070811" into nyc-dev
diff --git a/core/java/android/app/usage/NetworkStats.java b/core/java/android/app/usage/NetworkStats.java
index 6d5c81b..9963eab 100644
--- a/core/java/android/app/usage/NetworkStats.java
+++ b/core/java/android/app/usage/NetworkStats.java
@@ -64,6 +64,11 @@
     private int mUidOrUidIndex;
 
     /**
+     * Tag id in case if was specified in the query.
+     */
+    private int mTag = android.net.NetworkStats.TAG_NONE;
+
+    /**
      * The session while the query requires it, null if all the stats have been collected or close()
      * has been called.
      */
@@ -434,7 +439,7 @@
             mHistory = mSession.getHistoryIntervalForUid(mTemplate, uid,
                     android.net.NetworkStats.SET_ALL, tag,
                     NetworkStatsHistory.FIELD_ALL, mStartTimeStamp, mEndTimeStamp);
-            setSingleUid(uid);
+            setSingleUidTag(uid, tag);
         } catch (RemoteException e) {
             Log.w(TAG, e);
             // Leaving mHistory null
@@ -538,6 +543,7 @@
                 mRecycledHistoryEntry = mHistory.getValues(mEnumerationIndex++,
                         mRecycledHistoryEntry);
                 bucketOut.mUid = Bucket.convertUid(getUid());
+                bucketOut.mTag = Bucket.convertTag(mTag);
                 bucketOut.mState = Bucket.STATE_ALL;
                 bucketOut.mRoaming = Bucket.ROAMING_ALL;
                 bucketOut.mBeginTimeStamp = mRecycledHistoryEntry.bucketStart;
@@ -579,8 +585,9 @@
         return mUidOrUidIndex;
     }
 
-    private void setSingleUid(int uid) {
+    private void setSingleUidTag(int uid, int tag) {
         mUidOrUidIndex = uid;
+        mTag = tag;
     }
 
     private void stepUid() {