diff options
| -rw-r--r-- | apex/jobscheduler/framework/java/android/app/job/JobParameters.java | 1 | ||||
| -rw-r--r-- | apex/jobscheduler/framework/java/android/app/job/JobScheduler.java | 14 | ||||
| -rw-r--r-- | core/api/current.txt | 5 |
3 files changed, 14 insertions, 6 deletions
diff --git a/apex/jobscheduler/framework/java/android/app/job/JobParameters.java b/apex/jobscheduler/framework/java/android/app/job/JobParameters.java index 18ddffbaf885..86e61832611e 100644 --- a/apex/jobscheduler/framework/java/android/app/job/JobParameters.java +++ b/apex/jobscheduler/framework/java/android/app/job/JobParameters.java @@ -330,7 +330,6 @@ public class JobParameters implements Parcelable { * @see JobScheduler#forNamespace(String) * @return The namespace this job was scheduled in. Will be {@code null} if there was no * explicit namespace set and this job is therefore in the default namespace. - * @hide */ @Nullable public String getJobNamespace() { diff --git a/apex/jobscheduler/framework/java/android/app/job/JobScheduler.java b/apex/jobscheduler/framework/java/android/app/job/JobScheduler.java index 33668c76c152..4aec484aad09 100644 --- a/apex/jobscheduler/framework/java/android/app/job/JobScheduler.java +++ b/apex/jobscheduler/framework/java/android/app/job/JobScheduler.java @@ -271,7 +271,6 @@ public abstract class JobScheduler { * but will instead create or update the job inside the current namespace. A JobScheduler * instance dedicated to a namespace must be used to schedule or update jobs in that namespace. * @see #getNamespace() - * @hide */ @NonNull public JobScheduler forNamespace(@NonNull String namespace) { @@ -282,7 +281,6 @@ public abstract class JobScheduler { * Get the namespace this JobScheduler instance is operating in. A {@code null} value means * that the app has not specified a namespace for this instance, and it is therefore using the * default namespace. - * @hide */ @Nullable public String getNamespace() { @@ -395,14 +393,21 @@ public abstract class JobScheduler { public abstract void cancel(int jobId); /** - * Cancel <em>all</em> jobs that have been scheduled by the calling application. + * Cancel all jobs that have been scheduled in the current namespace by the + * calling application. + * + * <p> + * Starting with Android version {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}, this + * will only cancel within the current namespace. If a namespace hasn't been explicitly set + * with {@link #forNamespace(String)}, then this will cancel jobs in the default namespace. + * To cancel all jobs scheduled by the application, + * use {@link #cancelInAllNamespaces()} instead. */ public abstract void cancelAll(); /** * Cancel <em>all</em> jobs that have been scheduled by the calling application, regardless of * namespace. - * @hide */ public void cancelInAllNamespaces() { throw new RuntimeException("Not implemented. Must override in a subclass."); @@ -424,7 +429,6 @@ public abstract class JobScheduler { * If a namespace hasn't been explicitly set with {@link #forNamespace(String)}, * then this will return jobs in the default namespace. * This includes jobs that are currently started as well as those that are still waiting to run. - * @hide */ @NonNull public Map<String, List<JobInfo>> getPendingJobsInAllNamespaces() { diff --git a/core/api/current.txt b/core/api/current.txt index 601c1ea32657..4989cd754326 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -8563,6 +8563,7 @@ package android.app.job { method public int getClipGrantFlags(); method @NonNull public android.os.PersistableBundle getExtras(); method public int getJobId(); + method @Nullable public String getJobNamespace(); method @Nullable public android.net.Network getNetwork(); method public int getStopReason(); method @NonNull public android.os.Bundle getTransientExtras(); @@ -8596,10 +8597,14 @@ package android.app.job { method public boolean canRunLongJobs(); method public abstract void cancel(int); method public abstract void cancelAll(); + method public void cancelInAllNamespaces(); method public abstract int enqueue(@NonNull android.app.job.JobInfo, @NonNull android.app.job.JobWorkItem); + method @NonNull public android.app.job.JobScheduler forNamespace(@NonNull String); method @NonNull public abstract java.util.List<android.app.job.JobInfo> getAllPendingJobs(); + method @Nullable public String getNamespace(); method @Nullable public abstract android.app.job.JobInfo getPendingJob(int); method public int getPendingJobReason(int); + method @NonNull public java.util.Map<java.lang.String,java.util.List<android.app.job.JobInfo>> getPendingJobsInAllNamespaces(); method public abstract int schedule(@NonNull android.app.job.JobInfo); field public static final int PENDING_JOB_REASON_APP = 1; // 0x1 field public static final int PENDING_JOB_REASON_APP_STANDBY = 2; // 0x2 |