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

Commit 91059cdf authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge "Fix issue with where display is removed while creating it in AM and WM" into pi-dev

parents d740e43b 45477b57
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -106,21 +106,21 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack>

    private DisplayWindowController mWindowContainerController;

    @VisibleForTesting
    ActivityDisplay(ActivityStackSupervisor supervisor, int displayId) {
        mSupervisor = supervisor;
        mDisplayId = displayId;
        final Display display = supervisor.mDisplayManager.getDisplay(displayId);
        if (display == null) {
            throw new IllegalStateException("Display does not exist displayId=" + displayId);
        this(supervisor, supervisor.mDisplayManager.getDisplay(displayId));
    }

    ActivityDisplay(ActivityStackSupervisor supervisor, Display display) {
        mSupervisor = supervisor;
        mDisplayId = display.getDisplayId();
        mDisplay = display;
        mWindowContainerController = createWindowContainerController();

        updateBounds();
    }

    protected DisplayWindowController createWindowContainerController() {
        return new DisplayWindowController(mDisplayId, this);
        return new DisplayWindowController(mDisplay, this);
    }

    void updateBounds() {
+4 −4
Original line number Diff line number Diff line
@@ -652,9 +652,9 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D

            Display[] displays = mDisplayManager.getDisplays();
            for (int displayNdx = displays.length - 1; displayNdx >= 0; --displayNdx) {
                final int displayId = displays[displayNdx].getDisplayId();
                ActivityDisplay activityDisplay = new ActivityDisplay(this, displayId);
                mActivityDisplays.put(displayId, activityDisplay);
                final Display display = displays[displayNdx];
                ActivityDisplay activityDisplay = new ActivityDisplay(this, display);
                mActivityDisplays.put(display.getDisplayId(), activityDisplay);
                calculateDefaultMinimalSizeOfResizeableTasks(activityDisplay);
            }

@@ -4085,7 +4085,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
            return null;
        }
        // The display hasn't been added to ActivityManager yet, create a new record now.
        activityDisplay = new ActivityDisplay(this, displayId);
        activityDisplay = new ActivityDisplay(this, display);
        attachDisplay(activityDisplay);
        calculateDefaultMinimalSizeOfResizeableTasks(activityDisplay);
        mWindowManager.onDisplayAdded(displayId);
+9 −13
Original line number Diff line number Diff line
@@ -34,25 +34,21 @@ public class DisplayWindowController

    private final int mDisplayId;

    public DisplayWindowController(int displayId, WindowContainerListener listener) {
    public DisplayWindowController(Display display, WindowContainerListener listener) {
        super(listener, WindowManagerService.getInstance());
        mDisplayId = displayId;
        mDisplayId = display.getDisplayId();

        synchronized (mWindowMap) {
            final Display display = mService.mDisplayManager.getDisplay(displayId);
            if (display != null) {
            final long callingIdentity = Binder.clearCallingIdentity();
            try {
                mRoot.createDisplayContent(display, this /* controller */);
            } finally {
                Binder.restoreCallingIdentity(callingIdentity);
            }
            }

            if (mContainer == null) {
                throw new IllegalArgumentException("Trying to add displayId=" + displayId
                        + " display=" + display
                        + " dc=" + mRoot.getDisplayContent(displayId));
                throw new IllegalArgumentException("Trying to add display=" + display
                        + " dc=" + mRoot.getDisplayContent(mDisplayId));
            }
        }
    }