OSDN Git Service

Last-ditch clamping of negative NetworkStats.
authorJeff Sharkey <jsharkey@android.com>
Tue, 22 May 2018 17:35:29 +0000 (11:35 -0600)
committerJeff Sharkey <jsharkey@android.com>
Tue, 22 May 2018 17:35:32 +0000 (11:35 -0600)
commitb5a97e6f63bfe8b828224f606f8cb8585d9f28ec
treeceaca7850a3cf232770b1f4f12564eda4d90ae12
parentb138eaa7b7ff2606ffa08f2b447bb328d980f891
Last-ditch clamping of negative NetworkStats.

We've seen reports of negative values flowing through to attempt
being recorded, which will outright crash.  This change does one
last-ditch check to see if we're about to work with negative values,
reporting any trouble and clamping them to zero so we don't crash.

This gives us the data we need to continue investigating without
triggering runtime restarts in the field.

Bug: 80057433
Test: atest android.net.NetworkStatsTest
Change-Id: I8174391c6cf5dadc2c2c10a8d841ee07e1f7d934
core/java/android/net/NetworkStats.java
services/core/java/com/android/server/net/NetworkStatsRecorder.java
services/core/java/com/android/server/net/NetworkStatsService.java