Don't plot usage data beyond current date.

- the new data usage api returns buckets for future date with 0 usage.
When we plot the data usage chart, need to check the bucket date to make
sure we only plot points up to the current date.

Change-Id: I50e161ca9cdbb30c8fda8f6cdd24c993b546ad0d
Fixes: 120490567
Test: make RunSettingsRoboTests
This commit is contained in:
Doris Ling
2018-12-06 17:12:05 -08:00
parent f80e5b561e
commit 8727a40893
2 changed files with 68 additions and 4 deletions

View File

@@ -95,9 +95,13 @@ public class ChartDataUsagePreference extends Preference {
final SparseIntArray points = new SparseIntArray();
points.put(0, 0);
final long now = System.currentTimeMillis();
long totalData = 0;
for (NetworkCycleData data : usageSummary) {
final long startTime = data.getStartTime();
if (startTime > now) {
break;
}
final long endTime = data.getEndTime();
// increment by current bucket total