Loading apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java +5 −1 Original line number Diff line number Diff line Loading @@ -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()) { Loading services/tests/mockingservicestests/src/com/android/server/job/JobServiceContextTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,7 @@ public class JobServiceContextTest { final int jobId = 123; mJobServiceContext.setRunningJobLockedForTest(mMockJobStatus); mJobServiceContext.setRunningCallbackLockedForTest(mMockJobCallback); mJobServiceContext.mVerb = JobServiceContext.VERB_EXECUTING; doReturn(jobId).when(mMockJobStatus).getJobId(); mJobServiceContext.doHandleAbandonedJob(mMockJobCallback, jobId); Loading @@ -296,7 +297,25 @@ public class JobServiceContextTest { mJobServiceContext.setRunningCallbackLockedForTest(mMockJobCallback); mJobServiceContext.doHandleAbandonedJob(mMockJobCallback, jobId); verify(mMockJobStatus, never()).setAbandoned(true); mJobServiceContext.setRunningJobLockedForTest(mMockJobStatus); doReturn(jobId).when(mMockJobStatus).getJobId(); mJobServiceContext.mVerb = JobServiceContext.VERB_BINDING; mJobServiceContext.doHandleAbandonedJob(mMockJobCallback, jobId); verify(mMockJobStatus, never()).setAbandoned(true); mJobServiceContext.mVerb = JobServiceContext.VERB_STARTING; mJobServiceContext.doHandleAbandonedJob(mMockJobCallback, jobId); verify(mMockJobStatus, never()).setAbandoned(true); mJobServiceContext.mVerb = JobServiceContext.VERB_STOPPING; mJobServiceContext.doHandleAbandonedJob(mMockJobCallback, jobId); verify(mMockJobStatus, never()).setAbandoned(true); mJobServiceContext.mVerb = JobServiceContext.VERB_FINISHED; mJobServiceContext.doHandleAbandonedJob(mMockJobCallback, jobId); verify(mMockJobStatus, never()).setAbandoned(true); } Loading Loading
apex/jobscheduler/service/java/com/android/server/job/JobServiceContext.java +5 −1 Original line number Diff line number Diff line Loading @@ -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()) { Loading
services/tests/mockingservicestests/src/com/android/server/job/JobServiceContextTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,7 @@ public class JobServiceContextTest { final int jobId = 123; mJobServiceContext.setRunningJobLockedForTest(mMockJobStatus); mJobServiceContext.setRunningCallbackLockedForTest(mMockJobCallback); mJobServiceContext.mVerb = JobServiceContext.VERB_EXECUTING; doReturn(jobId).when(mMockJobStatus).getJobId(); mJobServiceContext.doHandleAbandonedJob(mMockJobCallback, jobId); Loading @@ -296,7 +297,25 @@ public class JobServiceContextTest { mJobServiceContext.setRunningCallbackLockedForTest(mMockJobCallback); mJobServiceContext.doHandleAbandonedJob(mMockJobCallback, jobId); verify(mMockJobStatus, never()).setAbandoned(true); mJobServiceContext.setRunningJobLockedForTest(mMockJobStatus); doReturn(jobId).when(mMockJobStatus).getJobId(); mJobServiceContext.mVerb = JobServiceContext.VERB_BINDING; mJobServiceContext.doHandleAbandonedJob(mMockJobCallback, jobId); verify(mMockJobStatus, never()).setAbandoned(true); mJobServiceContext.mVerb = JobServiceContext.VERB_STARTING; mJobServiceContext.doHandleAbandonedJob(mMockJobCallback, jobId); verify(mMockJobStatus, never()).setAbandoned(true); mJobServiceContext.mVerb = JobServiceContext.VERB_STOPPING; mJobServiceContext.doHandleAbandonedJob(mMockJobCallback, jobId); verify(mMockJobStatus, never()).setAbandoned(true); mJobServiceContext.mVerb = JobServiceContext.VERB_FINISHED; mJobServiceContext.doHandleAbandonedJob(mMockJobCallback, jobId); verify(mMockJobStatus, never()).setAbandoned(true); } Loading