Increase thermal threshold for all UI jobs.

Instead of throttling retried or long running UI jobs at MODERATE,
throttle all UI jobs only at SEVERE.

Bug: 277939752
Test: atest FrameworksMockingServicesTests:ThermalStatusRestrictionTest
Change-Id: I6be7c75f457f309d89523fa0494c98e07cd8360d
This commit is contained in:
Kweku Adams
2023-04-12 19:33:31 +00:00
parent 19f8710853
commit a16e3f815b
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);