Never store battery stats for cache

In PowerUsageBase, it will store battery stats if it has a configuration
change, which will make BatteryStatsLoaderHelper never get the correct
battery stats because it uses Bundle.EMPTY as the bundle message.

This cl:
1. Remove the store action even though it is configuration change.
2. Always use null to get battery stats
3. Always start a battery status check in register()

Bug: 63658232
Test: RunSettingsRoboTests
Change-Id: Ifbf970c63378ed66dddcdae4d952b7d1fd84216a
This commit is contained in:
jackqdyulei
2017-07-14 15:23:32 -07:00
parent 8e1f509b5d
commit 114cf2a1a7
7 changed files with 101 additions and 32 deletions

View File

@@ -82,19 +82,6 @@ public abstract class PowerUsageBase extends DashboardFragment
mBatteryBroadcastReceiver.unRegister();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void onDestroy() {
super.onDestroy();
if (getActivity().isChangingConfigurations()) {
mStatsHelper.storeState();
}
}
protected void restartBatteryStatsLoader() {
getLoaderManager().restartLoader(0, Bundle.EMPTY, this);
}
@@ -108,7 +95,7 @@ public abstract class PowerUsageBase extends DashboardFragment
@Override
public Loader<BatteryStatsHelper> onCreateLoader(int id,
Bundle args) {
return new BatteryStatsHelperLoader(getContext(), args);
return new BatteryStatsHelperLoader(getContext());
}
@Override