Merge "properly setting LayoutLimitedRefreshRate for LogicalDisplay" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
40c76b3458
@@ -1352,6 +1352,8 @@ public class DisplayModeDirector {
|
|||||||
return "PRIORITY_USER_SETTING_PEAK_RENDER_FRAME_RATE";
|
return "PRIORITY_USER_SETTING_PEAK_RENDER_FRAME_RATE";
|
||||||
case PRIORITY_AUTH_OPTIMIZER_RENDER_FRAME_RATE:
|
case PRIORITY_AUTH_OPTIMIZER_RENDER_FRAME_RATE:
|
||||||
return "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:
|
default:
|
||||||
return Integer.toString(priority);
|
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.
|
* 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
|
* 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.setDevicePositionLocked(displayLayout.getPosition());
|
||||||
newDisplay.setLeadDisplayLocked(displayLayout.getLeadDisplayId());
|
newDisplay.setLeadDisplayLocked(displayLayout.getLeadDisplayId());
|
||||||
setLayoutLimitedRefreshRate(newDisplay, device, displayLayout);
|
newDisplay.updateLayoutLimitedRefreshRateLocked(
|
||||||
|
device.getDisplayDeviceConfig().getRefreshRange(
|
||||||
|
displayLayout.getRefreshRateZoneId()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
setEnabledLocked(newDisplay, displayLayout.isEnabled());
|
setEnabledLocked(newDisplay, displayLayout.isEnabled());
|
||||||
newDisplay.setBrightnessThrottlingDataIdLocked(
|
newDisplay.setBrightnessThrottlingDataIdLocked(
|
||||||
displayLayout.getBrightnessThrottlingMapId() == null
|
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
|
* Creates a new logical display for the specified device and display Id and adds it to the list
|
||||||
* of logical displays.
|
* of logical displays.
|
||||||
|
|||||||
@@ -166,4 +166,16 @@ public class LogicalDisplayTest {
|
|||||||
assertEquals(Display.REMOVE_MODE_MOVE_CONTENT_TO_PRIMARY,
|
assertEquals(Display.REMOVE_MODE_MOVE_CONTENT_TO_PRIMARY,
|
||||||
mLogicalDisplay.getDisplayInfoLocked().removeMode);
|
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