Merge "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."

This commit is contained in:
Kuan Wang
2022-11-29 06:52:08 +00:00
committed by Android (Google) Code Review
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(