Search in sources :

Example 1 with PowerAllowlistBackend

use of com.android.settingslib.fuelgauge.PowerAllowlistBackend in project android_packages_apps_Settings by omnirom.

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 PowerAllowlistBackend powerAllowlistBackend = PowerAllowlistBackend.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, powerAllowlistBackend, 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) PowerAllowlistBackend(com.android.settingslib.fuelgauge.PowerAllowlistBackend) PowerUsageFeatureProvider(com.android.settings.fuelgauge.PowerUsageFeatureProvider) 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 PowerAllowlistBackend (com.android.settingslib.fuelgauge.PowerAllowlistBackend)1