Merge "Bootstrap stats before registering listeners." into ics-mr1

This commit is contained in:
Jeff Sharkey
2011-11-08 23:43:58 -08:00
committed by Android (Google) Code Review
2 changed files with 18 additions and 17 deletions

View File

@@ -466,7 +466,7 @@ public class NetworkStats implements Parcelable {
public NetworkStats subtract(NetworkStats value) throws NonMonotonicException {
final long deltaRealtime = this.elapsedRealtime - value.elapsedRealtime;
if (deltaRealtime < 0) {
throw new IllegalArgumentException("found non-monotonic realtime");
throw new NonMonotonicException(this, value);
}
// result will have our rows, and elapsed time between snapshots
@@ -586,7 +586,8 @@ public class NetworkStats implements Parcelable {
pw.print("NetworkStats: elapsedRealtime="); pw.println(elapsedRealtime);
for (int i = 0; i < size; i++) {
pw.print(prefix);
pw.print(" iface="); pw.print(iface[i]);
pw.print(" ["); pw.print(i); pw.print("]");
pw.print(" iface="); pw.print(iface[i]);
pw.print(" uid="); pw.print(uid[i]);
pw.print(" set="); pw.print(setToString(set[i]));
pw.print(" tag="); pw.print(tagToString(tag[i]));
@@ -649,6 +650,10 @@ public class NetworkStats implements Parcelable {
public final int leftIndex;
public final int rightIndex;
public NonMonotonicException(NetworkStats left, NetworkStats right) {
this(left, -1, right, -1);
}
public NonMonotonicException(
NetworkStats left, int leftIndex, NetworkStats right, int rightIndex) {
this.left = checkNotNull(left, "missing left");