From 867992c865b85143b472e4c9f468e69ad76882a9 Mon Sep 17 00:00:00 2001 From: Kweku Adams Date: Tue, 20 Jul 2021 07:40:41 -0700 Subject: [PATCH] Improve logic for RESTRICTED stop reason. Now that we have explicit stop reasons, we can improve how we determine whether the internal stop reason is due to the restricted bucket or due to other constraints. Bug: 141645789 Test: atest CtsJobSchedulerTestCases Change-Id: I82a9641762544ab04bf897c6386d6b18eb607406 --- .../java/com/android/server/job/JobSchedulerService.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java index f3b2a962bbe83..abc5347d17020 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java @@ -2110,11 +2110,8 @@ public class JobSchedulerService extends com.android.server.SystemService continue; } if (!running.isReady()) { - // If a restricted job doesn't have dynamic constraints satisfied, assume that's - // the reason the job is being stopped, instead of because of other constraints - // not being satisfied. if (running.getEffectiveStandbyBucket() == RESTRICTED_INDEX - && !running.areDynamicConstraintsSatisfied()) { + && running.getStopReason() == JobParameters.STOP_REASON_APP_STANDBY) { serviceContext.cancelExecutingJobLocked( running.getStopReason(), JobParameters.INTERNAL_STOP_REASON_RESTRICTED_BUCKET,