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

Commit b6cdd3b4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Create display if necessary when adding windows."

parents f9bd606f 1cddfdc1
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -204,9 +204,20 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
    }

    DisplayContent createDisplayContent(final Display display, DisplayWindowController controller) {
        final int displayId = display.getDisplayId();

        // In select scenarios, it is possible that a DisplayContent will be created on demand
        // rather than waiting for the controller. In this case, associate the controller and return
        // the existing display.
        final DisplayContent existing = getDisplayContent(displayId);

        if (existing != null) {
            existing.setController(controller);
            return existing;
        }

        final DisplayContent dc =
                new DisplayContent(display, mService, mWallpaperController, controller);
        final int displayId = display.getDisplayId();

        if (DEBUG_DISPLAY) Slog.v(TAG_WM, "Adding display=" + display);

+12 −1
Original line number Diff line number Diff line
@@ -1131,7 +1131,18 @@ public class WindowManagerService extends IWindowManager.Stub
                throw new IllegalStateException("Display has not been initialialized");
            }

            final DisplayContent displayContent = mRoot.getDisplayContent(displayId);
            DisplayContent displayContent = mRoot.getDisplayContent(displayId);

            // Adding a window is an exception where the WindowManagerService can create the
            // display instead of waiting for the ActivityManagerService to drive creation.
            if (displayContent == null) {
                final Display display = mDisplayManager.getDisplay(displayId);

                if (display != null) {
                    displayContent = mRoot.createDisplayContent(display, null /* controller */);
                }
            }

            if (displayContent == null) {
                Slog.w(TAG_WM, "Attempted to add window to a display that does not exist: "
                        + displayId + ".  Aborting.");