Merge "Fixing network tags." into nyc-dev

am: 2c9bb7c

* commit '2c9bb7c09a49442ac871115890f93581aa160d46':
  Fixing network tags.

Change-Id: Ic90b551edcb6cb3354ea3c95ecc96d3dbee2c3a2
This commit is contained in:
Antonio Cansado
2016-04-27 21:39:43 +00:00
committed by android-build-merger

View File

@@ -63,6 +63,11 @@ public final class NetworkStats implements AutoCloseable {
*/ */
private int mUidOrUidIndex; 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() * The session while the query requires it, null if all the stats have been collected or close()
* has been called. * has been called.
@@ -434,7 +439,7 @@ public final class NetworkStats implements AutoCloseable {
mHistory = mSession.getHistoryIntervalForUid(mTemplate, uid, mHistory = mSession.getHistoryIntervalForUid(mTemplate, uid,
android.net.NetworkStats.SET_ALL, tag, android.net.NetworkStats.SET_ALL, tag,
NetworkStatsHistory.FIELD_ALL, mStartTimeStamp, mEndTimeStamp); NetworkStatsHistory.FIELD_ALL, mStartTimeStamp, mEndTimeStamp);
setSingleUid(uid); setSingleUidTag(uid, tag);
} catch (RemoteException e) { } catch (RemoteException e) {
Log.w(TAG, e); Log.w(TAG, e);
// Leaving mHistory null // Leaving mHistory null
@@ -538,6 +543,7 @@ public final class NetworkStats implements AutoCloseable {
mRecycledHistoryEntry = mHistory.getValues(mEnumerationIndex++, mRecycledHistoryEntry = mHistory.getValues(mEnumerationIndex++,
mRecycledHistoryEntry); mRecycledHistoryEntry);
bucketOut.mUid = Bucket.convertUid(getUid()); bucketOut.mUid = Bucket.convertUid(getUid());
bucketOut.mTag = Bucket.convertTag(mTag);
bucketOut.mState = Bucket.STATE_ALL; bucketOut.mState = Bucket.STATE_ALL;
bucketOut.mRoaming = Bucket.ROAMING_ALL; bucketOut.mRoaming = Bucket.ROAMING_ALL;
bucketOut.mBeginTimeStamp = mRecycledHistoryEntry.bucketStart; bucketOut.mBeginTimeStamp = mRecycledHistoryEntry.bucketStart;
@@ -579,8 +585,9 @@ public final class NetworkStats implements AutoCloseable {
return mUidOrUidIndex; return mUidOrUidIndex;
} }
private void setSingleUid(int uid) { private void setSingleUidTag(int uid, int tag) {
mUidOrUidIndex = uid; mUidOrUidIndex = uid;
mTag = tag;
} }
private void stepUid() { private void stepUid() {