@Test public void verifyRequirementsEnforcedSkipsJob() { long time = 1L; final AtomicBoolean atomicBoolean = new AtomicBoolean(true); manager().addJobCreator(new JobCreator() { @Override public Job create(@NonNull String tag) { return new DailyJob() { @NonNull @Override protected DailyJobResult onRunDailyJob(@NonNull Params params) { atomicBoolean.set(false); return DailyJobResult.SUCCESS; } }; } }); int jobId = DailyJob.schedule(new JobRequest.Builder("any").setRequiresCharging(true).setRequirementsEnforced(true), time, time); assertThat(manager().getAllJobRequests()).hasSize(1); executeJob(jobId, Job.Result.SUCCESS); assertThat(manager().getAllJobRequests()).hasSize(1); assertThat(atomicBoolean.get()).isTrue(); manager().cancelAll(); jobId = DailyJob.schedule(new JobRequest.Builder("any").setRequiresCharging(false).setRequirementsEnforced(true), time, time); assertThat(manager().getAllJobRequests()).hasSize(1); executeJob(jobId, Job.Result.SUCCESS); assertThat(manager().getAllJobRequests()).hasSize(1); assertThat(atomicBoolean.get()).isFalse(); }
public static int schedule(@NonNull JobRequest.Builder baseBuilder, long startMs, long endMs) { return schedule(baseBuilder, true, startMs, endMs, false); }
DailyJob extends Job { public static int schedule(@NonNull JobRequest.Builder baseBuilder, long startMs, long endMs) { return schedule(baseBuilder, true, startMs, endMs, false); } }
DailyJob extends Job { public static int schedule(@NonNull JobRequest.Builder baseBuilder, long startMs, long endMs) { return schedule(baseBuilder, true, startMs, endMs, false); }  }
DailyJob extends Job { public static int schedule(@NonNull JobRequest.Builder baseBuilder, long startMs, long endMs) { return schedule(baseBuilder, true, startMs, endMs, false); }  static int schedule(@NonNull JobRequest.Builder baseBuilder, long startMs, long endMs); static void scheduleAsync(@NonNull JobRequest.Builder baseBuilder, long startMs, long endMs); static void scheduleAsync(@NonNull final JobRequest.Builder baseBuilder, final long startMs, final long endMs,
                                     @NonNull final JobRequest.JobScheduledCallback callback); static int startNowOnce(@NonNull JobRequest.Builder baseBuilder); }
DailyJob extends Job { public static int schedule(@NonNull JobRequest.Builder baseBuilder, long startMs, long endMs) { return schedule(baseBuilder, true, startMs, endMs, false); }  static int schedule(@NonNull JobRequest.Builder baseBuilder, long startMs, long endMs); static void scheduleAsync(@NonNull JobRequest.Builder baseBuilder, long startMs, long endMs); static void scheduleAsync(@NonNull final JobRequest.Builder baseBuilder, final long startMs, final long endMs,
                                     @NonNull final JobRequest.JobScheduledCallback callback); static int startNowOnce(@NonNull JobRequest.Builder baseBuilder);  }