use of android.app.job.JobWorkItem in project android_packages_apps_Dialer by LineageOS.
the class TranscriptionService method makeWorkItem.
private static JobWorkItem makeWorkItem(Uri voicemailUri) {
Intent intent = new Intent();
intent.putExtra(EXTRA_VOICEMAIL_URI, voicemailUri);
return new JobWorkItem(intent);
}
use of android.app.job.JobWorkItem in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AnomalyDetectionJobService method scheduleAnomalyDetection.
public static void scheduleAnomalyDetection(Context context, Intent intent) {
final JobScheduler jobScheduler = context.getSystemService(JobScheduler.class);
final ComponentName component = new ComponentName(context, AnomalyDetectionJobService.class);
final JobInfo.Builder jobBuilder = new JobInfo.Builder(R.integer.job_anomaly_detection, component).setOverrideDeadline(MAX_DELAY_MS);
if (jobScheduler.enqueue(jobBuilder.build(), new JobWorkItem(intent)) != JobScheduler.RESULT_SUCCESS) {
Log.i(TAG, "Anomaly detection job service enqueue failed.");
}
}
use of android.app.job.JobWorkItem 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;
}
use of android.app.job.JobWorkItem in project android_packages_apps_Settings by omnirom.
the class AnomalyDetectionJobService method scheduleAnomalyDetection.
public static void scheduleAnomalyDetection(Context context, Intent intent) {
final JobScheduler jobScheduler = context.getSystemService(JobScheduler.class);
final ComponentName component = new ComponentName(context, AnomalyDetectionJobService.class);
final JobInfo.Builder jobBuilder = new JobInfo.Builder(R.integer.job_anomaly_detection, component).setOverrideDeadline(MAX_DELAY_MS);
if (jobScheduler.enqueue(jobBuilder.build(), new JobWorkItem(intent)) != JobScheduler.RESULT_SUCCESS) {
Log.i(TAG, "Anomaly detection job service enqueue failed.");
}
}
use of android.app.job.JobWorkItem in project android_packages_apps_Dialer by LineageOS.
the class DeviceProvisionedJobService method activateAfterProvisioned.
/**
* Queue the phone account to be reactivated after the setup wizard has completed.
*/
public static void activateAfterProvisioned(Context context, PhoneAccountHandle phoneAccountHandle) {
Intent intent = new Intent();
intent.putExtra(EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle);
context.getSystemService(JobScheduler.class).enqueue(createJobInfo(context), new JobWorkItem(intent));
}
Aggregations