Add summary for categories in battery advanced page

If the category only contains one app, show usage time, otherwise
show app with maximum usage.

Also add usage time for apps in battery settings page.

Bug: 35396770
Test: RunSettingsRoboTests
Change-Id: I43fe9c2289535be2c1b95ffded6b52b0ff099589
This commit is contained in:
jackqdyulei
2017-03-27 14:00:29 -07:00
parent ddba966700
commit 3bbaca9c7c
3 changed files with 170 additions and 13 deletions

View File

@@ -489,6 +489,10 @@ public class PowerUsageSummary extends PowerUsageBase {
pref.setTitle(entry.getLabel());
pref.setOrder(i + 1);
pref.setPercent(percentOfTotal);
if (sipper.usageTimeMs == 0 && sipper.drainType == DrainType.APP) {
sipper.usageTimeMs = BatteryUtils.getProcessTimeMs(
BatteryUtils.StatusType.FOREGROUND, sipper.uidObj, mStatsType);
}
setUsageSummary(pref, usedTime, sipper.usageTimeMs);
if ((sipper.drainType != DrainType.APP
|| sipper.uidObj.getUid() == Process.ROOT_UID)