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

Commit 6a35cc9d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Check that modespecs are not null" into main

parents 34649b10 782c49d7
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -168,6 +168,12 @@ final class LocalDisplayAdapter extends DisplayAdapter {
            }
            SurfaceControl.DesiredDisplayModeSpecs modeSpecs =
                    mSurfaceControlProxy.getDesiredDisplayModeSpecs(displayToken);
            if (modeSpecs == null) {
                // If mode specs is null, it most probably means that display got
                // unplugged very rapidly.
                Slog.w(TAG, "Desired display mode specs from SurfaceFlinger are null");
                return;
            }
            LocalDisplayDevice device = mDevices.get(physicalDisplayId);
            if (device == null) {
                // Display was added.
+14 −0
Original line number Diff line number Diff line
@@ -1141,6 +1141,20 @@ public class LocalDisplayAdapterTest {
        assertThat(info.roundedCorners).isNull();
    }

    @Test
    public void test_createLocalExternalDisplay_displayManagementEnabled_doesNotCrash()
            throws Exception {
        FakeDisplay display = new FakeDisplay(PORT_A);
        display.info.isInternal = false;
        setUpDisplay(display);
        updateAvailableDisplays();
        mAdapter.registerLocked();
        when(mSurfaceControlProxy.getDesiredDisplayModeSpecs(display.token)).thenReturn(null);
        mInjector.getTransmitter().sendHotplug(display, /* connected */ true);
        waitForHandlerToComplete(mHandler, HANDLER_WAIT_MS);
        assertThat(mListener.addedDisplays.size()).isEqualTo(1);
    }

    @Test
    public void test_createLocalExternalDisplay_displayManagementEnabled_shouldHaveDefaultGroup()
            throws Exception {