diff options
| author | 2021-09-10 06:07:06 +0000 | |
|---|---|---|
| committer | 2021-09-10 06:07:06 +0000 | |
| commit | 580839993afafa4bcd76bf5ec8721ee4931932c0 (patch) | |
| tree | f696766300cadcc7bbdfd6c5ad2d3c547986e9ae | |
| parent | 14dbc9facce47399e30d6b143f8dfcbc043d1bba (diff) | |
| parent | c98d5a9d97614e8ba5fcc50b7a3b4c006741c328 (diff) | |
Merge "NetworkStats: Avoid Division By 0" into sc-qpr1-dev am: c98d5a9d97
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15782831
Change-Id: I541f8edc99296f396dbf4c482a2687fb13424629
| -rw-r--r-- | services/core/java/com/android/server/net/NetworkStatsCollection.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/net/NetworkStatsCollection.java b/services/core/java/com/android/server/net/NetworkStatsCollection.java index 557fa8944445..df372b1459af 100644 --- a/services/core/java/com/android/server/net/NetworkStatsCollection.java +++ b/services/core/java/com/android/server/net/NetworkStatsCollection.java @@ -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(); |