Merge changes from topic "screentime" into main

* changes:
  Fix summary for system components which 30 sec <= usage time < 1 min.
  Fix purge condition for system component in BatteryDiffData.
This commit is contained in:
Xinyi Mao
2024-04-02 10:59:14 +00:00
committed by Android (Google) Code Review
3 changed files with 10 additions and 6 deletions

View File

@@ -670,7 +670,7 @@ public class BatteryUtils {
long timeInMs,
final int lessThanOneMinuteResId,
final int normalResId) {
if (timeInMs < DateUtils.MINUTE_IN_MILLIS) {
if (timeInMs <= DateUtils.MINUTE_IN_MILLIS / 2) {
return context.getString(lessThanOneMinuteResId);
}
final CharSequence timeSequence =

View File

@@ -150,7 +150,10 @@ public class BatteryDiffData {
final Iterator<BatteryDiffEntry> iterator = entries.iterator();
while (iterator.hasNext()) {
final BatteryDiffEntry entry = iterator.next();
final long screenOnTimeInMs = entry.mScreenOnTimeInMs;
final long screenOnTimeInMs =
entry.isSystemEntry()
? entry.mForegroundUsageTimeInMs
: entry.mScreenOnTimeInMs;
final double comsumePower = entry.mConsumePower;
final String packageName = entry.getPackageName();
final Integer componentId = entry.mComponentId;