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

Commit 7820b0da authored by Kweku Adams's avatar Kweku Adams
Browse files

Reevaluate constraints on run command.

Reevaluate a UID's constraints when "cmd jobscheduler run" is called so
that the latest constraint status is used.

Bug: 138253466
Test: atest CtsJobSchedulerTestCases
Change-Id: Ib9301a55ac54d3c1b8b738615be3e9f6e649b7e8
parent 3b2dccfc
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -2833,6 +2833,13 @@ public class JobSchedulerService extends com.android.server.SystemService
                }
                }


                js.overrideState = (force) ? JobStatus.OVERRIDE_FULL : JobStatus.OVERRIDE_SOFT;
                js.overrideState = (force) ? JobStatus.OVERRIDE_FULL : JobStatus.OVERRIDE_SOFT;

                // Re-evaluate constraints after the override is set in case one of the overridden
                // constraints was preventing another constraint from thinking it needed to update.
                for (int c = mControllers.size() - 1; c >= 0; --c) {
                    mControllers.get(c).reevaluateStateLocked(uid);
                }

                if (!js.isConstraintsSatisfied()) {
                if (!js.isConstraintsSatisfied()) {
                    js.overrideState = 0;
                    js.overrideState = 0;
                    return JobSchedulerShellCommand.CMD_ERR_CONSTRAINTS;
                    return JobSchedulerShellCommand.CMD_ERR_CONSTRAINTS;