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:
@@ -149,7 +149,7 @@ public class BatteryAppListPreferenceController extends AbstractPreferenceContro
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return FeatureFlagUtils.isEnabled(mContext, FeatureFlags.BATTERY_DISPLAY_APP_LIST);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -186,12 +186,17 @@ public class BatteryAppListPreferenceController extends AbstractPreferenceContro
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshAppListGroup(BatteryStatsHelper statsHelper, boolean showAllApps,
|
||||
CharSequence timeSequence) {
|
||||
public void refreshAppListGroup(BatteryStatsHelper statsHelper, boolean showAllApps) {
|
||||
if (!isAvailable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mBatteryStatsHelper = statsHelper;
|
||||
final long lastFullChargeTime = mBatteryUtils.calculateLastFullChargeTime(
|
||||
mBatteryStatsHelper, System.currentTimeMillis());
|
||||
final CharSequence timeSequence = StringUtil.formatRelativeTime(mContext,
|
||||
lastFullChargeTime,
|
||||
false);
|
||||
final int resId = showAllApps ? R.string.power_usage_list_summary_device
|
||||
: R.string.power_usage_list_summary;
|
||||
mAppListGroup.setTitle(TextUtils.expandTemplate(mContext.getText(resId), timeSequence));
|
||||
@@ -361,7 +366,7 @@ public class BatteryAppListPreferenceController extends AbstractPreferenceContro
|
||||
final long usageTimeMs = sipper.usageTimeMs;
|
||||
if (usageTimeMs >= DateUtils.MINUTE_IN_MILLIS) {
|
||||
final CharSequence timeSequence =
|
||||
StringUtil.formatElapsedTime(mContext, usageTimeMs, false);
|
||||
StringUtil.formatElapsedTime(mContext, usageTimeMs, false);
|
||||
preference.setSummary(
|
||||
(sipper.drainType != DrainType.APP || mBatteryUtils.shouldHideSipper(sipper))
|
||||
? timeSequence
|
||||
|
||||
Reference in New Issue
Block a user