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

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

Merge "Prevent disabling the default display." into main

parents ee75008a 728c4837
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3945,6 +3945,10 @@ public final class DisplayManagerService extends SystemService {
    }

    void enableConnectedDisplay(int displayId, boolean enabled) {
        if (!enabled && displayId == Display.DEFAULT_DISPLAY) {
            Slog.w(TAG, "enableConnectedDisplay: Cannot disable default display");
            return;
        }
        synchronized (mSyncRoot) {
            final var logicalDisplay = mLogicalDisplayMapper.getDisplayLocked(displayId);
            if (logicalDisplay == null) {
+4 −0
Original line number Diff line number Diff line
@@ -786,6 +786,10 @@ class DisplayManagerShellCommand extends ShellCommand {
            getErrPrintWriter().println("Error: invalid displayId: '" + displayIdText + "'");
            return 1;
        }
        if (!enable && displayId == Display.DEFAULT_DISPLAY) {
            getErrPrintWriter().println("Error: cannot disable default display");
            return 1;
        }
        mService.enableConnectedDisplay(displayId, enable);
        return 0;
    }