From 84b60d6489a7e9e293390a3e56fd09b2de4cfbb3 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Tue, 2 Aug 2011 17:22:34 -0700 Subject: [PATCH] Expose quota status for active network. Create API to expose quota status derived from underlying network policy. This is designed to support applications making informed decisions when performing network requests. Fix bug with random stats generation, and write policy when changing restrict background data flag. Deprecate EXTRA_NETWORK_INFO, since it varies based on UID. Bug: 4517283, 5088603 Change-Id: Ic6893a8967f69937e466be226ba7bb86ef5a5d2d --- core/java/android/net/NetworkStatsHistory.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/java/android/net/NetworkStatsHistory.java b/core/java/android/net/NetworkStatsHistory.java index 4ffabb15b6..7a4b811763 100644 --- a/core/java/android/net/NetworkStatsHistory.java +++ b/core/java/android/net/NetworkStatsHistory.java @@ -405,11 +405,10 @@ public class NetworkStatsHistory implements Parcelable { final long curEnd = randomLong(r, curStart, end); entry.rxBytes = randomLong(r, 0, rx); entry.txBytes = randomLong(r, 0, tx); - - recordData(curStart, curEnd, entry); - rx -= entry.rxBytes; tx -= entry.txBytes; + + recordData(curStart, curEnd, entry); } }