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

Commit 89e5b837 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Adjust background time to avoid background + screen time larger than time slot duration."

parents 353cde71 a396885f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1547,6 +1547,9 @@ public final class DataProcessor {
                            appUsageMap,
                            selectedBatteryEntry.mUserId,
                            selectedBatteryEntry.mPackageName));
            // Make sure the background + screen-on time will not exceed the threshold.
            backgroundUsageTimeInMs = Math.min(
                    backgroundUsageTimeInMs, (long) TOTAL_HOURLY_TIME_THRESHOLD - screenOnTime);
            final BatteryDiffEntry currentBatteryDiffEntry = new BatteryDiffEntry(
                    context,
                    foregroundUsageTimeInMs,
+1 −1
Original line number Diff line number Diff line
@@ -1149,7 +1149,7 @@ public final class DataProcessorTest {
        assertThat(resultEntry.mForegroundUsageTimeInMs)
                .isEqualTo(Math.round(entry.mForegroundUsageTimeInMs * ratio));
        assertThat(resultEntry.mBackgroundUsageTimeInMs)
                .isEqualTo(Math.round(entry.mBackgroundUsageTimeInMs * ratio));
                .isEqualTo(0);
        assertThat(resultEntry.mConsumePower)
                .isEqualTo(entry.mConsumePower * ratio);
        assertThat(resultEntry.mForegroundUsageConsumePower)