diff --git a/apex/jobscheduler/framework/java/android/app/job/JobInfo.java b/apex/jobscheduler/framework/java/android/app/job/JobInfo.java index b7a3f10831769..6967d819a448e 100644 --- a/apex/jobscheduler/framework/java/android/app/job/JobInfo.java +++ b/apex/jobscheduler/framework/java/android/app/job/JobInfo.java @@ -59,6 +59,9 @@ import java.util.Objects; * constraint on the JobInfo object that you are creating. Otherwise, the builder would throw an * exception when building. From Android version {@link Build.VERSION_CODES#Q} and onwards, it is * valid to schedule jobs with no constraints. + *
Prior to Android version {@link Build.VERSION_CODES#S}, jobs could only have a maximum of 100 + * jobs scheduled at a time. Starting with Android version {@link Build.VERSION_CODES#S}, that limit + * has been increased to 150. Expedited jobs also count towards the limit. *
In Android version {@link Build.VERSION_CODES#LOLLIPOP}, jobs had a maximum execution time * of one minute. Starting with Android version {@link Build.VERSION_CODES#M} and ending with * Android version {@link Build.VERSION_CODES#R}, jobs had a maximum execution time of 10 minutes. diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java index 515cb747a99e6..82f2f69bbde55 100644 --- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java @@ -147,10 +147,8 @@ public class JobSchedulerService extends com.android.server.SystemService /** The maximum number of concurrent jobs we run at one time. */ static final int MAX_JOB_CONTEXTS_COUNT = 16; - /** Enforce a per-app limit on scheduled jobs? */ - private static final boolean ENFORCE_MAX_JOBS = true; - /** The maximum number of jobs that we allow an unprivileged app to schedule */ - private static final int MAX_JOBS_PER_APP = 100; + /** The maximum number of jobs that we allow an app to schedule */ + private static final int MAX_JOBS_PER_APP = 150; /** The number of the most recently completed jobs to keep track of for debugging purposes. */ private static final int NUM_COMPLETED_JOB_HISTORY = 20; @@ -1011,7 +1009,7 @@ public class JobSchedulerService extends com.android.server.SystemService if (DEBUG) Slog.d(TAG, "SCHEDULE: " + jobStatus.toShortString()); // Jobs on behalf of others don't apply to the per-app job cap - if (ENFORCE_MAX_JOBS && packageName == null) { + if (packageName == null) { if (mJobs.countJobsForUid(uId) > MAX_JOBS_PER_APP) { Slog.w(TAG, "Too many jobs for uid " + uId); throw new IllegalStateException("Apps may not schedule more than "