Loading
Reducing overhead of job constraint evaluation.
1. TimeController was checking its expired deadline and delay jobs even when the job in question already had its constraint satisfied. 2. In the worst case, TimeController.evaluateStateLocked would check all N jobs even though the job in question is the only one that matters in that case. Adding the wouldBeReadyWithConstraint check in evaluateStateLocked reduces worst case runtime by a factor of N. 3. With the introduction of job alarm skipping, TimeController would sometimes schedule an alarm with AlarmManager for the exact same time it had the alarm set for. Adding a check removes that unnecessary call. Bug: 123756120 Bug: 123879683 Test: atest com.android.server.job.controllers.JobStatusTest Test: atest com.android.server.job.controllers.TimeControllerTest Test: atest FrameworksMockingServicesTests Test: atest JobThrottlingTest Test: atest TimingConstraintsTest Change-Id: Iedf7873398a6938f6dd4fed5e92ee2e8d2c211bb