Store requested priority.

Store the requested priority to disk instead of the effective priority
so that reschedules after successful execution use the correct priority.

Bug: 223825374
Test: atest FrameworksServicesTests:JobStoreTest
Change-Id: If36c0a476e196c5b41538d10973abd407a356d95
This commit is contained in:
Kweku Adams
2022-03-10 17:13:58 +00:00
parent 7073d3bbe8
commit f74a0c0fd5
2 changed files with 6 additions and 5 deletions

View File

@@ -548,7 +548,7 @@ public final class JobStore {
out.attribute(null, "sourceUserId", String.valueOf(jobStatus.getSourceUserId()));
out.attribute(null, "uid", Integer.toString(jobStatus.getUid()));
out.attribute(null, "bias", String.valueOf(jobStatus.getBias()));
out.attribute(null, "priority", String.valueOf(jobStatus.getEffectivePriority()));
out.attribute(null, "priority", String.valueOf(jobStatus.getJob().getPriority()));
out.attribute(null, "flags", String.valueOf(jobStatus.getFlags()));
if (jobStatus.getInternalFlags() != 0) {
out.attribute(null, "internalFlags", String.valueOf(jobStatus.getInternalFlags()));

View File

@@ -330,11 +330,12 @@ public class JobStoreTest {
@Test
public void testPriorityPersisted() throws Exception {
final JobInfo.Builder b = new Builder(92, mComponent)
final JobInfo job = new Builder(92, mComponent)
.setOverrideDeadline(5000)
.setPriority(JobInfo.PRIORITY_MIN)
.setPersisted(true);
final JobStatus js = JobStatus.createFromJobInfo(b.build(), SOME_UID, null, -1, null);
.setPersisted(true)
.build();
final JobStatus js = JobStatus.createFromJobInfo(job, SOME_UID, null, -1, null);
mTaskStoreUnderTest.add(js);
waitForPendingIo();
@@ -342,7 +343,7 @@ public class JobStoreTest {
mTaskStoreUnderTest.readJobMapFromDisk(jobStatusSet, true);
final JobStatus loaded = jobStatusSet.getAllJobs().iterator().next();
assertEquals("Priority not correctly persisted.",
JobInfo.PRIORITY_MIN, loaded.getEffectivePriority());
JobInfo.PRIORITY_MIN, job.getPriority());
}
/**