Refresh rate preference controllers aware of multiple displays

Set mPeakRefreshRate in the preference controllers to the highest refresh rate among all the modes of all the displays. It'll then be used to determine two things:
- if the setting is available
- the summary of the setting

This should only be done if the back up smooth display feature flag is enabled. If it's disabled, mPeakRefreshRate is passed to DisplayModeDirector and used for the votes. If the highest refresh rate of one display is 120 and that of the other is 130, we shouldn't set the vote to 130 for both displays. With the flag enabled, DisplayModeDirector figures out the highest refresh rate for each display.

Bug: 310238382
Test: atest PeakRefreshRatePreferenceControllerTest
Test: atest ForcePeakRefreshRatePreferenceControllerTest
Test: atest RefreshRateSettingsUtilsTest
Change-Id: I369927ba22df70958178505d8fc7c5747aaa8fdd
This commit is contained in:
Piotr Wilczyński
2024-02-16 19:21:33 +00:00
parent 950d9e9fee
commit 96343a9eff
5 changed files with 118 additions and 9 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.display;
import static com.android.internal.display.RefreshRateSettingsUtils.DEFAULT_REFRESH_RATE;
import static com.android.internal.display.RefreshRateSettingsUtils.findHighestRefreshRateAmongAllDisplays;
import static com.android.internal.display.RefreshRateSettingsUtils.findHighestRefreshRateForDefaultDisplay;
import android.content.Context;
@@ -66,7 +67,9 @@ public class PeakRefreshRatePreferenceController extends TogglePreferenceControl
updateState(mPreference);
}
};
mPeakRefreshRate = Math.round(findHighestRefreshRateForDefaultDisplay(context));
mPeakRefreshRate = Math.round(Flags.backUpSmoothDisplayAndForcePeakRefreshRate()
? findHighestRefreshRateAmongAllDisplays(context)
: findHighestRefreshRateForDefaultDisplay(context));
Log.d(
TAG,
"DEFAULT_REFRESH_RATE : "