use of com.android.internal.os.BatteryStatsHelper in project android_packages_apps_Settings by SudaMod.
the class AnomalyLoader method loadInBackground.
@Override
public List<Anomaly> loadInBackground() {
if (USE_FAKE_DATA) {
return generateFakeData();
}
if (mBatteryStatsHelper == null) {
mBatteryStatsHelper = new BatteryStatsHelper(getContext());
mBatteryStatsHelper.create((Bundle) null);
mBatteryStatsHelper.refreshStats(BatteryStats.STATS_SINCE_CHARGED, mUserManager.getUserProfiles());
}
return mAnomalyUtils.detectAnomalies(mBatteryStatsHelper, mPolicy, mPackageName);
}
use of com.android.internal.os.BatteryStatsHelper in project android_packages_apps_Settings by DirtyUnicorns.
the class BatteryInfo method getBatteryInfo.
public static void getBatteryInfo(final Context context, final Callback callback, boolean shortString) {
final long startTime = System.currentTimeMillis();
BatteryStatsHelper statsHelper = new BatteryStatsHelper(context, true);
statsHelper.create((Bundle) null);
BatteryUtils.logRuntime(LOG_TAG, "time to make batteryStatsHelper", startTime);
BatteryInfo.getBatteryInfo(context, callback, statsHelper, shortString);
}
use of com.android.internal.os.BatteryStatsHelper in project platform_packages_apps_Settings by BlissRoms.
the class BatteryStatsHelperLoader method loadInBackground.
@Override
public BatteryStatsHelper loadInBackground() {
Context context = getContext();
final BatteryStatsHelper statsHelper = new BatteryStatsHelper(context, true);
mBatteryUtils.initBatteryStatsHelper(statsHelper, null, /* bundle */
mUserManager);
return statsHelper;
}
use of com.android.internal.os.BatteryStatsHelper in project android_packages_apps_Settings by SudaMod.
the class BatteryStatsHelperLoader method loadInBackground.
@Override
public BatteryStatsHelper loadInBackground() {
Context context = getContext();
final BatteryStatsHelper statsHelper = new BatteryStatsHelper(context, true);
mBatteryUtils.initBatteryStatsHelper(statsHelper, null, /* bundle */
mUserManager);
return statsHelper;
}
use of com.android.internal.os.BatteryStatsHelper in project android_packages_apps_Settings by SudaMod.
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;
}
Aggregations