Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c223138 authored by Oleg Petšjonkin's avatar Oleg Petšjonkin Committed by Automerger Merge Worker
Browse files

Merge "properly setting LayoutLimitedRefreshRate for LogicalDisplay" into udc-dev am: 40c76b34

parents d4fb4573 40c76b34
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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);
            }
+13 −0
Original line number Diff line number Diff line
@@ -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
+6 −8
Original line number Diff line number Diff line
@@ -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.
+12 −0
Original line number Diff line number Diff line
@@ -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);
    }
}