diff --git a/apex/jobscheduler/framework/java/android/app/job/JobInfo.java b/apex/jobscheduler/framework/java/android/app/job/JobInfo.java index 6967d819a448e..4c8ab9385903f 100644 --- a/apex/jobscheduler/framework/java/android/app/job/JobInfo.java +++ b/apex/jobscheduler/framework/java/android/app/job/JobInfo.java @@ -59,15 +59,6 @@ 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. - * Starting from Android version {@link Build.VERSION_CODES#S}, jobs will still be stopped after - * 10 minutes if the system is busy or needs the resources, but if not, jobs may continue running - * longer than 10 minutes. */ public class JobInfo implements Parcelable { private static String TAG = "JobInfo"; @@ -1471,7 +1462,7 @@ public class JobInfo implements Parcelable { *

    *
  1. Run as soon as possible
  2. *
  3. Be less restricted during Doze and battery saver
  4. - *
  5. Have network access
  6. + *
  7. Have the same network access as foreground services
  8. *
  9. Be less likely to be killed than regular jobs
  10. *
  11. Be subject to background location throttling
  12. *
diff --git a/apex/jobscheduler/framework/java/android/app/job/JobScheduler.java b/apex/jobscheduler/framework/java/android/app/job/JobScheduler.java index 361325dae7fd3..1f4ef0470ebd4 100644 --- a/apex/jobscheduler/framework/java/android/app/job/JobScheduler.java +++ b/apex/jobscheduler/framework/java/android/app/job/JobScheduler.java @@ -57,6 +57,19 @@ import java.util.List; * {@link android.content.Context#getSystemService * Context.getSystemService(Context.JOB_SCHEDULER_SERVICE)}. * + *

Prior to Android version {@link android.os.Build.VERSION_CODES#S}, jobs could only have + * a maximum of 100 jobs scheduled at a time. Starting with Android version + * {@link android.os.Build.VERSION_CODES#S}, that limit has been increased to 150. + * Expedited jobs also count towards the limit. + * + *

In Android version {@link android.os.Build.VERSION_CODES#LOLLIPOP}, jobs had a maximum + * execution time of one minute. Starting with Android version + * {@link android.os.Build.VERSION_CODES#M} and ending with Android version + * {@link android.os.Build.VERSION_CODES#R}, jobs had a maximum execution time of 10 minutes. + * Starting from Android version {@link android.os.Build.VERSION_CODES#S}, jobs will still be + * stopped after 10 minutes if the system is busy or needs the resources, but if not, jobs + * may continue running longer than 10 minutes. + * *

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 can have a diff --git a/apex/jobscheduler/framework/java/android/app/job/JobService.java b/apex/jobscheduler/framework/java/android/app/job/JobService.java index 61afadab9b0c7..0f3d299291c56 100644 --- a/apex/jobscheduler/framework/java/android/app/job/JobService.java +++ b/apex/jobscheduler/framework/java/android/app/job/JobService.java @@ -74,6 +74,7 @@ public abstract class JobService extends Service { /** * Call this to inform the JobScheduler that the job has finished its work. When the * system receives this message, it releases the wakelock being held for the job. + * This does not need to be called if {@link #onStopJob(JobParameters)} has been called. *

* You can request that the job be scheduled again by passing {@code true} as * the wantsReschedule parameter. This will apply back-off policy @@ -135,6 +136,8 @@ public abstract class JobService extends Service { /** * This method is called if the system has determined that you must stop execution of your job * even before you've had a chance to call {@link #jobFinished(JobParameters, boolean)}. + * Once this method is called, you no longer need to call + * {@link #jobFinished(JobParameters, boolean)}. * *

This will happen if the requirements specified at schedule time are no longer met. For * example you may have requested WiFi with @@ -144,8 +147,8 @@ public abstract class JobService extends Service { * idle maintenance window. You are solely responsible for the behavior of your application * upon receipt of this message; your app will likely start to misbehave if you ignore it. *

- * Once this method returns, the system releases the wakelock that it is holding on - * behalf of the job.

+ * Once this method returns (or times out), the system releases the wakelock that it is holding + * on behalf of the job.

* * @param params The parameters identifying this job, as supplied to * the job in the {@link #onStartJob(JobParameters)} callback.