public boolean scheduleJob() {
    long now = SystemClock.uptimeMillis();
    long when = 0;
    boolean shouldEnqueue = false;
    synchronized (this) {
      if (!shouldProcess(mEncodedImage, mStatus)) {
        return false;
      }
      switch (mJobState) {
        case IDLE:
          when = Math.max(mJobStartTime + mMinimumJobIntervalMs, now);
          shouldEnqueue = true;
          mJobSubmitTime = now;
          mJobState = JobState.QUEUED;
          break;
        case QUEUED:
          // do nothing, the job is already queued
          break;
        case RUNNING:
          mJobState = JobState.RUNNING_AND_PENDING;
          break;
        case RUNNING_AND_PENDING:
          // do nothing, the next job is already pending
          break;
      }
    }
    if (shouldEnqueue) {
      enqueueJob(when - now);
    }
    return true;
  }
public boolean scheduleJob ( ) { long now = SystemClock . uptimeMillis ( ) ; long when = 0 ; boolean shouldEnqueue = false ; synchronized ( this ) { if ( ! shouldProcess ( mEncodedImage , mStatus ) ) { return false ; } switch ( mJobState ) { case IDLE : when = Math . max ( mJobStartTime + mMinimumJobIntervalMs , now ) ; shouldEnqueue = true ; mJobSubmitTime = now ; mJobState = JobState . QUEUED ; break ; case QUEUED : break ; case RUNNING : mJobState = JobState . RUNNING_AND_PENDING ; break ; case RUNNING_AND_PENDING : break ; } } if ( shouldEnqueue ) { enqueueJob ( when - now ) ; } return true ; }
Schedules the currently set job (if any).

<p> This method can be called multiple times. It is guaranteed that each job set will be
executed no more than once. It is guaranteed that the last job set will be executed, unless
the job was cleared first.
<p> The job will be scheduled no sooner than <code>minimumJobIntervalMs</code> milliseconds
since the last job started.

@return true if the job was scheduled, false if there was no valid job to be scheduled