sweet: Add default frame rate setting

Add a new priority PRIORITY_DEVICE_PEAK_REFRESH_RATE, and a new config
setting config_defaultRefreshRate which maps to that priority. This
allows an OEM to easily specify a default frame rate different from the
peak frame rate.

Bug: 148978450
Bug: 154648391

Test: - Added new unit tests to verify DisplayModeDirector handles min,
        peak, and default refresh rate settings correctly.

- Modified a sweet to set config_defaultRefreshRate to 60Hz, confirmed
  we default to 60, but that an app calling setFrameRate(120) switches us
  to 120.

- Confirmed that the "smooth display" and "force 120Hz" options on Razer
  Phone work correctly.

- Confirmed Redfin works as it did before - still constrained to 60Hz.

Change-Id: Ibfc35abed2b67093b8114822d233bf1ca31eebb0
This commit is contained in:
Steven Thomas 2022-03-24 20:49:05 +05:30 committed by basamaryan
parent eba03e4f1b
commit 01ddd1a24b

View File

@ -292,8 +292,11 @@
-->
<bool name="config_fillMainBuiltInDisplayCutout">true</bool>
<!-- The default peak refresh rate for a given device. Change this value if you want to allow
for higher refresh rates to be automatically used out of the box -->
<!-- The default refresh rate. sweet manages this using the peak refresh rate setting, so set
this value to 0 so it has no effect. -->
<integer name="config_defaultRefreshRate">0</integer>
<!-- The default peak refresh rate. -->
<integer name="config_defaultPeakRefreshRate">120</integer>
</resources>