Lines Matching refs:JobStatus
38 import com.android.server.job.controllers.JobStatus;
124 * Add a job to the master list, persisting it if necessary. If the JobStatus already exists,
126 * @param jobStatus Job to add.
127 * @return Whether or not an equivalent JobStatus was replaced by this operation.
129 public boolean add(JobStatus jobStatus) {
130 boolean replaced = mJobSet.remove(jobStatus);
131 mJobSet.add(jobStatus);
132 if (jobStatus.isPersisted()) {
136 Slog.d(TAG, "Added job status to store: " + jobStatus);
141 boolean containsJob(JobStatus jobStatus) {
142 return mJobSet.contains(jobStatus);
158 public boolean remove(JobStatus jobStatus, boolean writeBack) {
159 boolean removed = mJobSet.remove(jobStatus);
162 Slog.d(TAG, "Couldn't remove job: didn't exist: " + jobStatus);
166 if (writeBack && jobStatus.isPersisted()) {
182 public List<JobStatus> getJobsByUser(int userHandle) {
188 * @return All JobStatus objects for a given uid from the master list. Never null.
190 public List<JobStatus> getJobsByUid(int uid) {
197 * @return the JobStatus that matches the provided uId and jobId, or null if none found.
199 public JobStatus getJobByUidAndJobId(int uid, int jobId) {
218 public void process(JobStatus jobStatus);
259 final List<JobStatus> storeCopy = new ArrayList<JobStatus>();
264 public void process(JobStatus job) {
266 storeCopy.add(new JobStatus(job));
278 private void writeJobsMapImpl(List<JobStatus> jobList) {
289 JobStatus jobStatus = jobList.get(i);
291 Slog.d(TAG, "Saving job " + jobStatus.getJobId());
294 addAttributesToJobTag(out, jobStatus);
295 writeConstraintsToXml(out, jobStatus);
296 writeExecutionCriteriaToXml(out, jobStatus);
297 writeBundleToXml(jobStatus.getExtras(), out);
322 private void addAttributesToJobTag(XmlSerializer out, JobStatus jobStatus)
324 out.attribute(null, "jobid", Integer.toString(jobStatus.getJobId()));
325 out.attribute(null, "package", jobStatus.getServiceComponent().getPackageName());
326 out.attribute(null, "class", jobStatus.getServiceComponent().getClassName());
327 if (jobStatus.getSourcePackageName() != null) {
328 out.attribute(null, "sourcePackageName", jobStatus.getSourcePackageName());
330 if (jobStatus.getSourceTag() != null) {
331 out.attribute(null, "sourceTag", jobStatus.getSourceTag());
333 out.attribute(null, "sourceUserId", String.valueOf(jobStatus.getSourceUserId()));
334 out.attribute(null, "uid", Integer.toString(jobStatus.getUid()));
335 out.attribute(null, "priority", String.valueOf(jobStatus.getPriority()));
336 out.attribute(null, "flags", String.valueOf(jobStatus.getFlags()));
367 private void writeConstraintsToXml(XmlSerializer out, JobStatus jobStatus) throws IOException {
369 if (jobStatus.hasConnectivityConstraint()) {
372 if (jobStatus.hasUnmeteredConstraint()) {
375 if (jobStatus.hasNotRoamingConstraint()) {
378 if (jobStatus.hasIdleConstraint()) {
381 if (jobStatus.hasChargingConstraint()) {
387 private void writeExecutionCriteriaToXml(XmlSerializer out, JobStatus jobStatus)
389 final JobInfo job = jobStatus.getJob();
390 if (jobStatus.getJob().isPeriodic()) {
398 if (jobStatus.hasDeadlineConstraint()) {
401 (jobStatus.getLatestRunTimeElapsed() - SystemClock.elapsedRealtime());
404 if (jobStatus.hasTimingDelayConstraint()) {
406 (jobStatus.getEarliestRunTime() - SystemClock.elapsedRealtime());
413 if (jobStatus
414 || jobStatus.getJob().getBackoffPolicy() != JobInfo.DEFAULT_BACKOFF_POLICY) {
428 * need to go through {@link JobStore#add(com.android.server.job.controllers.JobStatus)}.
434 * @param jobSet Reference to the (empty) set of JobStatus objects that back the JobStore,
444 List<JobStatus> jobs;
470 private List<JobStatus> readJobMapImpl(FileInputStream fis)
490 final List<JobStatus> jobs = new ArrayList<JobStatus>();
509 JobStatus persistedJob = restoreJobFromXml(parser);
532 private JobStatus restoreJobFromXml(XmlPullParser parser) throws XmlPullParserException,
637 if (elapsedRuntimes.first != JobStatus.NO_EARLIEST_RUNTIME) {
640 if (elapsedRuntimes.second != JobStatus.NO_LATEST_RUNTIME) {
687 JobStatus js = new JobStatus(
752 long earliestRunTimeElapsed = JobStatus.NO_EARLIEST_RUNTIME;
753 long latestRunTimeElapsed = JobStatus.NO_LATEST_RUNTIME;
775 private SparseArray<ArraySet<JobStatus>> mJobs;
778 mJobs = new SparseArray<ArraySet<JobStatus>>();
781 public List<JobStatus> getJobsByUid(int uid) {
782 ArrayList<JobStatus> matchingJobs = new ArrayList<JobStatus>();
783 ArraySet<JobStatus> jobs = mJobs.get(uid);
791 public List<JobStatus> getJobsByUser(int userId) {
792 ArrayList<JobStatus> result = new ArrayList<JobStatus>();
795 ArraySet<JobStatus> jobs = mJobs.get(i);
804 public boolean add(JobStatus job) {
806 ArraySet<JobStatus> jobs = mJobs.get(uid);
808 jobs = new ArraySet<JobStatus>();
814 public boolean remove(JobStatus job) {
816 ArraySet<JobStatus> jobs = mJobs.get(uid);
825 public boolean contains(JobStatus job) {
827 ArraySet<JobStatus> jobs = mJobs.get(uid);
831 public JobStatus get(int uid, int jobId) {
832 ArraySet<JobStatus> jobs = mJobs.get(uid);
835 JobStatus job = jobs.valueAt(i);
845 public List<JobStatus> getAllJobs() {
846 ArrayList<JobStatus> allJobs = new ArrayList<JobStatus>(size());
848 ArraySet<JobStatus> jobs = mJobs.valueAt(i);
877 ArraySet<JobStatus> jobs = mJobs.get(uid);
880 JobStatus job = jobs.valueAt(i);
891 ArraySet<JobStatus> jobs = mJobs.valueAt(uidIndex);
899 ArraySet<JobStatus> jobs = mJobs.get(uid);