Fix Doze FGS job handling.
While in Doze, jobs of apps the Foreground Service proc state or higher
are only exempted if they're expedited or have the
important-while-foreground bit set. We were accidentally considering all
uidActive jobs as exempt, letting the device exit the Doze maintenance
window early, and then stopping the uidActive app's jobs if they weren't
exempted or had the important-while-foreground bit set. This meant that
if only the app running a foreground service had jobs to run and the app
didn't ask for the jobs to be exempted from Doze, the maintenance window
would last for 30 seconds and the jobs would be stopped, but if there
were other background jobs to be run, the maintenance window could last
for the full time (10 minutes or whatever it would be). Fixing the
inconsistency so that we don't exit a maintenance window early when
there are non-exempt jobs running.
Bug: 216150579
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/job
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/job
Test: atest CtsJobSchedulerTestCases
Change-Id: I07de57b364c9fee995eca020153622ba85d17c96
3 files changed