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

Commit 154b4627 authored by Oleg Blinnikov's avatar Oleg Blinnikov Committed by Android (Google) Code Review
Browse files

Merge "Revert "External display limit on ready to enable"" into main

parents d3f6fd8c 94f34f39
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -5271,13 +5271,5 @@ public final class DisplayManagerService extends SystemService {
        public ExternalDisplayStatsService getExternalDisplayStatsService() {
            return mExternalDisplayStatsService;
        }

        /**
         * Called on external display is ready to be enabled.
         */
        @Override
        public void onExternalDisplayReadyToBeEnabled(int displayId) {
            mDisplayModeDirector.onExternalDisplayReadyToBeEnabled(displayId);
        }
    }
}
+0 −7
Original line number Diff line number Diff line
@@ -91,8 +91,6 @@ class ExternalDisplayPolicy {

        @NonNull
        ExternalDisplayStatsService getExternalDisplayStatsService();

        void onExternalDisplayReadyToBeEnabled(int displayId);
    }

    @NonNull
@@ -187,10 +185,6 @@ class ExternalDisplayPolicy {
            return;
        }

        if (enabled) {
            mInjector.onExternalDisplayReadyToBeEnabled(logicalDisplay.getDisplayIdLocked());
        }

        mLogicalDisplayMapper.setDisplayEnabledLocked(logicalDisplay, enabled);
    }

@@ -223,7 +217,6 @@ class ExternalDisplayPolicy {
        if ((Build.IS_ENG || Build.IS_USERDEBUG)
                && SystemProperties.getBoolean(ENABLE_ON_CONNECT, false)) {
            Slog.w(TAG, "External display is enabled by default, bypassing user consent.");
            mInjector.onExternalDisplayReadyToBeEnabled(logicalDisplay.getDisplayIdLocked());
            mInjector.sendExternalDisplayEventLocked(logicalDisplay, EVENT_DISPLAY_CONNECTED);
            return;
        } else {
+2 −14
Original line number Diff line number Diff line
@@ -699,13 +699,6 @@ public class DisplayModeDirector {
        }
    }

    /**
     * Called when external display is ready to be enabled.
     */
    public void onExternalDisplayReadyToBeEnabled(int displayId) {
        mDisplayObserver.onExternalDisplayReadyToBeEnabled(displayId);
    }

    /**
     * Provides access to DisplayDeviceConfig for specific display
     */
@@ -1372,13 +1365,6 @@ public class DisplayModeDirector {
            }
        }


        void onExternalDisplayReadyToBeEnabled(int displayId) {
            DisplayInfo displayInfo = getDisplayInfo(displayId);
            updateDisplaysPeakRefreshRateAndResolution(displayInfo);
            addDisplaysSynchronizedPeakRefreshRate(displayInfo);
        }

        @Override
        public void onDisplayAdded(int displayId) {
            updateDisplayDeviceConfig(displayId);
@@ -1386,6 +1372,8 @@ public class DisplayModeDirector {
            updateDisplayModes(displayId, displayInfo);
            updateLayoutLimitedFrameRate(displayId, displayInfo);
            updateUserSettingDisplayPreferredSize(displayInfo);
            updateDisplaysPeakRefreshRateAndResolution(displayInfo);
            addDisplaysSynchronizedPeakRefreshRate(displayInfo);
        }

        @Override
+0 −4
Original line number Diff line number Diff line
@@ -157,7 +157,6 @@ public class ExternalDisplayPolicyTest {
        verify(mMockedLogicalDisplayMapper, never()).setDisplayEnabledLocked(any(), anyBoolean());
        verify(mMockedDisplayNotificationManager, times(2))
                .onHighTemperatureExternalDisplayNotAllowed();
        verify(mMockedInjector, never()).onExternalDisplayReadyToBeEnabled(anyInt());
    }

    @Test
@@ -168,7 +167,6 @@ public class ExternalDisplayPolicyTest {
        verify(mMockedLogicalDisplayMapper, never()).setDisplayEnabledLocked(any(), anyBoolean());
        verify(mMockedDisplayNotificationManager, never())
                .onHighTemperatureExternalDisplayNotAllowed();
        verify(mMockedInjector, never()).onExternalDisplayReadyToBeEnabled(anyInt());
    }

    @Test
@@ -186,7 +184,6 @@ public class ExternalDisplayPolicyTest {
        // Expected only 1 invocation, upon critical temperature.
        verify(mMockedDisplayNotificationManager).onHighTemperatureExternalDisplayNotAllowed();
        verify(mMockedExternalDisplayStatsService).onDisplayDisabled(eq(EXTERNAL_DISPLAY_ID));
        verify(mMockedInjector, never()).onExternalDisplayReadyToBeEnabled(anyInt());
    }

    @Test
@@ -194,7 +191,6 @@ public class ExternalDisplayPolicyTest {
        mExternalDisplayPolicy.setExternalDisplayEnabledLocked(mMockedLogicalDisplay,
                /*enabled=*/ true);
        assertDisplaySetEnabled(/*enabled=*/ true);
        verify(mMockedInjector).onExternalDisplayReadyToBeEnabled(eq(EXTERNAL_DISPLAY_ID));
    }

    @Test
+1 −1
Original line number Diff line number Diff line
@@ -1952,7 +1952,7 @@ public class DisplayModeDirectorTest {
        SparseArray<SparseArray<Vote>> votesByDisplay = new SparseArray<>();
        votesByDisplay.put(DISPLAY_ID_2, votes);

        director.getDisplayObserver().onExternalDisplayReadyToBeEnabled(DISPLAY_ID_2);
        director.getDisplayObserver().onDisplayAdded(DISPLAY_ID_2);
        director.injectVotesByDisplay(votesByDisplay);

        var desiredSpecs = director.getDesiredDisplayModeSpecs(DISPLAY_ID_2);
Loading