Populate new fields foreground_service_usage_time_in_ms,

foreground_usage_consume_power, foreground_service_usage_consume_power,
background_usage_consume_power and cached_usage_consume_power into
database and pass them to UI.

Test: make RunSettingsRoboTests + manual
Bug: 256123455
Bug: 258124768
Change-Id: Ic46032f67eff5898f9d4182c517bbebe478eca01
This commit is contained in:
Kuan Wang
2022-11-21 10:41:02 +08:00
parent a6a7e029d7
commit 53a761f55b
14 changed files with 707 additions and 713 deletions

View File

@@ -164,15 +164,20 @@ public final class DatabaseUtils {
batteryEntryList.stream()
.filter(entry -> {
final long foregroundMs = entry.getTimeInForegroundMs();
final long foregroundServiceMs = entry.getTimeInForegroundServiceMs();
final long backgroundMs = entry.getTimeInBackgroundMs();
if (entry.getConsumedPower() == 0
&& (foregroundMs != 0 || backgroundMs != 0)) {
&& (foregroundMs != 0
|| foregroundServiceMs != 0
|| backgroundMs != 0)) {
Log.w(TAG, String.format(
"no consumed power but has running time for %s time=%d|%d",
entry.getLabel(), foregroundMs, backgroundMs));
"no consumed power but has running time for %s time=%d|%d|%d",
entry.getLabel(), foregroundMs, foregroundServiceMs,
backgroundMs));
}
return entry.getConsumedPower() != 0
|| foregroundMs != 0
|| foregroundServiceMs != 0
|| backgroundMs != 0;
})
.forEach(entry -> valuesList.add(