Restrict foreground jobs on thermal events

Foreground jobs are now restricted for THERMAL_STATUS_MODERATE and
higher. Only user-initiated foreground jobs are not restricted on
THERMAL_STATUS_MODERATE status. Partial restrictions are applied for
expedited, high priority and important-while-foreground jobs. These jobs
are allowed to run only if

1. They haven't previously run
2. They're already running and aren't yet in overtime

Test: Unit test ThermalStatusRestrictionTest and JobSchedulerServiceTest
passes
Bug: 315157163
Flag: com.android.server.job.thermal_restrictions_to_fgs_jobs

Change-Id: Id63c0f14ca43fd7c8c73ea670a96c435c46c7354
4 files changed