Loading apex/jobscheduler/service/java/com/android/server/job/controllers/FlexibilityController.java +14 −0 Original line number Diff line number Diff line Loading @@ -972,6 +972,20 @@ public final class FlexibilityController extends StateController { synchronized (mLock) { final long earliest = getLifeCycleBeginningElapsedLocked(js); final long latest = getLifeCycleEndElapsedLocked(js, nowElapsed, earliest); if (latest <= earliest) { // Something has gone horribly wrong. This has only occurred on incorrectly // configured tests, but add a check here for safety. Slog.wtf(TAG, "Got invalid latest when scheduling alarm." + " Prefetch=" + js.getJob().isPrefetch()); // Since things have gone wrong, the safest and most reliable thing to do is // stop applying flex policy to the job. mFlexibilityTracker.setNumDroppedFlexibleConstraints(js, js.getNumAppliedFlexibleConstraints()); mJobsToCheck.add(js); mHandler.sendEmptyMessage(MSG_CHECK_JOBS); return; } final long nextTimeElapsed = getNextConstraintDropTimeElapsedLocked(js, earliest, latest); Loading services/tests/mockingservicestests/src/com/android/server/job/controllers/FlexibilityControllerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,7 @@ public class FlexibilityControllerTest { JobSchedulerService.sElapsedRealtimeClock = Clock.fixed(Instant.ofEpochMilli(FROZEN_TIME), ZoneOffset.UTC); // Initialize real objects. doReturn(Long.MAX_VALUE).when(mPrefetchController).getNextEstimatedLaunchTimeLocked(any()); ArgumentCaptor<BroadcastReceiver> receiverCaptor = ArgumentCaptor.forClass(BroadcastReceiver.class); mFlexibilityController = new FlexibilityController(mJobSchedulerService, Loading Loading
apex/jobscheduler/service/java/com/android/server/job/controllers/FlexibilityController.java +14 −0 Original line number Diff line number Diff line Loading @@ -972,6 +972,20 @@ public final class FlexibilityController extends StateController { synchronized (mLock) { final long earliest = getLifeCycleBeginningElapsedLocked(js); final long latest = getLifeCycleEndElapsedLocked(js, nowElapsed, earliest); if (latest <= earliest) { // Something has gone horribly wrong. This has only occurred on incorrectly // configured tests, but add a check here for safety. Slog.wtf(TAG, "Got invalid latest when scheduling alarm." + " Prefetch=" + js.getJob().isPrefetch()); // Since things have gone wrong, the safest and most reliable thing to do is // stop applying flex policy to the job. mFlexibilityTracker.setNumDroppedFlexibleConstraints(js, js.getNumAppliedFlexibleConstraints()); mJobsToCheck.add(js); mHandler.sendEmptyMessage(MSG_CHECK_JOBS); return; } final long nextTimeElapsed = getNextConstraintDropTimeElapsedLocked(js, earliest, latest); Loading
services/tests/mockingservicestests/src/com/android/server/job/controllers/FlexibilityControllerTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,7 @@ public class FlexibilityControllerTest { JobSchedulerService.sElapsedRealtimeClock = Clock.fixed(Instant.ofEpochMilli(FROZEN_TIME), ZoneOffset.UTC); // Initialize real objects. doReturn(Long.MAX_VALUE).when(mPrefetchController).getNextEstimatedLaunchTimeLocked(any()); ArgumentCaptor<BroadcastReceiver> receiverCaptor = ArgumentCaptor.forClass(BroadcastReceiver.class); mFlexibilityController = new FlexibilityController(mJobSchedulerService, Loading