Loading core/java/android/view/DisplayInfo.java +3 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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; } Loading core/tests/coretests/src/android/view/DisplayInfoTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -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( Loading services/tests/displayservicetests/src/com/android/server/display/DisplayManagerServiceTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -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); } Loading Loading
core/java/android/view/DisplayInfo.java +3 −1 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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; } Loading
core/tests/coretests/src/android/view/DisplayInfoTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -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( Loading
services/tests/displayservicetests/src/com/android/server/display/DisplayManagerServiceTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -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); } Loading