Add app usage preferencee item into the history preference

Bug: 177406865
Test: make SettingsRoboTests
Test: make SettingsGoogleRoboTests
Change-Id: I7d9a14eca0b8d3b054e040cb13135ef15390e512
This commit is contained in:
ykhung
2021-04-18 23:01:27 +08:00
committed by YUKAI HUNG
parent 770ad5cbd7
commit bcf0a411a1
5 changed files with 201 additions and 9 deletions

View File

@@ -57,6 +57,7 @@ public class PowerUsageAdvanced extends PowerUsageBase {
final BatteryHistoryLoaderCallbacks mBatteryHistoryLoaderCallbacks =
new BatteryHistoryLoaderCallbacks();
private boolean mIsChartDataLoaded = false;
private boolean mIsChartGraphEnabled = false;
private PowerUsageFeatureProvider mPowerUsageFeatureProvider;
private BatteryChartPreferenceController mBatteryChartPreferenceController;
@@ -145,10 +146,11 @@ public class PowerUsageAdvanced extends PowerUsageBase {
final Bundle bundle = new Bundle();
bundle.putInt(KEY_REFRESH_TYPE, refreshType);
// Uses customized battery history loader if chart design is enabled.
if (mIsChartGraphEnabled) {
if (mIsChartGraphEnabled && !mIsChartDataLoaded) {
mIsChartDataLoaded = true;
getLoaderManager().restartLoader(LOADER_BATTERY_USAGE_STATS, bundle,
mBatteryHistoryLoaderCallbacks);
} else {
mBatteryHistoryLoaderCallbacks);
} else if (!mIsChartGraphEnabled) {
super.restartBatteryStatsLoader(refreshType);
}
}