Changing default limits, clarify flags, fix bug.

1. Lower job count limits to values that should be more reasonable. The
following defaults have changed:
-- MAX_JOB_COUNT_ACTIVE = 20/window = 120/hr = 1/session
  (down from 200/window = 1200/hr = 10/session)
-- MAX_JOB_COUNT_WORKING = 120/window = 60/hr = 12/session
  (down from 1200/window = 600/hr = 120/session)
-- MAX_JOB_COUNT_FREQUENT = 200/window = 25/hr = 25/session
  (down from 1800/window = 225/hr = 225/session)
-- MAX_JOB_COUNT_RARE = 48/window = 2/hr = 16/session
  (down from 2400/window = 100/hr = 800/session)

2. Increase timing session coalescing duration to enable coalescing.
-- TIMING_SESSION_COALESCING_DURATION_MS = 5 seconds (up from 0ms)

3. Separate allowed time flag from rate limiting period flag so they can
be changed independently.

4. Fix bug: If an app reached the job count quota limit for its bucket,
QuotaController would set an alarm only 10 minutes (allowed time) into
the future to determine if the app was back in quota. This would result
in unnecessary wakeup alarms. Now, QC will set an alarm for when the
app will be under quota.

5. Expand some comments, clarify some constants, and simplify some code.

Bug: 132227621
Test: atest com.android.server.job.controllers.QuotaControllerTest
Test: CtsJobSchedulerTestCases
Change-Id: I6f3f3a5eff7f64b429820d7370d82c1b4573f23b
3 files changed