Reducing quota expired check churn.

QuotaController would check if an app had used up all of its quota every
time the 'time remaining' had passed. However, if there was a session at
the very beginning of the window, the app would still have quota since
it would phase out as time went on. QC would then reschedule another
check for the same amount of time in the future and this could continue
for a while. We avoid this repeated and unnecessary check by
including any session phase outs as part of the calculation for when to
check if the quota has expired.

Bug: 126948148
Test: atest com.android.server.job.controllers.QuotaControllerTest
Test: atest CtsJobSchedulerTestCases
Change-Id: I0bfa0163b243558c2834ba6e460db63124425d9a
2 files changed