Skip to content

Commit 6026113

Browse files
Adam LesinskiAndroid (Google) Code Review
authored andcommitted
Merge "BatteryStats: Compensate for accuracy issues when reporting WiFi energy data issues with Slog.wtf" into mnc-dev
2 parents e288b3a + 4c9ace5 commit 6026113

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

services/core/java/com/android/server/am/BatteryStatsService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,9 +1261,11 @@ private WifiActivityEnergyInfo pullWifiEnergyInfoLocked() {
12611261
Slog.v(TAG, "WiFi energy data was reset, new WiFi energy data is " + result);
12621262
}
12631263

1264+
// There is some accuracy error in reports so allow 30 milliseconds of error.
1265+
final long SAMPLE_ERROR_MILLIS = 30;
12641266
final long totalTimeMs = result.mControllerIdleTimeMs + result.mControllerRxTimeMs +
12651267
result.mControllerTxTimeMs;
1266-
if (totalTimeMs > timePeriodMs) {
1268+
if (totalTimeMs > timePeriodMs + SAMPLE_ERROR_MILLIS) {
12671269
StringBuilder sb = new StringBuilder();
12681270
sb.append("Total time ");
12691271
TimeUtils.formatDuration(totalTimeMs, sb);

0 commit comments

Comments
 (0)