Inserts last 24 hour agrregate data into indexed usage map

Bug: 184807417
Test: make SettingsRoboTests
Test: make SettingsGoogleRoboTests
Change-Id: I7771a43baf74b36a816883dd6b6a91128f827cf4
This commit is contained in:
ykhung
2021-04-13 11:15:25 +08:00
parent aeb5b95705
commit 0d54b75b2c
4 changed files with 76 additions and 14 deletions

View File

@@ -36,4 +36,17 @@ public final class BatteryDiffEntryTest {
assertThat(entry.getPercentOfTotal()).isEqualTo(22.0);
}
@Test
public void testSetTotalConsumePower_setZeroValue_returnsZeroValue() {
final BatteryDiffEntry entry =
new BatteryDiffEntry(
/*foregroundUsageTimeInMs=*/ 10001L,
/*backgroundUsageTimeInMs=*/ 20002L,
/*consumePower=*/ 22.0,
/*batteryHistEntry=*/ null);
entry.setTotalConsumePower(0);
assertThat(entry.getPercentOfTotal()).isEqualTo(0);
}
}