From b59e3de2356928c9cf3112fddecd46ed993aa075 Mon Sep 17 00:00:00 2001 From: Kweku Adams Date: Thu, 5 May 2022 21:04:13 +0000 Subject: [PATCH] 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 --- .../java/com/android/server/job/JobConcurrencyManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java b/apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java index afe36b5fa25a5..d5a7f2851d031 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java @@ -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; }