Conservatively trim data usage stats.

Instead of trusting NTP time alone, use the most-conservative of
system clock and NTP.

Bug: 5584564
Change-Id: I5dd87fc009959b1cf0a7d660e385a0b1a8be238b
This commit is contained in:
Jeff Sharkey
2011-11-14 18:02:21 -08:00
parent bc026d0ad8
commit 6b0d72795f

View File

@@ -256,6 +256,10 @@ public class NetworkStatsHistoryTest extends AndroidTestCase {
stats.recordData(TEST_START, TEST_START + DAY_IN_MILLIS, 24L, 24L); stats.recordData(TEST_START, TEST_START + DAY_IN_MILLIS, 24L, 24L);
assertEquals(24, stats.size()); assertEquals(24, stats.size());
// try removing invalid data; should be no change
stats.removeBucketsBefore(0 - DAY_IN_MILLIS);
assertEquals(24, stats.size());
// try removing far before buckets; should be no change // try removing far before buckets; should be no change
stats.removeBucketsBefore(TEST_START - YEAR_IN_MILLIS); stats.removeBucketsBefore(TEST_START - YEAR_IN_MILLIS);
assertEquals(24, stats.size()); assertEquals(24, stats.size());