use of com.android.settings.fuelgauge.BatteryUsageStatsLoader in project android_packages_apps_Settings by omnirom.
the class BatteryFixSlice method refreshBatteryTips.
@WorkerThread
@VisibleForTesting
static List<BatteryTip> refreshBatteryTips(Context context) {
final BatteryUsageStatsLoader statsLoader = new BatteryUsageStatsLoader(context, /* includeBatteryHistory */
false);
final BatteryUsageStats batteryUsageStats = statsLoader.loadInBackground();
final BatteryTipLoader loader = new BatteryTipLoader(context, batteryUsageStats);
final List<BatteryTip> batteryTips = loader.loadInBackground();
for (BatteryTip batteryTip : batteryTips) {
if (batteryTip.getState() != BatteryTip.StateType.INVISIBLE) {
context.getSharedPreferences(PREFS, MODE_PRIVATE).edit().putInt(KEY_CURRENT_TIPS_TYPE, batteryTip.getType()).putInt(KEY_CURRENT_TIPS_STATE, batteryTip.getState()).apply();
break;
}
}
return batteryTips;
}
Aggregations