Search in sources :

Example 1 with PowerWhitelistBackend

use of com.android.settingslib.fuelgauge.PowerWhitelistBackend in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AnomalyDetectionJobService method onStartJob.

@Override
public boolean onStartJob(JobParameters params) {
    synchronized (mLock) {
        mIsJobCanceled = false;
    }
    ThreadUtils.postOnBackgroundThread(() -> {
        final Context context = AnomalyDetectionJobService.this;
        final BatteryDatabaseManager batteryDatabaseManager = BatteryDatabaseManager.getInstance(this);
        final BatteryTipPolicy policy = new BatteryTipPolicy(this);
        final BatteryUtils batteryUtils = BatteryUtils.getInstance(this);
        final ContentResolver contentResolver = getContentResolver();
        final UserManager userManager = getSystemService(UserManager.class);
        final PowerWhitelistBackend powerWhitelistBackend = PowerWhitelistBackend.getInstance(context);
        final PowerUsageFeatureProvider powerUsageFeatureProvider = FeatureFactory.getFactory(this).getPowerUsageFeatureProvider(this);
        final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(this).getMetricsFeatureProvider();
        for (JobWorkItem item = dequeueWork(params); item != null; item = dequeueWork(params)) {
            saveAnomalyToDatabase(context, userManager, batteryDatabaseManager, batteryUtils, policy, powerWhitelistBackend, contentResolver, powerUsageFeatureProvider, metricsFeatureProvider, item.getIntent().getExtras());
            completeWork(params, item);
        }
    });
    return true;
}
Also used : Context(android.content.Context) MetricsFeatureProvider(com.android.settingslib.core.instrumentation.MetricsFeatureProvider) UserManager(android.os.UserManager) PowerUsageFeatureProvider(com.android.settings.fuelgauge.PowerUsageFeatureProvider) PowerWhitelistBackend(com.android.settingslib.fuelgauge.PowerWhitelistBackend) BatteryUtils(com.android.settings.fuelgauge.BatteryUtils) JobWorkItem(android.app.job.JobWorkItem) ContentResolver(android.content.ContentResolver)

Aggregations

JobWorkItem (android.app.job.JobWorkItem)1 ContentResolver (android.content.ContentResolver)1 Context (android.content.Context)1 UserManager (android.os.UserManager)1 BatteryUtils (com.android.settings.fuelgauge.BatteryUtils)1 PowerUsageFeatureProvider (com.android.settings.fuelgauge.PowerUsageFeatureProvider)1 MetricsFeatureProvider (com.android.settingslib.core.instrumentation.MetricsFeatureProvider)1 PowerWhitelistBackend (com.android.settingslib.fuelgauge.PowerWhitelistBackend)1