From 17a51c8a56426c296fa787918031579cbe549343 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Fri, 30 Mar 2018 16:25:11 -0600 Subject: [PATCH] API council requested tweaks to SubscriptionPlan. Return new shiny Range<> object instead of Pair<>. Tell developers what permission to check on refresh broadcast. Describe what exceptions might be thrown, and that an empty list is okay. Allow creation of plans with richer Period object, instead of forcing them into rigid week or day options. Protect SubscriptionPlan broadcast. Test: atest android.util.RecurrenceRuleTest Test: atest com.android.server.NetworkPolicyManagerServiceTest Bug: 74945820 Change-Id: I7e555798e0cfaa214ca93d9df627c6443fc5d986 --- .../com/android/server/net/NetworkStatsCollection.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/net/NetworkStatsCollection.java b/services/core/java/com/android/server/net/NetworkStatsCollection.java index 2ef754e2ba..ab525237db 100644 --- a/services/core/java/com/android/server/net/NetworkStatsCollection.java +++ b/services/core/java/com/android/server/net/NetworkStatsCollection.java @@ -47,7 +47,7 @@ import android.util.ArrayMap; import android.util.AtomicFile; import android.util.IntArray; import android.util.MathUtils; -import android.util.Pair; +import android.util.Range; import android.util.Slog; import android.util.proto.ProtoOutputStream; @@ -266,11 +266,11 @@ public class NetworkStatsCollection implements FileRotator.Reader { long collectEnd = end; if (augmentEnd != SubscriptionPlan.TIME_UNKNOWN) { - final Iterator> it = augmentPlan.cycleIterator(); + final Iterator> it = augmentPlan.cycleIterator(); while (it.hasNext()) { - final Pair cycle = it.next(); - final long cycleStart = cycle.first.toInstant().toEpochMilli(); - final long cycleEnd = cycle.second.toInstant().toEpochMilli(); + final Range cycle = it.next(); + final long cycleStart = cycle.getLower().toInstant().toEpochMilli(); + final long cycleEnd = cycle.getUpper().toInstant().toEpochMilli(); if (cycleStart <= augmentEnd && augmentEnd < cycleEnd) { augmentStart = cycleStart; collectStart = Long.min(collectStart, augmentStart);