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

Commit 0fd7cebc authored by Sasha McIntosh's avatar Sasha McIntosh
Browse files

Ensure "matching" modes consider HDR types

Supported HDR types can differ betwen modes. Ensure that when comparing
modes for equality, supported HDR types is also checked.

Bug: 424150248
Test: atest DisplayServiceTests
Flag: com.android.graphics.surfaceflinger.flags.connected_display_hdr_v2
Change-Id: I0bb43f2249be2508318185d8a1cfb92d24b9156b
parent bab478ae
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2652,7 +2652,8 @@ public final class Display {
         * @hide
         */
        public boolean equalsExceptRefreshRate(@Nullable Display.Mode other) {
            return mWidth == other.mWidth && mHeight == other.mHeight;
            return mWidth == other.mWidth && mHeight == other.mHeight
                    && mSupportedHdrTypes == other.mSupportedHdrTypes;
        }

        /**
+4 −3
Original line number Diff line number Diff line
@@ -1549,7 +1549,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
        }
    }

    private boolean hdrTypesEqual(int[] modeHdrTypes, int[] recordHdrTypes) {
    private static boolean hdrTypesEqual(int[] modeHdrTypes, int[] recordHdrTypes) {
        int[] modeHdrTypesCopy = Arrays.copyOf(modeHdrTypes, modeHdrTypes.length);
        Arrays.sort(modeHdrTypesCopy);
        // Record HDR types are already sorted when we create the DisplayModeRecord
@@ -1589,7 +1589,8 @@ final class LocalDisplayAdapter extends DisplayAdapter {
                    && Float.floatToIntBits(mMode.getRefreshRate())
                    == Float.floatToIntBits(mode.peakRefreshRate)
                    && Float.floatToIntBits(mMode.getVsyncRate())
                            == Float.floatToIntBits(mode.vsyncRate);
                    == Float.floatToIntBits(mode.vsyncRate)
                    && hdrTypesEqual(mode.supportedHdrTypes, mMode.getSupportedHdrTypes());
        }

        public String toString() {
+2 −2
Original line number Diff line number Diff line
@@ -4699,7 +4699,7 @@ public class DisplayManagerServiceTest {
        if (compatChangeEnabled) {
            expectedMode = new Display.Mode(1, 100, 200, 60f);
        } else {
            expectedMode = new Display.Mode(3, 100, 200, 20f);
            expectedMode = new Display.Mode(255, 100, 200, 20f);
        }
        assertEquals(expectedMode, displayInfo.getMode());
    }
@@ -4726,7 +4726,7 @@ public class DisplayManagerServiceTest {
        if (compatChangeEnabled) {
            expectedMode = new Display.Mode(1, 100, 200, 60f);
        } else {
            expectedMode = new Display.Mode(3, 100, 200, 20f);
            expectedMode = new Display.Mode(255, 100, 200, 20f);
        }
        assertEquals(expectedMode, displayInfo.getMode());
    }