properly setting LayoutLimitedRefreshRate for LogicalDisplay
Test: atest LogicalDisplayTest Bug: 269222489 Change-Id: I241684e619fe28ea112ef5ecab92ea46db3d51b1
This commit is contained in:
committed by
Oleg Petšjonkin
parent
78d12d31d4
commit
1356c3ba49
@@ -1352,6 +1352,8 @@ public class DisplayModeDirector {
|
||||
return "PRIORITY_USER_SETTING_PEAK_RENDER_FRAME_RATE";
|
||||
case PRIORITY_AUTH_OPTIMIZER_RENDER_FRAME_RATE:
|
||||
return "PRIORITY_AUTH_OPTIMIZER_RENDER_FRAME_RATE";
|
||||
case PRIORITY_LAYOUT_LIMITED_FRAME_RATE:
|
||||
return "PRIORITY_LAYOUT_LIMITED_FRAME_RATE";
|
||||
default:
|
||||
return Integer.toString(priority);
|
||||
}
|
||||
|
||||
@@ -331,6 +331,19 @@ final class LogicalDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates layoutLimitedRefreshRate
|
||||
*
|
||||
* @param layoutLimitedRefreshRate refresh rate limited by layout or null.
|
||||
*/
|
||||
public void updateLayoutLimitedRefreshRateLocked(
|
||||
@Nullable SurfaceControl.RefreshRateRange layoutLimitedRefreshRate) {
|
||||
if (!Objects.equals(layoutLimitedRefreshRate, mBaseDisplayInfo.layoutLimitedRefreshRate)) {
|
||||
mBaseDisplayInfo.layoutLimitedRefreshRate = layoutLimitedRefreshRate;
|
||||
mInfo.set(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the state of the logical display based on the available display devices.
|
||||
* The logical display might become invalid if it is attached to a display device
|
||||
|
||||
@@ -1016,7 +1016,12 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
|
||||
|
||||
newDisplay.setDevicePositionLocked(displayLayout.getPosition());
|
||||
newDisplay.setLeadDisplayLocked(displayLayout.getLeadDisplayId());
|
||||
setLayoutLimitedRefreshRate(newDisplay, device, displayLayout);
|
||||
newDisplay.updateLayoutLimitedRefreshRateLocked(
|
||||
device.getDisplayDeviceConfig().getRefreshRange(
|
||||
displayLayout.getRefreshRateZoneId()
|
||||
)
|
||||
);
|
||||
|
||||
setEnabledLocked(newDisplay, displayLayout.isEnabled());
|
||||
newDisplay.setBrightnessThrottlingDataIdLocked(
|
||||
displayLayout.getBrightnessThrottlingMapId() == null
|
||||
@@ -1027,13 +1032,6 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void setLayoutLimitedRefreshRate(@NonNull LogicalDisplay logicalDisplay,
|
||||
@NonNull DisplayDevice device, @NonNull Layout.Display display) {
|
||||
DisplayDeviceConfig config = device.getDisplayDeviceConfig();
|
||||
DisplayInfo info = logicalDisplay.getDisplayInfoLocked();
|
||||
info.layoutLimitedRefreshRate = config.getRefreshRange(display.getRefreshRateZoneId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new logical display for the specified device and display Id and adds it to the list
|
||||
* of logical displays.
|
||||
|
||||
@@ -166,4 +166,16 @@ public class LogicalDisplayTest {
|
||||
assertEquals(Display.REMOVE_MODE_MOVE_CONTENT_TO_PRIMARY,
|
||||
mLogicalDisplay.getDisplayInfoLocked().removeMode);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLayoutLimitedRefreshRateNotClearedAfterUpdate() {
|
||||
SurfaceControl.RefreshRateRange refreshRateRange = new SurfaceControl.RefreshRateRange(1,
|
||||
2);
|
||||
mLogicalDisplay.updateLayoutLimitedRefreshRateLocked(refreshRateRange);
|
||||
mLogicalDisplay.updateDisplayGroupIdLocked(1);
|
||||
|
||||
DisplayInfo result = mLogicalDisplay.getDisplayInfoLocked();
|
||||
|
||||
assertEquals(refreshRateRange, result.layoutLimitedRefreshRate);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user