Support daily and hourly battery chartview.

https://drive.google.com/file/d/1vjt6FPFAiFakb158t1IBku1IQNzVPW46/view?usp=sharing&resourcekey=0-f5m2eUKWbth6gdEFh5lOIQ

Test: manual
Bug: 236101166
Change-Id: I47d899b936742514801cd4fa7a82ddaea5d21c31
This commit is contained in:
Zaiyue Xue
2022-07-22 15:24:09 +08:00
parent 03182b5781
commit eaf4d1bb50
4 changed files with 295 additions and 318 deletions

View File

@@ -20,6 +20,8 @@ import androidx.annotation.NonNull;
import androidx.core.util.Preconditions;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
/** Wraps the battery timestamp and level data used for battery usage chart. */
public final class BatteryLevelData {
@@ -46,6 +48,12 @@ public final class BatteryLevelData {
public List<Integer> getLevels() {
return mLevels;
}
@Override
public String toString() {
return String.format(Locale.ENGLISH, "timestamps: %s; levels: %s",
Objects.toString(mTimestamps), Objects.toString(mLevels));
}
}
/**
@@ -78,4 +86,13 @@ public final class BatteryLevelData {
public List<PeriodBatteryLevelData> getHourlyBatteryLevelsPerDay() {
return mHourlyBatteryLevelsPerDay;
}
}
@Override
public String toString() {
return String.format(Locale.ENGLISH,
"dailyBatteryLevels: %s; hourlyBatteryLevelsPerDay: %s",
Objects.toString(mDailyBatteryLevels),
Objects.toString(mHourlyBatteryLevelsPerDay));
}
}