Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2710373 authored by Vova Sharaienko's avatar Vova Sharaienko Committed by Automerger Merge Worker
Browse files

Merge "ExpressLog integration for JobScheduler" am: dc7b6087 am: fe1ec104 am: 6586c76c

parents aa598d07 6586c76c
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@ import android.util.TimeUtils;
import android.util.proto.ProtoOutputStream;
import android.util.proto.ProtoOutputStream;


import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.expresslog.Counter;
import com.android.server.job.JobSchedulerService;
import com.android.server.job.JobSchedulerService;
import com.android.server.job.StateControllerProto;
import com.android.server.job.StateControllerProto;


@@ -88,6 +89,8 @@ public final class TimeController extends StateController {
            // will never be unsatisfied (our time base can not go backwards).
            // will never be unsatisfied (our time base can not go backwards).
            final long nowElapsedMillis = sElapsedRealtimeClock.millis();
            final long nowElapsedMillis = sElapsedRealtimeClock.millis();
            if (job.hasDeadlineConstraint() && evaluateDeadlineConstraint(job, nowElapsedMillis)) {
            if (job.hasDeadlineConstraint() && evaluateDeadlineConstraint(job, nowElapsedMillis)) {
                // We're intentionally excluding jobs whose deadlines have passed
                // (mostly like deadlines of 0) when the job was scheduled.
                return;
                return;
            } else if (job.hasTimingDelayConstraint() && evaluateTimingDelayConstraint(job,
            } else if (job.hasTimingDelayConstraint() && evaluateTimingDelayConstraint(job,
                    nowElapsedMillis)) {
                    nowElapsedMillis)) {
@@ -158,6 +161,8 @@ public final class TimeController extends StateController {
                    // Scheduler.
                    // Scheduler.
                    mStateChangedListener.onRunJobNow(job);
                    mStateChangedListener.onRunJobNow(job);
                }
                }
                Counter.logIncrement(
                        "job_scheduler.value_job_scheduler_job_deadline_expired_counter");
            } else if (wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_DEADLINE)) {
            } else if (wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_DEADLINE)) {
                // This job's deadline is earlier than the current set alarm. Update the alarm.
                // This job's deadline is earlier than the current set alarm. Update the alarm.
                setDeadlineExpiredAlarmLocked(job.getLatestRunTimeElapsed(),
                setDeadlineExpiredAlarmLocked(job.getLatestRunTimeElapsed(),
@@ -228,6 +233,8 @@ public final class TimeController extends StateController {
                        // Scheduler.
                        // Scheduler.
                        mStateChangedListener.onRunJobNow(job);
                        mStateChangedListener.onRunJobNow(job);
                    }
                    }
                    Counter.logIncrement(
                            "job_scheduler.value_job_scheduler_job_deadline_expired_counter");
                    it.remove();
                    it.remove();
                } else {  // Sorted by expiry time, so take the next one and stop.
                } else {  // Sorted by expiry time, so take the next one and stop.
                    if (!wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_DEADLINE)) {
                    if (!wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_DEADLINE)) {