nl_tokens: Called after a periodic has executed so we can to re - add it . We take the last execution time of the job to be the time of completion ( i . e . the time at which this function is called ) . This could be inaccurate b / c the job can run for as long as {
pl_tokens: private JobStatus reschedulePeriodicJob ( JobStatus job ) { final long elapsedNow = SystemClock . elapsedRealtime ( ) ; // Compute how much of the period is remaining. long runEarly = Math . <mask> ( job . getLatestRunTimeElapsed ( ) - elapsedNow , 0 ) ; long newEarliestRunTimeElapsed = elapsedNow + runEarly ; long period = job . getJob ( ) . getIntervalMillis ( ) ; long newLatestRuntimeElapsed = newEarliestRunTimeElapsed + period ; return new JobStatus ( job , newEarliestRunTimeElapsed , newLatestRuntimeElapsed , 0 /* backoffAttempt */ ) ; }