Rename "long running" to "overtime".
Use "overtime job" instead of "long running" to refer to jobs that
have been running longer than their minimum execution timeout and
are thus running in overtime to avoid naming collision with new long
running job features.
Bug: 141645789
Test: Android builds
Change-Id: I7298f69aa16a422c9887b07a51d1f53314635978
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java b/apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java
index 20bca35..52dc01b 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobConcurrencyManager.java
@@ -460,14 +460,14 @@
if (mPowerManager != null && mPowerManager.isDeviceIdleMode()) {
synchronized (mLock) {
stopUnexemptedJobsForDoze();
- stopLongRunningJobsLocked("deep doze");
+ stopOvertimeJobsLocked("deep doze");
}
}
break;
case PowerManager.ACTION_POWER_SAVE_MODE_CHANGED:
if (mPowerManager != null && mPowerManager.isPowerSaveMode()) {
synchronized (mLock) {
- stopLongRunningJobsLocked("battery saver");
+ stopOvertimeJobsLocked("battery saver");
}
}
break;
@@ -555,7 +555,7 @@
* execution guarantee.
*/
@GuardedBy("mLock")
- boolean isJobLongRunningLocked(@NonNull JobStatus job) {
+ boolean isJobInOvertimeLocked(@NonNull JobStatus job) {
if (!mRunningJobs.contains(job)) {
return false;
}
@@ -1043,7 +1043,7 @@
}
@GuardedBy("mLock")
- private void stopLongRunningJobsLocked(@NonNull String debugReason) {
+ private void stopOvertimeJobsLocked(@NonNull String debugReason) {
for (int i = 0; i < mActiveServices.size(); ++i) {
final JobServiceContext jsc = mActiveServices.get(i);
final JobStatus jobStatus = jsc.getRunningJobLocked();
@@ -1060,7 +1060,7 @@
* restricted by the given {@link JobRestriction}.
*/
@GuardedBy("mLock")
- void maybeStopLongRunningJobsLocked(@NonNull JobRestriction restriction) {
+ void maybeStopOvertimeJobsLocked(@NonNull JobRestriction restriction) {
for (int i = mActiveServices.size() - 1; i >= 0; --i) {
final JobServiceContext jsc = mActiveServices.get(i);
final JobStatus jobStatus = jsc.getRunningJobLocked();
diff --git a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
index d28ebde..6375d0d 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java
@@ -1870,10 +1870,10 @@
return mConcurrencyManager.isJobRunningLocked(job);
}
- /** @see JobConcurrencyManager#isJobLongRunningLocked(JobStatus) */
+ /** @see JobConcurrencyManager#isJobInOvertimeLocked(JobStatus) */
@GuardedBy("mLock")
- public boolean isLongRunningLocked(JobStatus job) {
- return mConcurrencyManager.isJobLongRunningLocked(job);
+ public boolean isJobInOvertimeLocked(JobStatus job) {
+ return mConcurrencyManager.isJobInOvertimeLocked(job);
}
private void noteJobPending(JobStatus job) {
@@ -2155,11 +2155,11 @@
@Override
public void onRestrictionStateChanged(@NonNull JobRestriction restriction,
- boolean stopLongRunningJobs) {
+ boolean stopOvertimeJobs) {
mHandler.obtainMessage(MSG_CHECK_JOB).sendToTarget();
- if (stopLongRunningJobs) {
+ if (stopOvertimeJobs) {
synchronized (mLock) {
- mConcurrencyManager.maybeStopLongRunningJobsLocked(restriction);
+ mConcurrencyManager.maybeStopOvertimeJobsLocked(restriction);
}
}
}
diff --git a/apex/jobscheduler/service/java/com/android/server/job/StateChangedListener.java b/apex/jobscheduler/service/java/com/android/server/job/StateChangedListener.java
index d7bd030..554f152 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/StateChangedListener.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/StateChangedListener.java
@@ -41,11 +41,11 @@
* Called by a {@link com.android.server.job.restrictions.JobRestriction} to notify the
* JobScheduler that it should check on the state of all jobs.
*
- * @param stopLongRunningJobs Whether to stop any jobs that have run for more than their minimum
- * execution guarantee and are restricted by the changed restriction
+ * @param stopOvertimeJobs Whether to stop any jobs that have run for more than their minimum
+ * execution guarantee and are restricted by the changed restriction
*/
void onRestrictionStateChanged(@NonNull JobRestriction restriction,
- boolean stopLongRunningJobs);
+ boolean stopOvertimeJobs);
/**
* Called by the controller to notify the JobManager that regardless of the state of the task,
diff --git a/apex/jobscheduler/service/java/com/android/server/job/restrictions/ThermalStatusRestriction.java b/apex/jobscheduler/service/java/com/android/server/job/restrictions/ThermalStatusRestriction.java
index a007a69..ca2fd60 100644
--- a/apex/jobscheduler/service/java/com/android/server/job/restrictions/ThermalStatusRestriction.java
+++ b/apex/jobscheduler/service/java/com/android/server/job/restrictions/ThermalStatusRestriction.java
@@ -90,11 +90,11 @@
final int priority = job.getEffectivePriority();
if (mThermalStatus >= HIGHER_PRIORITY_THRESHOLD) {
// For moderate throttling, only let expedited jobs and high priority regular jobs that
- // haven't been running for long run.
+ // haven't been running for a long time run.
return !job.shouldTreatAsExpeditedJob()
&& !(priority == JobInfo.PRIORITY_HIGH
&& mService.isCurrentlyRunningLocked(job)
- && !mService.isLongRunningLocked(job));
+ && !mService.isJobInOvertimeLocked(job));
}
if (mThermalStatus >= LOW_PRIORITY_THRESHOLD) {
// For light throttling, throttle all min priority jobs and all low priority jobs that
@@ -102,7 +102,7 @@
return priority == JobInfo.PRIORITY_MIN
|| (priority == JobInfo.PRIORITY_LOW
&& (!mService.isCurrentlyRunningLocked(job)
- || mService.isLongRunningLocked(job)));
+ || mService.isJobInOvertimeLocked(job)));
}
return false;
}
diff --git a/services/tests/mockingservicestests/src/com/android/server/job/restrictions/ThermalStatusRestrictionTest.java b/services/tests/mockingservicestests/src/com/android/server/job/restrictions/ThermalStatusRestrictionTest.java
index aa95916..f88e18b 100644
--- a/services/tests/mockingservicestests/src/com/android/server/job/restrictions/ThermalStatusRestrictionTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/job/restrictions/ThermalStatusRestrictionTest.java
@@ -184,8 +184,10 @@
when(mJobSchedulerService.isCurrentlyRunningLocked(jobLowPriorityRunning)).thenReturn(true);
when(mJobSchedulerService.isCurrentlyRunningLocked(jobHighPriorityRunning))
.thenReturn(true);
- when(mJobSchedulerService.isLongRunningLocked(jobLowPriorityRunningLong)).thenReturn(true);
- when(mJobSchedulerService.isLongRunningLocked(jobHighPriorityRunningLong)).thenReturn(true);
+ when(mJobSchedulerService.isJobInOvertimeLocked(jobLowPriorityRunningLong))
+ .thenReturn(true);
+ when(mJobSchedulerService.isJobInOvertimeLocked(jobHighPriorityRunningLong))
+ .thenReturn(true);
assertFalse(mThermalStatusRestriction.isJobRestricted(jobMinPriority));
assertFalse(mThermalStatusRestriction.isJobRestricted(jobLowPriority));