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

Commit a396885f authored by Kuan Wang's avatar Kuan Wang
Browse files

Adjust background time to avoid background + screen time larger than

time slot duration.

Test: make RunSettingsRoboTests
Bug: 265089855
Fix: 265089855
Change-Id: Idf3fee13eccd5b1f699feb5f79bd2aa474e444b8
parent dc8f9673
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)