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

Commit 23b1de11 authored by Shreyas Basarge's avatar Shreyas Basarge Committed by Android (Google) Code Review
Browse files

Merge "Run PeriodicJobs only if constraints are satisfied"

parents e0cbb65e 328d3660
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -255,10 +255,13 @@ public class JobStatus {
     * the constraints are satisfied <strong>or</strong> the deadline on the job has expired.
     */
    public synchronized boolean isReady() {
        // Deadline constraint trumps other constraints
        // Deadline constraint trumps other constraints (except for periodic jobs where deadline
        // (is an implementation detail. A periodic job should only run if it's constraints are
        // satisfied).
        // AppNotIdle implicit constraint trumps all!
        return (isConstraintsSatisfied()
                    || (hasDeadlineConstraint() && deadlineConstraintSatisfied.get()))
                    || (!job.isPeriodic()
                            && hasDeadlineConstraint() && deadlineConstraintSatisfied.get()))
                && appNotIdleConstraintSatisfied.get();
    }