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:
@@ -31,12 +31,13 @@ import com.android.settings.utils.AsyncLoader;
|
||||
public class BatteryStatsHelperLoader extends AsyncLoader<BatteryStatsHelper> {
|
||||
@VisibleForTesting
|
||||
UserManager mUserManager;
|
||||
private Bundle mBundle;
|
||||
@VisibleForTesting
|
||||
BatteryUtils mBatteryUtils;
|
||||
|
||||
public BatteryStatsHelperLoader(Context context, Bundle bundle) {
|
||||
public BatteryStatsHelperLoader(Context context) {
|
||||
super(context);
|
||||
mBundle = bundle;
|
||||
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||
mBatteryUtils = BatteryUtils.getInstance(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -44,9 +45,8 @@ public class BatteryStatsHelperLoader extends AsyncLoader<BatteryStatsHelper> {
|
||||
Context context = getContext();
|
||||
final BatteryStatsHelper statsHelper = new BatteryStatsHelper(context,
|
||||
true /* collectBatteryBroadcast */);
|
||||
mBatteryUtils.initBatteryStatsHelper(statsHelper, null /* bundle */, mUserManager);
|
||||
|
||||
BatteryUtils.getInstance(context).initBatteryStatsHelper(statsHelper, mBundle,
|
||||
mUserManager);
|
||||
return statsHelper;
|
||||
}
|
||||
|
||||
@@ -55,5 +55,4 @@ public class BatteryStatsHelperLoader extends AsyncLoader<BatteryStatsHelper> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user