public final class JobStatus extends Object
JobInfo
object when it lands on the scheduler.
Contains current state of the requirements of the job, as well as a function to evaluate
whether it's ready to run.
This object is shared among the various controllers - hence why the different fields are atomic.
This isn't strictly necessary because each controller is only interested in a specific field,
and the receivers that are listening for global state change will all run on the main looper,
but we don't enforce that so this is safer.Modifier and Type | Field and Description |
---|---|
ArraySet<String> |
changedAuthorities |
ArraySet<Uri> |
changedUris |
static long |
DEFAULT_TRIGGER_MAX_DELAY
If not specified, trigger maxumum delay is 2 minutes.
|
static long |
DEFAULT_TRIGGER_UPDATE_DELAY
If not specified, trigger update delay is 10 seconds.
|
boolean |
dozeWhitelisted |
int |
lastEvaluatedPriority |
static long |
MIN_TRIGGER_MAX_DELAY
The minimum possible update delay is 1 second.
|
static long |
MIN_TRIGGER_UPDATE_DELAY
The minimum possible update delay is 1/2 second.
|
static long |
NO_EARLIEST_RUNTIME |
static long |
NO_LATEST_RUNTIME |
static int |
OVERRIDE_FULL |
static int |
OVERRIDE_SOFT |
int |
overrideState |
Constructor and Description |
---|
JobStatus(JobInfo job,
int callingUid,
String sourcePackageName,
int sourceUserId,
String sourceTag,
long earliestRunTimeElapsedMillis,
long latestRunTimeElapsedMillis)
Create a new JobStatus that was loaded from disk.
|
JobStatus(JobStatus jobStatus)
Copy constructor.
|
JobStatus(JobStatus rescheduling,
long newEarliestRuntimeElapsedMillis,
long newLatestRuntimeElapsedMillis,
int backoffAttempt)
Create a new job to be rescheduled with the provided parameters.
|
Modifier and Type | Method and Description |
---|---|
static JobStatus |
createFromJobInfo(JobInfo job,
int callingUid,
String sourcePackageName,
int sourceUserId,
String tag)
Create a newly scheduled job.
|
void |
dump(PrintWriter pw,
String prefix,
boolean full) |
String |
getBatteryName() |
long |
getEarliestRunTime() |
PersistableBundle |
getExtras() |
int |
getFlags() |
JobInfo |
getJob() |
int |
getJobId() |
long |
getLatestRunTimeElapsed() |
int |
getNumFailures() |
int |
getPriority() |
ComponentName |
getServiceComponent() |
int |
getServiceToken()
Provide a handle to the service that this job will be run on.
|
String |
getSourcePackageName() |
String |
getSourceTag() |
int |
getSourceUid() |
int |
getSourceUserId() |
String |
getTag() |
long |
getTriggerContentMaxDelay() |
long |
getTriggerContentUpdateDelay() |
int |
getUid() |
int |
getUserId() |
boolean |
hasChargingConstraint() |
boolean |
hasConnectivityConstraint() |
boolean |
hasContentTriggerConstraint() |
boolean |
hasDeadlineConstraint() |
boolean |
hasIdleConstraint() |
boolean |
hasNotRoamingConstraint() |
boolean |
hasTimingDelayConstraint() |
boolean |
hasUnmeteredConstraint() |
boolean |
isConstraintsSatisfied() |
boolean |
isPersisted() |
boolean |
isReady() |
boolean |
matches(int uid,
int jobId) |
void |
printUniqueId(PrintWriter pw) |
boolean |
shouldDump(int filterUid) |
String |
toShortString()
Convenience function to identify a job uniquely without pulling all the data that
toString() returns. |
String |
toShortStringExceptUniqueId()
Convenience function to identify a job uniquely without pulling all the data that
toString() returns. |
String |
toString()
Returns a string representation of the object.
|
public static final long NO_LATEST_RUNTIME
public static final long NO_EARLIEST_RUNTIME
public static final int OVERRIDE_SOFT
public static final int OVERRIDE_FULL
public static final long DEFAULT_TRIGGER_UPDATE_DELAY
public static final long MIN_TRIGGER_UPDATE_DELAY
public static final long DEFAULT_TRIGGER_MAX_DELAY
public static final long MIN_TRIGGER_MAX_DELAY
public boolean dozeWhitelisted
public int lastEvaluatedPriority
public int overrideState
public JobStatus(JobStatus jobStatus)
public JobStatus(JobInfo job, int callingUid, String sourcePackageName, int sourceUserId, String sourceTag, long earliestRunTimeElapsedMillis, long latestRunTimeElapsedMillis)
JobInfo
time criteria because we can load a persisted periodic job
from the JobStore
and still want to respect its
wallclock runtime rather than resetting it on every boot.
We consider a freshly loaded job to no longer be in back-off.public JobStatus(JobStatus rescheduling, long newEarliestRuntimeElapsedMillis, long newLatestRuntimeElapsedMillis, int backoffAttempt)
public int getServiceToken()
public static JobStatus createFromJobInfo(JobInfo job, int callingUid, String sourcePackageName, int sourceUserId, String tag)
callingUid
- Uid of the package that scheduled this job.sourcePackageName
- Package name on whose behalf this job is scheduled. Null indicates
the calling package is the source.sourceUserId
- User id for whom this job is scheduled. -1 indicates this is same as thepublic JobInfo getJob()
public int getJobId()
public void printUniqueId(PrintWriter pw)
public int getNumFailures()
public ComponentName getServiceComponent()
public String getSourcePackageName()
public int getSourceUid()
public int getSourceUserId()
public int getUserId()
public String getSourceTag()
public int getUid()
public String getBatteryName()
public String getTag()
public PersistableBundle getExtras()
public int getPriority()
public int getFlags()
public boolean hasConnectivityConstraint()
public boolean hasUnmeteredConstraint()
public boolean hasNotRoamingConstraint()
public boolean hasChargingConstraint()
public boolean hasTimingDelayConstraint()
public boolean hasDeadlineConstraint()
public boolean hasIdleConstraint()
public boolean hasContentTriggerConstraint()
public long getTriggerContentUpdateDelay()
public long getTriggerContentMaxDelay()
public boolean isPersisted()
public long getEarliestRunTime()
public long getLatestRunTimeElapsed()
public boolean shouldDump(int filterUid)
public boolean isReady()
public boolean isConstraintsSatisfied()
public boolean matches(int uid, int jobId)
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
public String toShortString()
toString()
returns.public String toShortStringExceptUniqueId()
toString()
returns.public void dump(PrintWriter pw, String prefix, boolean full)