Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60261137 authored by Adam Lesinski's avatar Adam Lesinski Committed by Android (Google) Code Review
Browse files

Merge "BatteryStats: Compensate for accuracy issues when reporting WiFi energy...

Merge "BatteryStats: Compensate for accuracy issues when reporting WiFi energy data issues with Slog.wtf" into mnc-dev
parents e288b3af 4c9ace51
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1261,9 +1261,11 @@ public final class BatteryStatsService extends IBatteryStats.Stub
                    Slog.v(TAG, "WiFi energy data was reset, new WiFi energy data is " + result);
                }

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