diff --git a/services/core/java/com/android/server/job/JobSchedulerService.java b/services/core/java/com/android/server/job/JobSchedulerService.java index 30154d716f7fc..f456bcd4af7f0 100644 --- a/services/core/java/com/android/server/job/JobSchedulerService.java +++ b/services/core/java/com/android/server/job/JobSchedulerService.java @@ -195,12 +195,13 @@ public class JobSchedulerService extends com.android.server.SystemService } private void cancelJobsForUser(int userHandle) { + List jobsForUser; synchronized (mJobs) { - List jobsForUser = mJobs.getJobsByUser(userHandle); - for (int i=0; i jobsForUid; synchronized (mJobs) { - List jobsForUid = mJobs.getJobsByUid(uid); - for (int i=0; i jobs = mJobs.getJobs(); - if (DEBUG) { - Slog.d(TAG, "queuing all ready jobs for execution:"); - } - for (int i=0; i jobs = mJobs.getJobs(); + if (DEBUG) { + Slog.d(TAG, "queuing all ready jobs for execution:"); + } + for (int i=0; i runnableJobs = new ArrayList(); - ArraySet jobs = mJobs.getJobs(); - for (int i=0; i 0) { - backoffCount++; - } - if (job.hasIdleConstraint()) { - idleCount++; - } - if (job.hasConnectivityConstraint() || job.hasUnmeteredConstraint()) { - connectivityCount++; - } - if (job.hasChargingConstraint()) { - chargingCount++; - } - runnableJobs.add(job); - } else if (isReadyToBeCancelledLocked(job)) { - stopJobOnServiceContextLocked(job); - } - } - if (backoffCount > 0 || - idleCount >= MIN_IDLE_COUNT || - connectivityCount >= MIN_CONNECTIVITY_COUNT || - chargingCount >= MIN_CHARGING_COUNT || - runnableJobs.size() >= MIN_READY_JOBS_COUNT) { - if (DEBUG) { - Slog.d(TAG, "maybeQueueReadyJobsForExecutionH: Running jobs."); - } - for (int i=0; i runnableJobs = new ArrayList(); + ArraySet jobs = mJobs.getJobs(); + for (int i=0; i 0) { + backoffCount++; } + if (job.hasIdleConstraint()) { + idleCount++; + } + if (job.hasConnectivityConstraint() || job.hasUnmeteredConstraint()) { + connectivityCount++; + } + if (job.hasChargingConstraint()) { + chargingCount++; + } + runnableJobs.add(job); + } else if (isReadyToBeCancelledLocked(job)) { + stopJobOnServiceContextLocked(job); } + } + if (backoffCount > 0 || + idleCount >= MIN_IDLE_COUNT || + connectivityCount >= MIN_CONNECTIVITY_COUNT || + chargingCount >= MIN_CHARGING_COUNT || + runnableJobs.size() >= MIN_READY_JOBS_COUNT) { if (DEBUG) { - Slog.d(TAG, "idle=" + idleCount + " connectivity=" + - connectivityCount + " charging=" + chargingCount + " tot=" + - runnableJobs.size()); + Slog.d(TAG, "maybeQueueReadyJobsForExecutionLockedH: Running jobs."); } + for (int i=0; i