From fcfac0b4a43501c31c660172c9b5666249fe10af Mon Sep 17 00:00:00 2001 From: Kweku Adams Date: Wed, 29 Jan 2020 08:09:47 -0800 Subject: [PATCH] Add documentation around job scheduling quotas. Adding some documentation around JobScheduler.schedule() quotas so developers are made explicitly aware of the behavior and that experiencing the throttling means their app is buggy. Bug: 148236938 Test: Run `m offline-sdk-docs` and check site at out/target/common/docs/offline-sdk/reference/android/app/job/JobScheduler.html Change-Id: I9dbf58f0b833d2c869c786a1e3f010dea81c255a --- .../framework/java/android/app/job/JobScheduler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apex/jobscheduler/framework/java/android/app/job/JobScheduler.java b/apex/jobscheduler/framework/java/android/app/job/JobScheduler.java index 08b1c2b9f5489..abf78c67fa6ff 100644 --- a/apex/jobscheduler/framework/java/android/app/job/JobScheduler.java +++ b/apex/jobscheduler/framework/java/android/app/job/JobScheduler.java @@ -56,6 +56,12 @@ import java.util.List; * instantiate this class directly; instead, retrieve it through * {@link android.content.Context#getSystemService * Context.getSystemService(Context.JOB_SCHEDULER_SERVICE)}. + * + *

Note: Beginning with API 30 + * ({@link android.os.Build.VERSION_CODES#R}), JobScheduler will throttle runaway applications. + * Calling {@link #schedule(JobInfo)} and other such methods with very high frequency is indicative + * of an app bug and so, to make sure the system doesn't get overwhelmed, JobScheduler will begin + * to throttle apps that show buggy behavior, regardless of target SDK version. */ @SystemService(Context.JOB_SCHEDULER_SERVICE) public abstract class JobScheduler {