diff options
author | 2025-01-08 15:08:25 -0600 | |
---|---|---|
committer | 2025-02-18 16:21:40 -0800 | |
commit | a1e75debecdf27bb7586966001a2a6baf3720f9e (patch) | |
tree | b3929bd5cb815ce86f5ceb742a4f8e8d865b2019 /apex | |
parent | aaa454ed859d43e691ff43a50b261ac516c5c412 (diff) |
Use mVerb to track job execution state in system for consistency.
System currently uses `mRunningJob` to track job execution as a
simple binary (executing/not executing) state. However, `mRunningJob`
doesn't accurately reflect transient states, such as during initial
binding for `onStartJob` or when stopping due to `onStopJob`. These
granular state changes, from non-executing to executing, are tracked by
`mVerb`. While `mRunningJob` is functional, using `mVerb` for
consistency with other job related API implementation related to job
state checks would provide a more accurate and consistent reflection of
the job's lifecycle within the system.
Test: atest CtsJobSchedulerTestCases
Test: atest FrameworksMockingServicesTests
Bug: 372529068
Flag: android.app.job.handle_abandoned_jobs
Change-Id: Ib8077f601b9f476a71bbb1bd948aba4698d2fbc2
Diffstat (limited to 'apex')
-rw-r--r-- | apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java index ebfda527001d..010006edc995 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java @@ -809,7 +809,11 @@ public final class JobServiceContext implements ServiceConnection { if (!verifyCallerLocked(cb)) { return; } - + if (mVerb != VERB_EXECUTING) { + // Any state other than executing means the + // job is in transient or stopped state + return; + } executing = getRunningJobLocked(); } if (executing != null && jobId == executing.getJobId()) { |