Skip to content
Commit 2700aba1 authored by Kweku Adams's avatar Kweku Adams
Browse files

Fix pending job sorting.

We want to always run an app's expedited jobs before its own regular
jobs. This means that we order an app's EJs before its regular jobs. In
order to satisfy the transitivity constraint, we must also order one
app's EJs ahead of a differing app's jobs iff we had to order the first
app's EJ ahead of a job that was earlier than the second app's jobs.

The current sorting system fails the transitivity requirement.

Test case: regJob1 enqueued at t1 for UID A, regJob2 enqueued at t2 for
UID B, EJ3 enqueued at t3 for UID A. Because we expedite EJs, EJ3 is
ordered before regJob1. Because we sort jobs of differing apps by enqueue
time, regJob1 comes before regJob2 and regJob2 comes before EJ3. This
violates transitivity.

The new sorting system will order a later EJ ahead of a differing app's
jobs iff the first app has a regular job that is earlier than the
differing app's first regular job.

Bug: 191592712
Test: atest FrameworksMockingServicesTests:JobSchedulerServiceTest
Test: atest CtsJobSchedulerTestCases
Change-Id: I5391a4f35269d7d43eefc1954788f9df160b1d22
parent dc9a03db
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment