Remove OS items in battery main page.

We want to hide the OS items from battery usage page and let users
focus on the items that they can control.

Currently the hidden items are:
Android OS, Android System, Phone idle, Cell Standby

Bug: 34274844
Test: RunSettingsRoboTests & screenshots
Change-Id: I75165376d5038b6ec17a7b73ae3c5fcd24753fa9
This commit is contained in:
jackqdyulei
2017-01-17 13:26:20 -08:00
parent 94b86a4d77
commit 51db61dcd5
2 changed files with 48 additions and 3 deletions

View File

@@ -319,7 +319,7 @@ public class PowerUsageSummary extends PowerUsageBase {
final int numSippers = usageList.size();
for (int i = 0; i < numSippers; i++) {
final BatterySipper sipper = usageList.get(i);
if ((sipper.totalPowerMah * SECONDS_IN_HOUR) < MIN_POWER_THRESHOLD_MILLI_AMP) {
if (shouldHideSipper(sipper)) {
continue;
}
double totalPower = USE_FAKE_DATA ? 4000 : mStatsHelper.getTotalPower();
@@ -375,7 +375,7 @@ public class PowerUsageSummary extends PowerUsageBase {
pref.setTitle(entry.getLabel());
pref.setOrder(i + 1);
pref.setPercent(percentOfMax, percentOfTotal);
if ((sipper.drainType != DrainType.APP || sipper.uidObj.getUid() == 0)
if ((sipper.drainType != DrainType.APP || sipper.uidObj.getUid() == Process.ROOT_UID)
&& sipper.drainType != DrainType.USER) {
pref.setTint(colorControl);
}
@@ -395,6 +395,16 @@ public class PowerUsageSummary extends PowerUsageBase {
BatteryEntry.startRequestQueue();
}
@VisibleForTesting
boolean shouldHideSipper(BatterySipper sipper) {
final DrainType drainType = sipper.drainType;
final int uid = sipper.getUid();
return drainType == DrainType.IDLE || drainType == DrainType.CELL
|| uid == Process.ROOT_UID || uid == Process.SYSTEM_UID
|| (sipper.totalPowerMah * SECONDS_IN_HOUR) < MIN_POWER_THRESHOLD_MILLI_AMP;
}
@VisibleForTesting
String extractKeyFromSipper(BatterySipper sipper) {
if (sipper.uidObj != null) {