Port battery usage bug fixing cls from master to tm-qpr-dev
This cl is a merge of the following 5 cls: ag/19674112 Fix b/242989581: The two battery charts have the same label ag/19667114 Support data logging for battery usage new chart view ag/19636171 Support data logging for battery usage new chart view ag/19682758 Resolve insufficient contrast for system component icons ag/19697763 Add fade in animation for battery usage chart group Bug: 242989581 Bug: 242810430 Bug: 242989982 Test: presubmit Change-Id: I39cd0f88ce62a280a966750082a40f8a537b9616 Merged-In: Ice30508bc20b5de631efee0db0160fe6ad710dbb
This commit is contained in:
@@ -630,6 +630,18 @@ public final class BatteryChartPreferenceControllerTest {
|
||||
.isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTotalHours_getExpectedResult() {
|
||||
Map<Long, Map<String, BatteryHistEntry>> batteryHistoryMap = createBatteryHistoryMap(60);
|
||||
BatteryLevelData batteryLevelData = DataProcessor.getBatteryLevelData(mContext, null,
|
||||
batteryHistoryMap, null);
|
||||
|
||||
final int totalHour = BatteryChartPreferenceController.getTotalHours(batteryLevelData);
|
||||
|
||||
// Only calculate the even hours.
|
||||
assertThat(totalHour).isEqualTo(58);
|
||||
}
|
||||
|
||||
private static Long generateTimestamp(int index) {
|
||||
// "2021-04-23 07:00:00 UTC" + index hours
|
||||
return 1619247600000L + index * DateUtils.HOUR_IN_MILLIS;
|
||||
|
@@ -307,7 +307,7 @@ public class BatteryEntryTest {
|
||||
R.drawable.ic_settings_aod);
|
||||
assertNameAndIcon(BatteryConsumer.POWER_COMPONENT_BLUETOOTH,
|
||||
R.string.power_bluetooth,
|
||||
com.android.internal.R.drawable.ic_settings_bluetooth);
|
||||
R.drawable.ic_settings_bluetooth);
|
||||
assertNameAndIcon(BatteryConsumer.POWER_COMPONENT_CAMERA,
|
||||
R.string.power_camera,
|
||||
R.drawable.ic_settings_camera);
|
||||
@@ -325,7 +325,7 @@ public class BatteryEntryTest {
|
||||
R.drawable.ic_settings_display);
|
||||
assertNameAndIcon(BatteryConsumer.POWER_COMPONENT_WIFI,
|
||||
R.string.power_wifi,
|
||||
R.drawable.ic_settings_wireless);
|
||||
R.drawable.ic_settings_wireless_no_theme);
|
||||
assertNameAndIcon(BatteryConsumer.POWER_COMPONENT_IDLE,
|
||||
R.string.power_idle,
|
||||
R.drawable.ic_settings_phone_idle);
|
||||
|
Reference in New Issue
Block a user