RefreshRateConfigs: fix getMaxRefreshRateByPolicyLocked
If there are no layers which are requesting a
non seamless switch getMaxRefreshRateByPolicyLocked
should return the max refresh rate from the group of
the default mode (and not the group of the current mode).
This fixes a bug where when the display mode is never
reset to default after we exit an app which has called
setFrameRate with changeFrameRateStrategy=Always.
This change should have no affect phones, because
there all modes are in the same config group.
Bug: 199270559
Test: atest MatchContentFrameRateTest SetFrameRateTest
Test: atest RefreshRateConfigsTest
Change-Id: I6ff200a85edf026b0d04d4a06a13995832ffdab4
diff --git a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
index 0d75689..3713587 100644
--- a/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
+++ b/services/surfaceflinger/Scheduler/RefreshRateConfigs.h
@@ -388,7 +388,11 @@
// Returns the highest refresh rate according to the current policy. May change at runtime. Only
// uses the primary range, not the app request range.
- const RefreshRate& getMaxRefreshRateByPolicyLocked() const REQUIRES(mLock);
+ const RefreshRate& getMaxRefreshRateByPolicyLocked() const REQUIRES(mLock) {
+ return getMaxRefreshRateByPolicyLocked(mCurrentRefreshRate->getModeGroup());
+ }
+
+ const RefreshRate& getMaxRefreshRateByPolicyLocked(int anchorGroup) const REQUIRES(mLock);
// Returns the current refresh rate, if allowed. Otherwise the default that is allowed by
// the policy.