diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-04-21 19:23:06 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-04-21 19:23:11 +0000 |
| commit | 0fa2574ecb2dbc2258065d4803afc35c2474c346 (patch) | |
| tree | 762f96e03a768c2bcb2ff75af0269a343e11d108 /core/java/android | |
| parent | ede054a73e8b4834ec56a8ffe58f0808b53ee7e1 (diff) | |
| parent | f9bac16d61db0fceb15484587ecf876c2b802c37 (diff) | |
Merge "Fix issue #32180780: Sync adapters inappropriately being run..." into oc-dev
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/job/JobInfo.java | 19 | ||||
| -rw-r--r-- | core/java/android/app/job/JobParameters.java | 16 | ||||
| -rw-r--r-- | core/java/android/app/job/JobScheduler.java | 7 |
3 files changed, 22 insertions, 20 deletions
diff --git a/core/java/android/app/job/JobInfo.java b/core/java/android/app/job/JobInfo.java index 23baa17d947f..fa07fbdbcc53 100644 --- a/core/java/android/app/job/JobInfo.java +++ b/core/java/android/app/job/JobInfo.java @@ -244,7 +244,7 @@ public class JobInfo implements Parcelable { /** * Bundle of extras which are returned to your application at execution time. */ - public PersistableBundle getExtras() { + public @NonNull PersistableBundle getExtras() { return extras; } @@ -252,7 +252,7 @@ public class JobInfo implements Parcelable { * Bundle of transient extras which are returned to your application at execution time, * but not persisted by the system. */ - public Bundle getTransientExtras() { + public @NonNull Bundle getTransientExtras() { return transientExtras; } @@ -260,7 +260,7 @@ public class JobInfo implements Parcelable { * ClipData of information that is returned to your application at execution time, * but not persisted by the system. */ - public ClipData getClipData() { + public @Nullable ClipData getClipData() { return clipData; } @@ -274,7 +274,7 @@ public class JobInfo implements Parcelable { /** * Name of the service endpoint that will be called back into by the JobScheduler. */ - public ComponentName getService() { + public @NonNull ComponentName getService() { return service; } @@ -327,8 +327,7 @@ public class JobInfo implements Parcelable { * Which content: URIs must change for the job to be scheduled. Returns null * if there are none required. */ - @Nullable - public TriggerContentUri[] getTriggerContentUris() { + public @Nullable TriggerContentUri[] getTriggerContentUris() { return triggerContentUris; } @@ -811,7 +810,7 @@ public class JobInfo implements Parcelable { * @param jobService The endpoint that you implement that will receive the callback from the * JobScheduler. */ - public Builder(int jobId, ComponentName jobService) { + public Builder(int jobId, @NonNull ComponentName jobService) { mJobService = jobService; mJobId = jobId; } @@ -832,7 +831,7 @@ public class JobInfo implements Parcelable { * Set optional extras. This is persisted, so we only allow primitive types. * @param extras Bundle containing extras you want the scheduler to hold on to for you. */ - public Builder setExtras(PersistableBundle extras) { + public Builder setExtras(@NonNull PersistableBundle extras) { mExtras = extras; return this; } @@ -842,7 +841,7 @@ public class JobInfo implements Parcelable { * persisted with {@link #setPersisted(boolean)}; mixing the two is not allowed. * @param extras Bundle containing extras you want the scheduler to hold on to for you. */ - public Builder setTransientExtras(Bundle extras) { + public Builder setTransientExtras(@NonNull Bundle extras) { mTransientExtras = extras; return this; } @@ -869,7 +868,7 @@ public class JobInfo implements Parcelable { * {@link android.content.Intent#FLAG_GRANT_WRITE_URI_PERMISSION}, and * {@link android.content.Intent#FLAG_GRANT_PREFIX_URI_PERMISSION}. */ - public Builder setClipData(ClipData clip, int grantFlags) { + public Builder setClipData(@Nullable ClipData clip, int grantFlags) { mClipData = clip; mClipGrantFlags = grantFlags; return this; diff --git a/core/java/android/app/job/JobParameters.java b/core/java/android/app/job/JobParameters.java index 673d1b886b25..0985f5f91373 100644 --- a/core/java/android/app/job/JobParameters.java +++ b/core/java/android/app/job/JobParameters.java @@ -16,6 +16,8 @@ package android.app.job; +import android.annotation.NonNull; +import android.annotation.Nullable; import android.app.job.IJobCallback; import android.content.ClipData; import android.net.Uri; @@ -91,7 +93,7 @@ public class JobParameters implements Parcelable { * {@link android.app.job.JobInfo.Builder#setExtras(android.os.PersistableBundle)}. This will * never be null. If you did not set any extras this will be an empty bundle. */ - public PersistableBundle getExtras() { + public @NonNull PersistableBundle getExtras() { return extras; } @@ -100,7 +102,7 @@ public class JobParameters implements Parcelable { * {@link android.app.job.JobInfo.Builder#setTransientExtras(android.os.Bundle)}. This will * never be null. If you did not set any extras this will be an empty bundle. */ - public Bundle getTransientExtras() { + public @NonNull Bundle getTransientExtras() { return transientExtras; } @@ -109,7 +111,7 @@ public class JobParameters implements Parcelable { * {@link android.app.job.JobInfo.Builder#setClipData(ClipData, int)}. Will be null * if it was not set. */ - public ClipData getClipData() { + public @Nullable ClipData getClipData() { return clipData; } @@ -140,7 +142,7 @@ public class JobParameters implements Parcelable { * always use {@link #getTriggeredContentAuthorities()} to determine whether the job was * triggered due to any content changes and the authorities they are associated with. */ - public Uri[] getTriggeredContentUris() { + public @Nullable Uri[] getTriggeredContentUris() { return mTriggeredContentUris; } @@ -152,7 +154,7 @@ public class JobParameters implements Parcelable { * to retrieve the details of which URIs changed (as long as that has not exceeded the maximum * number it can reported). */ - public String[] getTriggeredContentAuthorities() { + public @Nullable String[] getTriggeredContentAuthorities() { return mTriggeredContentAuthorities; } @@ -183,7 +185,7 @@ public class JobParameters implements Parcelable { * (This means that for correct operation, you must always call dequeueWork() after you have * completed other work, to check either for more work or allow the system to stop the job.) */ - public JobWorkItem dequeueWork() { + public @Nullable JobWorkItem dequeueWork() { try { return getCallback().dequeueWork(getJobId()); } catch (RemoteException e) { @@ -207,7 +209,7 @@ public class JobParameters implements Parcelable { * @param work The work you have completed processing, as previously returned by * {@link #dequeueWork()} */ - public void completeWork(JobWorkItem work) { + public void completeWork(@NonNull JobWorkItem work) { try { if (!getCallback().completeWork(getJobId(), work.getWorkId())) { throw new IllegalArgumentException("Given work is not active: " + work); diff --git a/core/java/android/app/job/JobScheduler.java b/core/java/android/app/job/JobScheduler.java index e0afe039478e..4d6e3a22c83c 100644 --- a/core/java/android/app/job/JobScheduler.java +++ b/core/java/android/app/job/JobScheduler.java @@ -72,7 +72,7 @@ public abstract class JobScheduler { * you can schedule. * @return An int representing ({@link #RESULT_SUCCESS} or {@link #RESULT_FAILURE}). */ - public abstract int schedule(JobInfo job); + public abstract int schedule(@NonNull JobInfo job); /** * Similar to {@link #schedule}, but allows you to enqueue work for an existing job. If a job @@ -108,7 +108,7 @@ public abstract class JobScheduler { * @param work New work to enqueue. This will be available later when the job starts running. * @return An int representing ({@link #RESULT_SUCCESS} or {@link #RESULT_FAILURE}). */ - public abstract int enqueue(JobInfo job, JobWorkItem work); + public abstract int enqueue(@NonNull JobInfo job, @NonNull JobWorkItem work); /** * @@ -121,7 +121,8 @@ public abstract class JobScheduler { * @hide */ @SystemApi - public abstract int scheduleAsPackage(JobInfo job, String packageName, int userId, String tag); + public abstract int scheduleAsPackage(@NonNull JobInfo job, @NonNull String packageName, + int userId, String tag); /** * Cancel a job that is pending in the JobScheduler. |
