Merge "ExpressLog integration for JobScheduler" am: dc7b608720 am: fe1ec1044c am: 6586c76ce7

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2269493

Change-Id: I633913b0fee5b59a6f5eda4fcd6aa2d3f6327db4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Vova Sharaienko
2022-11-04 21:06:09 +00:00
committed by Automerger Merge Worker

View File

@@ -31,6 +31,7 @@ import android.util.TimeUtils;
import android.util.proto.ProtoOutputStream;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.expresslog.Counter;
import com.android.server.job.JobSchedulerService;
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).
final long nowElapsedMillis = sElapsedRealtimeClock.millis();
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;
} else if (job.hasTimingDelayConstraint() && evaluateTimingDelayConstraint(job,
nowElapsedMillis)) {
@@ -158,6 +161,8 @@ public final class TimeController extends StateController {
// Scheduler.
mStateChangedListener.onRunJobNow(job);
}
Counter.logIncrement(
"job_scheduler.value_job_scheduler_job_deadline_expired_counter");
} else if (wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_DEADLINE)) {
// This job's deadline is earlier than the current set alarm. Update the alarm.
setDeadlineExpiredAlarmLocked(job.getLatestRunTimeElapsed(),
@@ -228,6 +233,8 @@ public final class TimeController extends StateController {
// Scheduler.
mStateChangedListener.onRunJobNow(job);
}
Counter.logIncrement(
"job_scheduler.value_job_scheduler_job_deadline_expired_counter");
it.remove();
} else { // Sorted by expiry time, so take the next one and stop.
if (!wouldBeReadyWithConstraintLocked(job, JobStatus.CONSTRAINT_DEADLINE)) {