Loading services/core/java/com/android/server/job/JobSchedulerService.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -906,7 +906,11 @@ public final class JobSchedulerService extends com.android.server.SystemService private boolean isCurrentlyActiveLocked(JobStatus job) { private boolean isCurrentlyActiveLocked(JobStatus job) { for (int i=0; i<mActiveServices.size(); i++) { for (int i=0; i<mActiveServices.size(); i++) { JobServiceContext serviceContext = mActiveServices.get(i); JobServiceContext serviceContext = mActiveServices.get(i); final JobStatus running = serviceContext.getRunningJob(); // The 'unsafe' direct-internal-reference running-job inspector is okay to // use here because we are already holding the necessary lock *and* we // immediately discard the returned object reference, if any; we return // only a boolean state indicator to the caller. final JobStatus running = serviceContext.getRunningJobUnsafeLocked(); if (running != null && running.matches(job.getUid(), job.getJobId())) { if (running != null && running.matches(job.getUid(), job.getJobId())) { return true; return true; } } Loading services/core/java/com/android/server/job/JobServiceContext.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -231,6 +231,15 @@ public class JobServiceContext extends IJobCallback.Stub implements ServiceConne return job == null ? null : new JobStatus(job); return job == null ? null : new JobStatus(job); } } /** * Internal non-cloning inspection of the currently running job, if any. The lock * must be held when calling this *and* for the entire lifetime of using its returned * JobStatus object! */ JobStatus getRunningJobUnsafeLocked() { return mRunningJob; } /** Called externally when a job that was scheduled for execution should be cancelled. */ /** Called externally when a job that was scheduled for execution should be cancelled. */ void cancelExecutingJob(int reason) { void cancelExecutingJob(int reason) { mCallbackHandler.obtainMessage(MSG_CANCEL, reason, 0 /* unused */).sendToTarget(); mCallbackHandler.obtainMessage(MSG_CANCEL, reason, 0 /* unused */).sendToTarget(); Loading Loading
services/core/java/com/android/server/job/JobSchedulerService.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -906,7 +906,11 @@ public final class JobSchedulerService extends com.android.server.SystemService private boolean isCurrentlyActiveLocked(JobStatus job) { private boolean isCurrentlyActiveLocked(JobStatus job) { for (int i=0; i<mActiveServices.size(); i++) { for (int i=0; i<mActiveServices.size(); i++) { JobServiceContext serviceContext = mActiveServices.get(i); JobServiceContext serviceContext = mActiveServices.get(i); final JobStatus running = serviceContext.getRunningJob(); // The 'unsafe' direct-internal-reference running-job inspector is okay to // use here because we are already holding the necessary lock *and* we // immediately discard the returned object reference, if any; we return // only a boolean state indicator to the caller. final JobStatus running = serviceContext.getRunningJobUnsafeLocked(); if (running != null && running.matches(job.getUid(), job.getJobId())) { if (running != null && running.matches(job.getUid(), job.getJobId())) { return true; return true; } } Loading
services/core/java/com/android/server/job/JobServiceContext.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -231,6 +231,15 @@ public class JobServiceContext extends IJobCallback.Stub implements ServiceConne return job == null ? null : new JobStatus(job); return job == null ? null : new JobStatus(job); } } /** * Internal non-cloning inspection of the currently running job, if any. The lock * must be held when calling this *and* for the entire lifetime of using its returned * JobStatus object! */ JobStatus getRunningJobUnsafeLocked() { return mRunningJob; } /** Called externally when a job that was scheduled for execution should be cancelled. */ /** Called externally when a job that was scheduled for execution should be cancelled. */ void cancelExecutingJob(int reason) { void cancelExecutingJob(int reason) { mCallbackHandler.obtainMessage(MSG_CANCEL, reason, 0 /* unused */).sendToTarget(); mCallbackHandler.obtainMessage(MSG_CANCEL, reason, 0 /* unused */).sendToTarget(); Loading