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

Commit ac7c725b authored by Ady Abraham's avatar Ady Abraham Committed by Android (Google) Code Review
Browse files

Merge "DisplayInfo: don't check renderFrameRate for equal()" into main

parents 469ee1bd a5fe6975
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -447,7 +447,6 @@ public final class DisplayInfo implements Parcelable {
                && Objects.equals(displayCutout, other.displayCutout)
                && rotation == other.rotation
                && modeId == other.modeId
                && renderFrameRate == other.renderFrameRate
                && hasArrSupport == other.hasArrSupport
                && Objects.equals(frameRateCategoryRate, other.frameRateCategoryRate)
                && defaultModeId == other.defaultModeId
@@ -705,6 +704,9 @@ public final class DisplayInfo implements Parcelable {
        if (refreshRateOverride > 0) {
            return refreshRateOverride;
        }
        if (renderFrameRate > 0) {
            return renderFrameRate;
        }
        if (supportedModes.length == 0) {
            return 0;
        }
+17 −0
Original line number Diff line number Diff line
@@ -77,6 +77,23 @@ public class DisplayInfoTest {
        assertTrue(displayInfo1.equals(displayInfo2));
    }

    @Test
    public void testRefreshRateOverride_keepsDisplyInfosEqualWhenOverrideIsSame() {
        Display.Mode mode = new Display.Mode(
                /*modeId=*/1, /*width=*/1000, /*height=*/1000, /*refreshRate=*/120);
        DisplayInfo displayInfo1 = new DisplayInfo();
        setSupportedMode(displayInfo1, mode);
        displayInfo1.renderFrameRate = 60;
        displayInfo1.refreshRateOverride = 30;

        DisplayInfo displayInfo2 = new DisplayInfo();
        setSupportedMode(displayInfo2, mode);
        displayInfo2.renderFrameRate = 30;
        displayInfo2.refreshRateOverride = 30;

        assertTrue(displayInfo1.equals(displayInfo2));
    }

    @Test
    public void testRefreshRateOverride_makeDisplayInfosDifferent() {
        Display.Mode mode = new Display.Mode(
+4 −0
Original line number Diff line number Diff line
@@ -3850,6 +3850,10 @@ public class DisplayManagerServiceTest {
        DisplayDeviceInfo displayDeviceInfo = new DisplayDeviceInfo();
        displayDeviceInfo.copyFrom(displayDevice.getDisplayDeviceInfoLocked());
        displayDeviceInfo.modeId = modeId;
        if (modeId > 0 && modeId <= displayDeviceInfo.supportedModes.length) {
            displayDeviceInfo.renderFrameRate =
                displayDeviceInfo.supportedModes[modeId - 1].getRefreshRate();
        }
        updateDisplayDeviceInfo(displayManager, displayDevice, displayDeviceInfo);
    }