Search in sources :

Example 1 with BatteryStatsHelperLoader

use of com.android.settings.fuelgauge.BatteryStatsHelperLoader in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BatteryFixSlice method refreshBatteryTips.

@WorkerThread
private static List<BatteryTip> refreshBatteryTips(Context context) {
    final BatteryStatsHelperLoader statsLoader = new BatteryStatsHelperLoader(context);
    final BatteryStatsHelper statsHelper = statsLoader.loadInBackground();
    final BatteryTipLoader loader = new BatteryTipLoader(context, statsHelper);
    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;
}
Also used : BatteryTipLoader(com.android.settings.fuelgauge.batterytip.BatteryTipLoader) BatteryStatsHelperLoader(com.android.settings.fuelgauge.BatteryStatsHelperLoader) BatteryStatsHelper(com.android.internal.os.BatteryStatsHelper) BatteryTip(com.android.settings.fuelgauge.batterytip.tips.BatteryTip) WorkerThread(androidx.annotation.WorkerThread)

Aggregations

WorkerThread (androidx.annotation.WorkerThread)1 BatteryStatsHelper (com.android.internal.os.BatteryStatsHelper)1 BatteryStatsHelperLoader (com.android.settings.fuelgauge.BatteryStatsHelperLoader)1 BatteryTipLoader (com.android.settings.fuelgauge.batterytip.BatteryTipLoader)1 BatteryTip (com.android.settings.fuelgauge.batterytip.tips.BatteryTip)1