With content detection off, prefer default frame rate
When content detection is off, or when we have no layer information to
make a decision, prefer the default frame rate.
Bug: 154648391
Test: - Modified a Pixel 4 to turn off content detection, idle, touch,
and power boost. Confirmed that, without this CL, we have bad
behavior where calls to setFrameRate() persist after the layer
goes away, and that this CL fixes that behavior.
- Modified and enhanced the "no layers" unit test in
RefreshRateConfigsTest.cpp.
Change-Id: I2fd0d64a6ad369580cbb2ebf91cbbed7c31e0281
diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
index 8d958df..5820fc5 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
+++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
@@ -139,8 +139,8 @@
return getMinRefreshRateByPolicyLocked();
}
- if (layers.empty()) {
- return getCurrentRefreshRateByPolicyLocked();
+ if (layers.empty() || noVoteLayers == layers.size()) {
+ return getMaxRefreshRateByPolicyLocked();
}
// Only if all layers want Min we should return Min