@Test public void configureJob_withDefaults_shouldSetCorrectFlags() { ComponentName serviceComponent = new ComponentName(RuntimeEnvironment.application, JobInfoSchedulerService.class); SchedulerConfig config = createConfig(Collections.emptySet(), DELTA); JobInfo job = config .configureJob(new JobInfo.Builder(1, serviceComponent), Priority.DEFAULT, 0, 1) .build(); assertThat(job.getNetworkType()).isEqualTo(JobInfo.NETWORK_TYPE_ANY); assertThat(job.isRequireDeviceIdle()).isFalse(); assertThat(job.isRequireCharging()).isFalse(); }
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public JobInfo.Builder configureJob( JobInfo.Builder builder, Priority priority, long minimumTimestamp, int attemptNumber) { long latency = getScheduleDelay(priority, minimumTimestamp, attemptNumber); builder.setMinimumLatency(latency); populateFlags(builder, getValues().get(priority).getFlags()); return builder; }
SchedulerConfig { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public JobInfo.Builder configureJob( JobInfo.Builder builder, Priority priority, long minimumTimestamp, int attemptNumber) { long latency = getScheduleDelay(priority, minimumTimestamp, attemptNumber); builder.setMinimumLatency(latency); populateFlags(builder, getValues().get(priority).getFlags()); return builder; } }
SchedulerConfig { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public JobInfo.Builder configureJob( JobInfo.Builder builder, Priority priority, long minimumTimestamp, int attemptNumber) { long latency = getScheduleDelay(priority, minimumTimestamp, attemptNumber); builder.setMinimumLatency(latency); populateFlags(builder, getValues().get(priority).getFlags()); return builder; }  }
SchedulerConfig { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public JobInfo.Builder configureJob( JobInfo.Builder builder, Priority priority, long minimumTimestamp, int attemptNumber) { long latency = getScheduleDelay(priority, minimumTimestamp, attemptNumber); builder.setMinimumLatency(latency); populateFlags(builder, getValues().get(priority).getFlags()); return builder; }  static SchedulerConfig getDefault(Clock clock); static SchedulerConfig.Builder builder(); long getScheduleDelay(Priority priority, long minTimestamp, int attemptNumber); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) JobInfo.Builder configureJob(
      JobInfo.Builder builder, Priority priority, long minimumTimestamp, int attemptNumber); Set<Flag> getFlags(Priority priority); }
SchedulerConfig { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public JobInfo.Builder configureJob( JobInfo.Builder builder, Priority priority, long minimumTimestamp, int attemptNumber) { long latency = getScheduleDelay(priority, minimumTimestamp, attemptNumber); builder.setMinimumLatency(latency); populateFlags(builder, getValues().get(priority).getFlags()); return builder; }  static SchedulerConfig getDefault(Clock clock); static SchedulerConfig.Builder builder(); long getScheduleDelay(Priority priority, long minTimestamp, int attemptNumber); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) JobInfo.Builder configureJob(
      JobInfo.Builder builder, Priority priority, long minimumTimestamp, int attemptNumber); Set<Flag> getFlags(Priority priority);  }