Merge "Increase thermal threshold for all UI jobs." into udc-dev

This commit is contained in:
TreeHugger Robot
2023-04-13 02:06:20 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 4 deletions

View File

@@ -92,13 +92,17 @@ public class ThermalStatusRestriction extends JobRestriction {
final int priority = job.getEffectivePriority();
if (mThermalStatus >= HIGHER_PRIORITY_THRESHOLD) {
// For moderate throttling:
// Only let expedited & user-initiated jobs run if:
// Let all user-initiated jobs run.
// Only let expedited jobs run if:
// 1. They haven't previously run
// 2. They're already running and aren't yet in overtime
// Only let high priority jobs run if:
// They are already running and aren't yet in overtime
// Don't let any other job run.
if (job.shouldTreatAsExpeditedJob() || job.shouldTreatAsUserInitiatedJob()) {
if (job.shouldTreatAsUserInitiatedJob()) {
return false;
}
if (job.shouldTreatAsExpeditedJob()) {
return job.getNumPreviousAttempts() > 0
|| (mService.isCurrentlyRunningLocked(job)
&& mService.isJobInOvertimeLocked(job));

View File

@@ -276,9 +276,9 @@ public class ThermalStatusRestrictionTest {
assertFalse(mThermalStatusRestriction.isJobRestricted(ejRunning));
assertTrue(mThermalStatusRestriction.isJobRestricted(ejRunningLong));
assertFalse(mThermalStatusRestriction.isJobRestricted(ui));
assertTrue(mThermalStatusRestriction.isJobRestricted(uiRetried));
assertFalse(mThermalStatusRestriction.isJobRestricted(uiRetried));
assertFalse(mThermalStatusRestriction.isJobRestricted(uiRunning));
assertTrue(mThermalStatusRestriction.isJobRestricted(uiRunningLong));
assertFalse(mThermalStatusRestriction.isJobRestricted(uiRunningLong));
mStatusChangedListener.onThermalStatusChanged(THERMAL_STATUS_SEVERE);