work/workmanager/src/main/java/androidx/work/impl/model/WorkSpec.java
public long calculateNextRunTime() {
        if (isBackedOff()) {
            boolean isLinearBackoff = (backoffPolicy == BackoffPolicy.LINEAR);
            long delay = isLinearBackoff ? (backoffDelayDuration * runAttemptCount)
                    : (long) Math.scalb(backoffDelayDuration, runAttemptCount - 1);
            return periodStartTime + Math.min(WorkRequest.MAX_BACKOFF_MILLIS, delay);
        } else if (isPeriodic()) {
            return periodStartTime + intervalDuration - flexDuration;
        } else {
            return periodStartTime + initialDelay;
        }
    }
/**
     * Calculates the UTC time at which this {@link WorkSpec} should be allowed to run.
     * This method accounts for work that is backed off or periodic.
     *
     * If Backoff Policy is set to {@link BackoffPolicy#EXPONENTIAL}, then delay
     * increases at an exponential rate with respect to the run attempt count and is capped at
     * {@link WorkRequest#MAX_BACKOFF_MILLIS}.
     *
     * If Backoff Policy is set to {@link BackoffPolicy#LINEAR}, then delay
     * increases at an linear rate with respect to the run attempt count and is capped at
     * {@link WorkRequest#MAX_BACKOFF_MILLIS}.
     *
     * Based on {@see https://android.googlesource.com/platform/frameworks/base/+/master/services/core/java/com/android/server/job/JobSchedulerService.java#1125}
     *
     * Note that this runtime is for WorkManager internal use and may not match what the OS
     * considers to be the next runtime.
     *
     * For jobs with constraints, this represents the earliest time at which constraints
     * should be monitored for this work.
     *
     * For jobs without constraints, this represents the earliest time at which this work is
     * allowed to run.
     *
     * @return UTC time at which this {@link WorkSpec} should be allowed to run.
     */
Calculates the UTC time at which this  WorkSpec should be allowed to run.
This method accounts for work that is backed off or periodic.

If Backoff Policy is set to  BackoffPolicy#EXPONENTIAL, then delay
increases at an exponential rate with respect to the run attempt count and is capped at
WorkRequest#MAX_BACKOFF_MILLIS.

If Backoff Policy is set to  BackoffPolicy#LINEAR, then delay
increases at an linear rate with respect to the run attempt count and is capped at
WorkRequest#MAX_BACKOFF_MILLIS.



Note that this runtime is for WorkManager internal use and may not match what the OS
considers to be the next runtime.

For jobs with constraints, this represents the earliest time at which constraints
should be monitored for this work.

For jobs without constraints, this represents the earliest time at which this work is
allowed to run.

@return UTC time at which this  WorkSpec should be allowed to run.
Calculates the UTC time at which this WorkSpec should be allowed to run . This method accounts for work that is backed off or periodic . If Backoff Policy is set to BackoffPolicy#EXPONENTIAL then delay increases at an exponential rate with respect to the run attempt count and is capped at WorkRequest#MAX_BACKOFF_MILLIS . If Backoff Policy is set to BackoffPolicy#LINEAR then delay increases at an linear rate with respect to the run attempt count and is capped at WorkRequest#MAX_BACKOFF_MILLIS . Note that this runtime is for WorkManager internal use and may not match what the OS considers to be the next runtime . For jobs with constraints this represents the earliest time at which constraints should be monitored for this work . For jobs without constraints this represents the earliest time at which this work is allowed to run . @return UTC time at which this WorkSpec should be allowed to run .
public long calculateNextRunTime() {
        if (isBackedOff()) {
            boolean isLinearBackoff = (backoffPolicy == BackoffPolicy.LINEAR);
            long delay = isLinearBackoff ? (backoffDelayDuration * runAttemptCount)
                    : (long) Math.scalb(backoffDelayDuration, runAttemptCount - 1);
            return periodStartTime + Math.min(WorkRequest.MAX_BACKOFF_MILLIS, delay);
        } else if (isPeriodic()) {
            return periodStartTime + intervalDuration - flexDuration;
        } else {
            return periodStartTime + initialDelay;
        }
    }
public long calculateNextRunTime ( ) { if ( isBackedOff ( ) ) { boolean isLinearBackoff = ( backoffPolicy == BackoffPolicy . LINEAR ) ; long delay = isLinearBackoff ? ( backoffDelayDuration * runAttemptCount ) : ( long ) Math . scalb ( backoffDelayDuration , runAttemptCount - 1 ) ; return periodStartTime + Math . min ( WorkRequest . MAX_BACKOFF_MILLIS , delay ) ; } else if ( isPeriodic ( ) ) { return periodStartTime + intervalDuration - flexDuration ; } else { return periodStartTime + initialDelay ; } }
Calculates the UTC time at which this {@link WorkSpec} should be allowed to run.
Calculates the UTC time at which this { @link WorkSpec } should be allowed to run .