Search in sources :

Example 1 with BatteryInfo

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

the class BatteryTipLoader method loadInBackground.

@Override
public List<BatteryTip> loadInBackground() {
    if (USE_FAKE_DATA) {
        return getFakeData();
    }
    final List<BatteryTip> tips = new ArrayList<>();
    final BatteryTipPolicy policy = new BatteryTipPolicy(getContext());
    final BatteryInfo batteryInfo = mBatteryUtils.getBatteryInfo(mBatteryStatsHelper, TAG);
    final Context context = getContext();
    tips.add(new LowBatteryDetector(context, policy, batteryInfo).detect());
    tips.add(new HighUsageDetector(context, policy, mBatteryStatsHelper, batteryInfo.discharging).detect());
    tips.add(new SmartBatteryDetector(policy, context.getContentResolver()).detect());
    tips.add(new EarlyWarningDetector(policy, context).detect());
    tips.add(new SummaryDetector(policy, batteryInfo.averageTimeToDischarge).detect());
    tips.add(new RestrictAppDetector(context, policy).detect());
    Collections.sort(tips);
    return tips;
}
Also used : Context(android.content.Context) HighUsageDetector(com.android.settings.fuelgauge.batterytip.detectors.HighUsageDetector) RestrictAppDetector(com.android.settings.fuelgauge.batterytip.detectors.RestrictAppDetector) BatteryInfo(com.android.settings.fuelgauge.BatteryInfo) LowBatteryDetector(com.android.settings.fuelgauge.batterytip.detectors.LowBatteryDetector) SmartBatteryDetector(com.android.settings.fuelgauge.batterytip.detectors.SmartBatteryDetector) ArrayList(java.util.ArrayList) SummaryDetector(com.android.settings.fuelgauge.batterytip.detectors.SummaryDetector) EarlyWarningDetector(com.android.settings.fuelgauge.batterytip.detectors.EarlyWarningDetector) LowBatteryTip(com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip) BatteryTip(com.android.settings.fuelgauge.batterytip.tips.BatteryTip)

Example 2 with BatteryInfo

use of com.android.settings.fuelgauge.BatteryInfo in project android_packages_apps_Settings by omnirom.

the class BatteryTipLoader method loadInBackground.

@Override
public List<BatteryTip> loadInBackground() {
    if (USE_FAKE_DATA) {
        return getFakeData();
    }
    final List<BatteryTip> tips = new ArrayList<>();
    final BatteryTipPolicy policy = new BatteryTipPolicy(getContext());
    final BatteryInfo batteryInfo = mBatteryUtils.getBatteryInfo(TAG);
    final Context context = getContext();
    tips.add(new LowBatteryDetector(context, policy, batteryInfo).detect());
    tips.add(new HighUsageDetector(context, policy, mBatteryUsageStats, batteryInfo).detect());
    tips.add(new SmartBatteryDetector(context, policy, batteryInfo, context.getContentResolver()).detect());
    tips.add(new EarlyWarningDetector(policy, context).detect());
    tips.add(new BatteryDefenderDetector(batteryInfo).detect());
    // Disable this feature now since it introduces false positive cases. We will try to improve
    // it in the future.
    // tips.add(new RestrictAppDetector(context, policy).detect());
    Collections.sort(tips);
    return tips;
}
Also used : Context(android.content.Context) HighUsageDetector(com.android.settings.fuelgauge.batterytip.detectors.HighUsageDetector) BatteryDefenderDetector(com.android.settings.fuelgauge.batterytip.detectors.BatteryDefenderDetector) BatteryInfo(com.android.settings.fuelgauge.BatteryInfo) LowBatteryDetector(com.android.settings.fuelgauge.batterytip.detectors.LowBatteryDetector) SmartBatteryDetector(com.android.settings.fuelgauge.batterytip.detectors.SmartBatteryDetector) ArrayList(java.util.ArrayList) EarlyWarningDetector(com.android.settings.fuelgauge.batterytip.detectors.EarlyWarningDetector) LowBatteryTip(com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip) BatteryTip(com.android.settings.fuelgauge.batterytip.tips.BatteryTip)

Aggregations

Context (android.content.Context)2 BatteryInfo (com.android.settings.fuelgauge.BatteryInfo)2 EarlyWarningDetector (com.android.settings.fuelgauge.batterytip.detectors.EarlyWarningDetector)2 HighUsageDetector (com.android.settings.fuelgauge.batterytip.detectors.HighUsageDetector)2 LowBatteryDetector (com.android.settings.fuelgauge.batterytip.detectors.LowBatteryDetector)2 SmartBatteryDetector (com.android.settings.fuelgauge.batterytip.detectors.SmartBatteryDetector)2 BatteryTip (com.android.settings.fuelgauge.batterytip.tips.BatteryTip)2 LowBatteryTip (com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip)2 ArrayList (java.util.ArrayList)2 BatteryDefenderDetector (com.android.settings.fuelgauge.batterytip.detectors.BatteryDefenderDetector)1 RestrictAppDetector (com.android.settings.fuelgauge.batterytip.detectors.RestrictAppDetector)1 SummaryDetector (com.android.settings.fuelgauge.batterytip.detectors.SummaryDetector)1