Stop the actual job in question.

Comparing just the UID and job ID when determining the job to cancel
could mean we may not actually stop the correct job (in scenarios where
there are temporarily overlapping job executions). Change the
equivalency check to ensure we stop the right job.

Bug: 231148615
Test: atest CtsJobSchedulerTestCases
Change-Id: I2d873b9f9acef2b360d631cd4937572e89cabefc
This commit is contained in:
Kweku Adams
2022-05-05 21:04:13 +00:00
parent f81c41aaee
commit b59e3de235

View File

@@ -959,7 +959,7 @@ class JobConcurrencyManager {
for (int i = 0; i < mActiveServices.size(); i++) {
JobServiceContext jsc = mActiveServices.get(i);
final JobStatus executing = jsc.getRunningJobLocked();
if (executing != null && executing.matches(job.getUid(), job.getJobId())) {
if (executing == job) {
jsc.cancelExecutingJobLocked(reason, internalReasonCode, debugReason);
return true;
}