am bc03c74c: am d968670d: Merge "Conservatively trim data usage stats." into ics-mr1

* commit 'bc03c74c485669695805944a655795a6f9890956':
  Conservatively trim data usage stats.
This commit is contained in:
Jeff Sharkey
2011-11-15 11:30:34 -08:00
committed by Android Git Automerger

View File

@@ -1243,7 +1243,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
// trim any history beyond max // trim any history beyond max
if (mTime.hasCache()) { if (mTime.hasCache()) {
final long currentTime = mTime.currentTimeMillis(); final long currentTime = Math.min(
System.currentTimeMillis(), mTime.currentTimeMillis());
final long maxHistory = mSettings.getNetworkMaxHistory(); final long maxHistory = mSettings.getNetworkMaxHistory();
for (NetworkStatsHistory history : input.values()) { for (NetworkStatsHistory history : input.values()) {
history.removeBucketsBefore(currentTime - maxHistory); history.removeBucketsBefore(currentTime - maxHistory);
@@ -1287,7 +1288,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
// trim any history beyond max // trim any history beyond max
if (mTime.hasCache()) { if (mTime.hasCache()) {
final long currentTime = mTime.currentTimeMillis(); final long currentTime = Math.min(
System.currentTimeMillis(), mTime.currentTimeMillis());
final long maxUidHistory = mSettings.getUidMaxHistory(); final long maxUidHistory = mSettings.getUidMaxHistory();
final long maxTagHistory = mSettings.getTagMaxHistory(); final long maxTagHistory = mSettings.getTagMaxHistory();
for (UidStatsKey key : mUidStats.keySet()) { for (UidStatsKey key : mUidStats.keySet()) {