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

Commit 328d3660 authored by Shreyas Basarge's avatar Shreyas Basarge
Browse files

Run PeriodicJobs only if constraints are satisfied

JobScheduler would run periodic jobs when their period
expired irrespective of whether constraints were
satisfied. This behavior is now changed to run periodic
jobs only when its constraints are satisfied.

Bug: 26735826
Change-Id: Iffd3cf7f37f1f1c8ef3a1bf4535d893cd139c158
parent c1b92381
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -233,10 +233,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();
    }