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

Commit e9bdfc49 authored by Ady Abraham's avatar Ady Abraham
Browse files

DM: DisplayInfo#supportedRefreshRates is a LOGICAL_DISPLAY_EVENT_REFRESH_RATE_CHANGED

Classify supportedRefreshRates as LOGICAL_DISPLAY_EVENT_REFRESH_RATE_CHANGED as it
changes toghether with the refresh rate.

Test: presubmit
Bug: 431061528
Bug: 443503625
Flag: EXEMPT BUGFIX
Change-Id: Ic6efbdbc438a7329d9539da8f81dbf5304e652b2
parent 7004b4dd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -476,6 +476,7 @@ public final class DisplayInfo implements Parcelable {
                    && appVsyncOffsetNanos == other.appVsyncOffsetNanos
                    && presentationDeadlineNanos == other.presentationDeadlineNanos
                    && (modeId == other.modeId)
                    && Arrays.equals(supportedRefreshRates, other.supportedRefreshRates)
                    && (committedState == other.committedState);
        }
        return isEqualWithOnlyBasicChanges;
@@ -1077,7 +1078,6 @@ public final class DisplayInfo implements Parcelable {
        return !isDisplayModeSizeEqual(other)
                || hasArrSupport != other.hasArrSupport
                || !Objects.equals(frameRateCategoryRate, other.frameRateCategoryRate)
                || !Arrays.equals(supportedRefreshRates, other.supportedRefreshRates)
                || !Objects.equals(layoutLimitedRefreshRate, other.layoutLimitedRefreshRate)
                || !thermalRefreshRateThrottling.contentEquals(other.thermalRefreshRateThrottling)
                || userPreferredModeId != other.userPreferredModeId
+12 −9
Original line number Diff line number Diff line
@@ -883,11 +883,8 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
                            | LOGICAL_DISPLAY_EVENT_STATE_CHANGED;
                }
            } else if (hasBasicInfoChanged
                    || mTempDisplayInfo.getRefreshRate() != newDisplayInfo.getRefreshRate()
                    || mTempDisplayInfo.appVsyncOffsetNanos != newDisplayInfo.appVsyncOffsetNanos
                    || mTempDisplayInfo.committedState != newDisplayInfo.committedState
                    || mTempDisplayInfo.presentationDeadlineNanos
                    != newDisplayInfo.presentationDeadlineNanos) {
                    || hasRefreshRateChanges(newDisplayInfo)
                    || mTempDisplayInfo.committedState != newDisplayInfo.committedState) {
                // If only the hdr/sdr ratio changed, then send just the event for that case
                if ((diff == DisplayDeviceInfo.DIFF_HDR_SDR_RATIO)) {
                    logicalDisplayEventMask |= LOGICAL_DISPLAY_EVENT_HDR_SDR_RATIO_CHANGED;
@@ -977,13 +974,19 @@ class LogicalDisplayMapper implements DisplayDeviceRepository.Listener {
        }
    }

    private boolean hasRefreshRateChanges(DisplayInfo newDisplayInfo) {
        return mTempDisplayInfo.getRefreshRate() != newDisplayInfo.getRefreshRate()
                || mTempDisplayInfo.appVsyncOffsetNanos != newDisplayInfo.appVsyncOffsetNanos
                || mTempDisplayInfo.presentationDeadlineNanos
                != newDisplayInfo.presentationDeadlineNanos
                || !Arrays.equals(mTempDisplayInfo.supportedRefreshRates,
                newDisplayInfo.supportedRefreshRates);
    }

    @VisibleForTesting
    int updateAndGetMaskForDisplayPropertyChanges(DisplayInfo newDisplayInfo) {
        int mask = LOGICAL_DISPLAY_EVENT_BASE;
        if (mTempDisplayInfo.getRefreshRate() != newDisplayInfo.getRefreshRate()
                || mTempDisplayInfo.appVsyncOffsetNanos != newDisplayInfo.appVsyncOffsetNanos
                || mTempDisplayInfo.presentationDeadlineNanos
                != newDisplayInfo.presentationDeadlineNanos) {
        if (hasRefreshRateChanges(newDisplayInfo)) {
            mask |= LOGICAL_DISPLAY_EVENT_REFRESH_RATE_CHANGED;
        }

+15 −0
Original line number Diff line number Diff line
@@ -1528,6 +1528,21 @@ public class LogicalDisplayMapperTest {
        assertEquals(LOGICAL_DISPLAY_EVENT_REFRESH_RATE_CHANGED,
                mLogicalDisplayMapper.updateAndGetMaskForDisplayPropertyChanges(newDisplayInfo));

        newDisplayInfo = new DisplayInfo();
        newDisplayInfo.appVsyncOffsetNanos = 123;
        assertEquals(LOGICAL_DISPLAY_EVENT_REFRESH_RATE_CHANGED,
                mLogicalDisplayMapper.updateAndGetMaskForDisplayPropertyChanges(newDisplayInfo));

        newDisplayInfo = new DisplayInfo();
        newDisplayInfo.presentationDeadlineNanos = 456;
        assertEquals(LOGICAL_DISPLAY_EVENT_REFRESH_RATE_CHANGED,
                mLogicalDisplayMapper.updateAndGetMaskForDisplayPropertyChanges(newDisplayInfo));

        newDisplayInfo = new DisplayInfo();
        newDisplayInfo.supportedRefreshRates = new float[60];
        assertEquals(LOGICAL_DISPLAY_EVENT_REFRESH_RATE_CHANGED,
                mLogicalDisplayMapper.updateAndGetMaskForDisplayPropertyChanges(newDisplayInfo));

        // Change the display state
        when(mFlagsMock.isDisplayListenerPerformanceImprovementsEnabled()).thenReturn(true);
        newDisplayInfo = new DisplayInfo();