Scheduling start alarm when job starts off out of quota.
Up until now, QuotaController was only scheduling the quota check alarm
when an app ran out of quota while a job was running, the UID proc state
or standby bucket changed, the device was unplugged, the parole state
changed, or quota controller constants changed. However, if a job was
scheduled and already out of quota (which could be the case due to
job count throttling), an alarm wasn't scheduled. This meant that alarms
throttled due to high job counts probably wouldn't run until the device
was plugged in or the app changed its standby bucket or proc state. Now,
we schedule an alarm if a newly scheduled job is already out of quota so
that it will come back into quota at the proper time.
Bug: 131267600
Test: atest com.android.server.job.controllers.QuotaControllerTest
Test: atest CtsJobSchedulerTestCases
Change-Id: I802b0aa076690451d901521327c4ddab111c42f6
diff --git a/core/proto/android/server/jobscheduler.proto b/core/proto/android/server/jobscheduler.proto
index dc2e6d5..0df2c83 100644
--- a/core/proto/android/server/jobscheduler.proto
+++ b/core/proto/android/server/jobscheduler.proto
@@ -459,6 +459,7 @@
optional bool is_charging = 1;
optional bool is_in_parole = 2;
+ optional int64 elapsed_realtime = 6;
// List of UIDs currently in the foreground.
repeated int32 foreground_uids = 3;
@@ -478,6 +479,16 @@
}
repeated TrackedJob tracked_jobs = 4;
+ message AlarmListener {
+ option (.android.msg_privacy).dest = DEST_AUTOMATIC;
+
+ // Whether the listener is waiting for an alarm or not.
+ optional bool is_waiting = 1;
+ // The time at which the alarm should go off, in the elapsed realtime timebase. Only
+ // valid if is_waiting is true.
+ optional int64 trigger_time_elapsed = 2;
+ }
+
message ExecutionStats {
option (.android.msg_privacy).dest = DEST_AUTOMATIC;
@@ -567,6 +578,8 @@
repeated TimingSession saved_sessions = 3;
repeated ExecutionStats execution_stats = 4;
+
+ optional AlarmListener in_quota_alarm_listener = 5;
}
repeated PackageStats package_stats = 5;
}