use of android.app.job.JobWorkItem in project android_packages_apps_Dialer by LineageOS.
the class TranscriptionBackfillService method makeWorkItem.
private static JobWorkItem makeWorkItem(PhoneAccountHandle account) {
Intent intent = new Intent();
intent.putExtra(TranscriptionService.EXTRA_ACCOUNT_HANDLE, account);
return new JobWorkItem(intent);
}
use of android.app.job.JobWorkItem in project android_packages_apps_Dialer by LineageOS.
the class TranscriptionRatingService method makeWorkItem.
private static JobWorkItem makeWorkItem(SendTranscriptionFeedbackRequest request) {
Intent intent = new Intent();
intent.putExtra(FEEDBACK_REQUEST_EXTRA, request.toByteArray());
return new JobWorkItem(intent);
}
use of android.app.job.JobWorkItem in project android_packages_apps_Dialer by LineageOS.
the class TranscriptionService method transcribeVoicemail.
// Schedule a task to transcribe the indicated voicemail, return true if transcription task was
// scheduled.
public static boolean transcribeVoicemail(Context context, Uri voicemailUri) {
Assert.isMainThread();
if (BuildCompat.isAtLeastO()) {
LogUtil.i("TranscriptionService.transcribeVoicemail", "scheduling transcription");
ComponentName componentName = new ComponentName(context, TranscriptionService.class);
JobInfo.Builder builder = new JobInfo.Builder(ScheduledJobIds.VVM_TRANSCRIPTION_JOB, componentName).setMinimumLatency(0).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY);
JobScheduler scheduler = context.getSystemService(JobScheduler.class);
JobWorkItem workItem = makeWorkItem(voicemailUri);
return scheduler.enqueue(builder.build(), workItem) == JobScheduler.RESULT_SUCCESS;
} else {
LogUtil.i("TranscriptionService.transcribeVoicemail", "not supported");
return false;
}
}
use of android.app.job.JobWorkItem in project robolectric by robolectric.
the class ShadowJobSchedulerTest method enqueue_success.
@Test
@Config(minSdk = O)
public void enqueue_success() {
int result = jobScheduler.enqueue(new JobInfo.Builder(99, new ComponentName(context, "component_class_name")).setPeriodic(1000).build(), new JobWorkItem(new Intent()));
assertThat(result).isEqualTo(JobScheduler.RESULT_SUCCESS);
}
use of android.app.job.JobWorkItem in project robolectric by robolectric.
the class ShadowJobSchedulerTest method enqueue_fail.
@Test
@Config(minSdk = O)
public void enqueue_fail() {
shadowOf(jobScheduler).failOnJob(99);
int result = jobScheduler.enqueue(new JobInfo.Builder(99, new ComponentName(context, "component_class_name")).setPeriodic(1000).build(), new JobWorkItem(new Intent()));
assertThat(result).isEqualTo(JobScheduler.RESULT_FAILURE);
}
Aggregations