diff options
| author | Matthew Williams <mjwilliams@google.com> | 2014-09-10 17:32:18 -0700 |
|---|---|---|
| committer | Matthew Williams <mjwilliams@google.com> | 2014-09-10 17:32:18 -0700 |
| commit | 03a4da6e8e92b19c1345016c06694cb3aabbfc27 (patch) | |
| tree | 4a3e0ca61ef6412590648037ba33638195346601 /core/java/android | |
| parent | 1b848d4894b3aa82d2fcae605acbede3f865456e (diff) | |
| download | frameworks_base-03a4da6e8e92b19c1345016c06694cb3aabbfc27.zip frameworks_base-03a4da6e8e92b19c1345016c06694cb3aabbfc27.tar.gz frameworks_base-03a4da6e8e92b19c1345016c06694cb3aabbfc27.tar.bz2 | |
Add flag to JobParameters for job expired
BUG: 17424511
Introduce an "isOverrideDeadlineExpired" which will allow clients
to know when they are being run due to an expiry.
Nb that we check deadline expiry by checking that the constraints on
the job are not satisfied at execution time. Really this is the same
thing, as a job will not be run without its constraints being met,
unless the job has expired.
Change-Id: I4b91e5b5eadccabd91296d5a5ca66b859dbfaf5c
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/job/JobParameters.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/core/java/android/app/job/JobParameters.java b/core/java/android/app/job/JobParameters.java index 724856a..62734f2 100644 --- a/core/java/android/app/job/JobParameters.java +++ b/core/java/android/app/job/JobParameters.java @@ -32,12 +32,15 @@ public class JobParameters implements Parcelable { private final int jobId; private final PersistableBundle extras; private final IBinder callback; + private final boolean overrideDeadlineExpired; /** @hide */ - public JobParameters(int jobId, PersistableBundle extras, IBinder callback) { + public JobParameters(IBinder callback, int jobId, PersistableBundle extras, + boolean overrideDeadlineExpired) { this.jobId = jobId; this.extras = extras; this.callback = callback; + this.overrideDeadlineExpired = overrideDeadlineExpired; } /** @@ -56,6 +59,16 @@ public class JobParameters implements Parcelable { return extras; } + /** + * For jobs with {@link android.app.job.JobInfo.Builder#setOverrideDeadline(long)} set, this + * provides an easy way to tell whether the job is being executed due to the deadline + * expiring. Note: If the job is running because its deadline expired, it implies that its + * constraints will not be met. + */ + public boolean isOverrideDeadlineExpired() { + return overrideDeadlineExpired; + } + /** @hide */ public IJobCallback getCallback() { return IJobCallback.Stub.asInterface(callback); @@ -65,6 +78,7 @@ public class JobParameters implements Parcelable { jobId = in.readInt(); extras = in.readPersistableBundle(); callback = in.readStrongBinder(); + overrideDeadlineExpired = in.readInt() == 1; } @Override @@ -77,6 +91,7 @@ public class JobParameters implements Parcelable { dest.writeInt(jobId); dest.writePersistableBundle(extras); dest.writeStrongBinder(callback); + dest.writeInt(overrideDeadlineExpired ? 1 : 0); } public static final Creator<JobParameters> CREATOR = new Creator<JobParameters>() { |
