Fix TimingConstraintTest.
Since JS batches the delay constraint alarm, the delay test may run into
a case where the job won't have its delay constraint satisfied until
after the test timeout. We can avoid issues if we wait for the delay time
before forcing JS to evaluate the job.
Bug: 183537307
Test: atest CtsJobSchedulerTestCases
Change-Id: I650b6a1cbbc9b18f557ba5e735ce2a521f455fd8
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/TimingConstraintsTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/TimingConstraintsTest.java
index 03f1468..582644d 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/TimingConstraintsTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/TimingConstraintsTest.java
@@ -135,6 +135,7 @@
kTestEnvironment.setExpectedExecutions(1);
setStorageStateLow(true);
mJobScheduler.schedule(deadlineJob);
+ Thread.sleep(500L);
// Run everything by making storage state not-low.
setStorageStateLow(false);
assertTrue("Failed to execute non-deadline job", kTestEnvironment.awaitExecution());