@Test public void testStopJobStopsJob() { DeviceTestUtils.setCharging(application, true); JobInfo job = JobCreator.create(application, 2000).setRequiresCharging(true).build(); JobStatus jobStatus = JobStatus.createFromJobInfo(job, getSchedulerTag()); jobStore.add(jobStatus); executeService(job.getId()); assertBoundServiceCount(1); service.onStopJob(ShadowJobParameters.newInstance(jobStore.getJob(job.getId()))); assertBoundServiceCount(0); }
@Override public boolean onStopJob(android.app.job.JobParameters params) { Connection connection = connections.get(params.getJobId()); if (connection != null) { JobService.Binder binder = connection.binder; boolean needsReschedule = binder != null && binder.stopJob(toLocalParameters(connection.params, connection.transientExtras)); stopJob(connection, needsReschedule); return needsReschedule; } else { return false; } }
JobSchedulerJobService extends android.app.job.JobService implements JobService.Binder.Callback { @Override public boolean onStopJob(android.app.job.JobParameters params) { Connection connection = connections.get(params.getJobId()); if (connection != null) { JobService.Binder binder = connection.binder; boolean needsReschedule = binder != null && binder.stopJob(toLocalParameters(connection.params, connection.transientExtras)); stopJob(connection, needsReschedule); return needsReschedule; } else { return false; } } }
JobSchedulerJobService extends android.app.job.JobService implements JobService.Binder.Callback { @Override public boolean onStopJob(android.app.job.JobParameters params) { Connection connection = connections.get(params.getJobId()); if (connection != null) { JobService.Binder binder = connection.binder; boolean needsReschedule = binder != null && binder.stopJob(toLocalParameters(connection.params, connection.transientExtras)); stopJob(connection, needsReschedule); return needsReschedule; } else { return false; } }  }
JobSchedulerJobService extends android.app.job.JobService implements JobService.Binder.Callback { @Override public boolean onStopJob(android.app.job.JobParameters params) { Connection connection = connections.get(params.getJobId()); if (connection != null) { JobService.Binder binder = connection.binder; boolean needsReschedule = binder != null && binder.stopJob(toLocalParameters(connection.params, connection.transientExtras)); stopJob(connection, needsReschedule); return needsReschedule; } else { return false; } }  @Override void onCreate(); @Override boolean onStartJob(android.app.job.JobParameters params); @Override boolean onStopJob(android.app.job.JobParameters params); @Override void jobFinished(JobParameters params, boolean needsReschedule); }
JobSchedulerJobService extends android.app.job.JobService implements JobService.Binder.Callback { @Override public boolean onStopJob(android.app.job.JobParameters params) { Connection connection = connections.get(params.getJobId()); if (connection != null) { JobService.Binder binder = connection.binder; boolean needsReschedule = binder != null && binder.stopJob(toLocalParameters(connection.params, connection.transientExtras)); stopJob(connection, needsReschedule); return needsReschedule; } else { return false; } }  @Override void onCreate(); @Override boolean onStartJob(android.app.job.JobParameters params); @Override boolean onStopJob(android.app.job.JobParameters params); @Override void jobFinished(JobParameters params, boolean needsReschedule);  }