@Override protected void plantOneOffFlexSupport(JobRequest request, AlarmManager alarmManager, PendingIntent pendingIntent) { long currentTime = System.currentTimeMillis(); long startMs = currentTime + Common.getStartMsSupportFlex(request); long lengthMs = Common.getEndMsSupportFlex(request) - Common.getStartMsSupportFlex(request); alarmManager.setWindow(AlarmManager.RTC, startMs, lengthMs, pendingIntent); mCat.d("Scheduled repeating alarm (flex support), %s, start %s, end %s, flex %s", request, JobUtil.timeToString(Common.getStartMsSupportFlex(request)), JobUtil.timeToString(Common.getEndMsSupportFlex(request)), JobUtil.timeToString(request.getFlexMs())); } }
@Override protected void plantOneOffFlexSupport(JobRequest request, AlarmManager alarmManager, PendingIntent pendingIntent) { long currentTime = System.currentTimeMillis(); long startMs = currentTime + Common.getStartMsSupportFlex(request); long lengthMs = Common.getEndMsSupportFlex(request) - Common.getStartMsSupportFlex(request); alarmManager.setWindow(AlarmManager.RTC, startMs, lengthMs, pendingIntent); mCat.d("Scheduled repeating alarm (flex support), %s, start %s, end %s, flex %s", request, JobUtil.timeToString(Common.getStartMsSupportFlex(request)), JobUtil.timeToString(Common.getEndMsSupportFlex(request)), JobUtil.timeToString(request.getFlexMs())); } }
public static long getAverageDelayMsSupportFlex(JobRequest request) { return checkedAdd(getStartMsSupportFlex(request), (getEndMsSupportFlex(request) - getStartMsSupportFlex(request)) / 2); }
@Override public void plantPeriodicFlexSupport(JobRequest request) { long startMs = Common.getStartMsSupportFlex(request); long endMs = Common.getEndMsSupportFlex(request); JobInfo jobInfo = createBuilderOneOff(createBaseBuilder(request, true), startMs, endMs).build(); int scheduleResult = schedule(jobInfo); if (scheduleResult == ERROR_BOOT_PERMISSION) { jobInfo = createBuilderOneOff(createBaseBuilder(request, false), startMs, endMs).build(); scheduleResult = schedule(jobInfo); } mCat.d("Schedule periodic (flex support) jobInfo %s, %s, start %s, end %s, flex %s", scheduleResultToString(scheduleResult), request, JobUtil.timeToString(startMs), JobUtil.timeToString(endMs), JobUtil.timeToString(request.getFlexMs())); }
public static long getAverageDelayMsSupportFlex(JobRequest request) { return checkedAdd(getStartMsSupportFlex(request), (getEndMsSupportFlex(request) - getStartMsSupportFlex(request)) / 2); }
@Override public void plantPeriodicFlexSupport(JobRequest request) { long startMs = Common.getStartMsSupportFlex(request); long endMs = Common.getEndMsSupportFlex(request); JobInfo jobInfo = createBuilderOneOff(createBaseBuilder(request, true), startMs, endMs).build(); int scheduleResult = schedule(jobInfo); if (scheduleResult == ERROR_BOOT_PERMISSION) { jobInfo = createBuilderOneOff(createBaseBuilder(request, false), startMs, endMs).build(); scheduleResult = schedule(jobInfo); } mCat.d("Schedule periodic (flex support) jobInfo %s, %s, start %s, end %s, flex %s", scheduleResultToString(scheduleResult), request, JobUtil.timeToString(startMs), JobUtil.timeToString(endMs), JobUtil.timeToString(request.getFlexMs())); }