SF: don't touch boost if we only have Exact layers
When we only have layers with vote type Exact (those are apps
that set a preferredDisplayModeId), we shouldn't let touch
to change the display refresh rate as there are no layers that
are interested in that switch.
Test: SF unit tests
Bug: 190331974
Change-Id: I23226a806d420dc3ee5a2f7dd77d5f39838f2745
diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
index 9746076..0234dbc 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
+++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.cpp
@@ -422,7 +422,15 @@
// actually increase the refresh rate over the normal selection.
const RefreshRate& touchRefreshRate = getMaxRefreshRateByPolicyLocked();
- bool touchBoostForExplicitExact = explicitExact == 0 || mSupportsFrameRateOverride;
+ const bool touchBoostForExplicitExact = [&] {
+ if (mSupportsFrameRateOverride) {
+ // Enable touch boost if there are other layers besides exact
+ return explicitExact + noVoteLayers != layers.size();
+ } else {
+ // Enable touch boost if there are no exact layers
+ return explicitExact == 0;
+ }
+ }();
if (globalSignals.touch && explicitDefaultVoteLayers == 0 && touchBoostForExplicitExact &&
bestRefreshRate->fps.lessThanWithMargin(touchRefreshRate.fps)) {
setTouchConsidered();