Merge "NetworkStats: Avoid Division By 0" am: e22278838e am: 46b4720a18

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1810678

Change-Id: I579026d3e4b1f4ee03f156089d16047f0fc2f77c
This commit is contained in:
Junyu Lai
2021-09-01 06:53:37 +00:00
committed by Automerger Merge Worker

View File

@@ -290,7 +290,8 @@ public class NetworkStatsCollection implements FileRotator.Reader, FileRotator.W
combined.getValues(augmentStart, augmentEnd, entry);
}
final long rawBytes = entry.rxBytes + entry.txBytes;
final long rawBytes = (entry.rxBytes + entry.txBytes) == 0 ? 1 :
(entry.rxBytes + entry.txBytes);
final long rawRxBytes = entry.rxBytes == 0 ? 1 : entry.rxBytes;
final long rawTxBytes = entry.txBytes == 0 ? 1 : entry.txBytes;
final long targetBytes = augmentPlan.getDataUsageBytes();