Create new PowerUsageAdvanced page

This page contains the graph at the top and app list at the bottom

In this cl, we reused some part of the code in PowerUsageAdvancedLegacy
to construct the graph, and also used controller to construct the app
list(So glad that we extracted it to controller before..)

Bug: 73300636
Test: RunSettingsRoboTests
Change-Id: I30afbc0327a5186f8280f5e3678330b363e2dc0d
Merged-In: I30afbc0327a5186f8280f5e3678330b363e2dc0d
This commit is contained in:
jackqdyulei
2018-02-27 14:30:57 -08:00
committed by Lei Yu
parent d0086188d2
commit 31a5960424
7 changed files with 327 additions and 31 deletions

View File

@@ -101,7 +101,6 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
SparseArray<List<Anomaly>> mAnomalySparseArray;
@VisibleForTesting
BatteryHeaderPreferenceController mBatteryHeaderPreferenceController;
private BatteryAppListPreferenceController mBatteryAppListPreferenceController;
private BatteryTipPreferenceController mBatteryTipPreferenceController;
private int mStatsType = BatteryStats.STATS_SINCE_CHARGED;
@@ -231,9 +230,6 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
mBatteryHeaderPreferenceController = new BatteryHeaderPreferenceController(
context, activity, this /* host */, lifecycle);
controllers.add(mBatteryHeaderPreferenceController);
mBatteryAppListPreferenceController = new BatteryAppListPreferenceController(context,
KEY_APP_LIST, lifecycle, activity, this);
controllers.add(mBatteryAppListPreferenceController);
mBatteryTipPreferenceController = new BatteryTipPreferenceController(context,
KEY_BATTERY_TIP, (SettingsActivity) getActivity(), this /* fragment */, this /*
BatteryTipListener */);
@@ -294,11 +290,6 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
updateLastFullChargePreference(lastFullChargeTime);
mScreenUsagePref.setSubtitle(StringUtil.formatElapsedTime(getContext(),
mBatteryUtils.calculateScreenUsageTime(mStatsHelper), false));
final CharSequence timeSequence = StringUtil.formatRelativeTime(context, lastFullChargeTime,
false);
mBatteryAppListPreferenceController.refreshAppListGroup(mStatsHelper,
false /* showAllApps */, timeSequence);
}
@VisibleForTesting