Adjust queue for test jobs.

Test jobs should always be pulled first, so optimizing the iteration for
batching won't work with tests. Skip the optimization when dealing with
test jobs.

Bug: 226554375
Test: atest FrameworksServicesTests:PendingJobQueueTest
Change-Id: Icd55cb7f2f6efe00c87272f851661a964fb7c4d0
This commit is contained in:
Kweku Adams
2022-03-24 16:21:35 +00:00
parent 4f027ec47c
commit f2e02b8ab0

View File

@@ -182,8 +182,10 @@ class PendingJobQueue {
if (earliestQueue != null) {
final JobStatus job = earliestQueue.next();
// Change the front of the queue if we've pulled pullLimit jobs from the current head
// or we're dealing with test jobs
// or the current head has no more jobs to provide.
if (++mPullCount >= pullLimit
|| (job != null && earliestQueue.peekNextOverrideState() != job.overrideState)
|| earliestQueue.peekNextTimestamp() == AppJobQueue.NO_NEXT_TIMESTAMP) {
mOrderedQueues.poll();
if (earliestQueue.peekNextTimestamp() != AppJobQueue.NO_NEXT_TIMESTAMP) {