@Test public void testJobRescheduledPassesUriAuthorityForward() { Uri changedUri = job.getTriggerContentUris()[0].getUri(); String changedAuthority = changedUri.getAuthority(); JobStatus failedJobStatus = new JobStatus(job, AlarmScheduler.TAG, 0, 0); failedJobStatus.changedUris = Collections.singleton(changedUri); failedJobStatus.changedAuthorities = Collections.singleton(changedAuthority); JobStatus newJobStatus = new JobStatus(job, AlarmScheduler.TAG, 0, 0); scheduler.onJobRescheduled(newJobStatus, failedJobStatus); assertThat(newJobStatus.changedUris, hasItem(changedUri)); assertThat(newJobStatus.changedAuthorities, hasItem(changedAuthority)); }
@Override public void onJobRescheduled(JobStatus newJob, JobStatus failedJob) { if (failedJob.hasContentTriggerConstraint() && newJob.hasContentTriggerConstraint()) { newJob.changedAuthorities = failedJob.changedAuthorities; newJob.changedUris = failedJob.changedUris; } }
AlarmScheduler extends Scheduler { @Override public void onJobRescheduled(JobStatus newJob, JobStatus failedJob) { if (failedJob.hasContentTriggerConstraint() && newJob.hasContentTriggerConstraint()) { newJob.changedAuthorities = failedJob.changedAuthorities; newJob.changedUris = failedJob.changedUris; } } }
AlarmScheduler extends Scheduler { @Override public void onJobRescheduled(JobStatus newJob, JobStatus failedJob) { if (failedJob.hasContentTriggerConstraint() && newJob.hasContentTriggerConstraint()) { newJob.changedAuthorities = failedJob.changedAuthorities; newJob.changedUris = failedJob.changedUris; } } AlarmScheduler(Context context); }
AlarmScheduler extends Scheduler { @Override public void onJobRescheduled(JobStatus newJob, JobStatus failedJob) { if (failedJob.hasContentTriggerConstraint() && newJob.hasContentTriggerConstraint()) { newJob.changedAuthorities = failedJob.changedAuthorities; newJob.changedUris = failedJob.changedUris; } } AlarmScheduler(Context context); @Override int schedule(JobInfo job); @Override void cancel(int jobId); @Override void cancelAll(); @Override void onJobCompleted(int jobId, boolean needsReschedule); @NonNull @Override String getTag(); @Override void onJobRescheduled(JobStatus newJob, JobStatus failedJob); }
AlarmScheduler extends Scheduler { @Override public void onJobRescheduled(JobStatus newJob, JobStatus failedJob) { if (failedJob.hasContentTriggerConstraint() && newJob.hasContentTriggerConstraint()) { newJob.changedAuthorities = failedJob.changedAuthorities; newJob.changedUris = failedJob.changedUris; } } AlarmScheduler(Context context); @Override int schedule(JobInfo job); @Override void cancel(int jobId); @Override void cancelAll(); @Override void onJobCompleted(int jobId, boolean needsReschedule); @NonNull @Override String getTag(); @Override void onJobRescheduled(JobStatus newJob, JobStatus failedJob); static final String TAG; }