Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68d0689f authored by Kweku Adams's avatar Kweku Adams Committed by Android (Google) Code Review
Browse files

Merge "Remove satisfied timed jobs from the tracked list."

parents 5c2cf31f 3c3e645d
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -161,6 +161,7 @@ public final class TimeController extends StateController {
                    // Scheduler.
                    mStateChangedListener.onRunJobNow(job);
                }
                mTrackedJobs.remove(job);
                Counter.logIncrement(
                        "job_scheduler.value_job_scheduler_job_deadline_expired_counter");
            } else if (wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_DEADLINE)) {
@@ -174,8 +175,11 @@ public final class TimeController extends StateController {
                && job.getEarliestRunTime() <= mNextDelayExpiredElapsedMillis) {
            // Since this is just the delay, we don't need to rush the Scheduler to run the job
            // immediately if the constraint is satisfied here.
            if (!evaluateTimingDelayConstraint(job, nowElapsedMillis)
                    && wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_TIMING_DELAY)) {
            if (evaluateTimingDelayConstraint(job, nowElapsedMillis)) {
                if (canStopTrackingJobLocked(job)) {
                    mTrackedJobs.remove(job);
                }
            } else if (wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_TIMING_DELAY)) {
                // This job's delay is earlier than the current set alarm. Update the alarm.
                setDelayExpiredAlarmLocked(job.getEarliestRunTime(),
                        mService.deriveWorkSource(job.getSourceUid(), job.getSourcePackageName()));