From 63fd529be004df0413731782aaba03e0fd7abfdb Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Mon, 23 Apr 2018 17:05:58 -0700 Subject: [PATCH] Don't automatically decline tracking jobs with met initial delays Just an already-satisfied initial delay doesn't let us decline to track the (new) job: it might not actually be runnable yet, and if it has a deadline as well, we definitely need to track it. If it has no deadline, though, then a met initial delay means that the TimeController can indeed safely just mark the delay constraint as met and stop tracking it. Change-Id: I20919fa384c1fcb1c619efb8f05b8ba856ed44b3 Fixes: 77233219 Test: atest CtsJobSchedulerTestCases:TimingConstraintsTest --- .../com/android/server/job/controllers/TimeController.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/job/controllers/TimeController.java b/services/core/java/com/android/server/job/controllers/TimeController.java index fa48b5e974f6e..04d579500df9b 100644 --- a/services/core/java/com/android/server/job/controllers/TimeController.java +++ b/services/core/java/com/android/server/job/controllers/TimeController.java @@ -90,7 +90,10 @@ public final class TimeController extends StateController { return; } else if (job.hasTimingDelayConstraint() && evaluateTimingDelayConstraint(job, nowElapsedMillis)) { - return; + if (!job.hasDeadlineConstraint()) { + // If it doesn't have a deadline, we'll never have to touch it again. + return; + } } boolean isInsert = false;