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

Commit 9d808b1f authored by Craig Mautner's avatar Craig Mautner
Browse files

Add home StackBox to all DisplayContent.

Each display needs a stack and a stack box to contain windows.

Fixes bug 10161525.

Change-Id: Ic617cdf5a082ae68f0589e826ecbb37d8fba52ac
parent 57e76b40
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -48,9 +48,10 @@ public class DimLayer {
    /** Time in milliseconds to take to transition from mStartAlpha to mTargetAlpha */
    long mDuration;

    DimLayer(WindowManagerService service, int displayId) {
    DimLayer(WindowManagerService service, DisplayContent displayContent) {
        mDisplayContent = displayContent;
        final int displayId = displayContent.getDisplayId();
        if (DEBUG) Slog.v(TAG, "Ctor: displayId=" + displayId);
        mDisplayContent = service.getDisplayContentLocked(displayId);
        SurfaceControl.openTransaction();
        try {
            if (WindowManagerService.DEBUG_SURFACE_TRACE) {
+19 −15
Original line number Diff line number Diff line
@@ -111,14 +111,25 @@ class DisplayContent {
    /** Save allocating when calculating rects */
    Rect mTmpRect = new Rect();

    final WindowManagerService mService;

    /**
     * @param display May not be null.
     * @param service TODO(cmautner):
     */
    DisplayContent(Display display) {
    DisplayContent(Display display, WindowManagerService service) {
        mDisplay = display;
        mDisplayId = display.getDisplayId();
        display.getDisplayInfo(mDisplayInfo);
        isDefaultDisplay = mDisplayId == Display.DEFAULT_DISPLAY;
        mService = service;

        StackBox newBox = new StackBox(service, this, null);
        mStackBoxes.add(newBox);
        TaskStack newStack = new TaskStack(service, HOME_STACK_ID, this);
        newStack.mStackBox = newBox;
        newBox.mStack = newStack;
        mHomeStack = newStack;
    }

    int getDisplayId() {
@@ -201,22 +212,15 @@ class DisplayContent {
    }

    /** Refer to {@link WindowManagerService#createStack(int, int, int, float)} */
    TaskStack createStack(WindowManagerService service, int stackId, int relativeStackBoxId,
            int position, float weight) {
    TaskStack createStack(int stackId, int relativeStackBoxId, int position, float weight) {
        TaskStack newStack = null;
        if (DEBUG_STACK) Slog.d(TAG, "createStack: stackId=" + stackId + " relativeStackBoxId="
                + relativeStackBoxId + " position=" + position + " weight=" + weight);
        if (mStackBoxes.isEmpty()) {
            if (stackId != HOME_STACK_ID) {
                throw new IllegalArgumentException("createStack: First stackId not "
                        + HOME_STACK_ID);
        if (stackId == HOME_STACK_ID) {
            if (mStackBoxes.size() != 1) {
                throw new IllegalArgumentException("createStack: HOME_STACK_ID (0) not first.");
            }
            StackBox newBox = new StackBox(service, this, null);
            mStackBoxes.add(newBox);
            newStack = new TaskStack(service, stackId, this);
            newStack.mStackBox = newBox;
            newBox.mStack = newStack;
            mHomeStack = newStack;
            newStack = mHomeStack;
        } else {
            int stackBoxNdx;
            for (stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
@@ -225,8 +229,8 @@ class DisplayContent {
                        || position == StackBox.TASK_STACK_GOES_UNDER) {
                    // Position indicates a new box is added at top level only.
                    if (box.contains(relativeStackBoxId)) {
                        StackBox newBox = new StackBox(service, this, null);
                        newStack = new TaskStack(service, stackId, this);
                        StackBox newBox = new StackBox(mService, this, null);
                        newStack = new TaskStack(mService, stackId, this);
                        newStack.mStackBox = newBox;
                        newBox.mStack = newStack;
                        final int offset = position == StackBox.TASK_STACK_GOES_OVER ? 1 : 0;
+2 −2
Original line number Diff line number Diff line
@@ -71,8 +71,8 @@ public class TaskStack {
        mStackId = stackId;
        mDisplayContent = displayContent;
        final int displayId = displayContent.getDisplayId();
        mDimLayer = new DimLayer(service, displayId);
        mAnimationBackgroundSurface = new DimLayer(service, displayId);
        mDimLayer = new DimLayer(service, displayContent);
        mAnimationBackgroundSurface = new DimLayer(service, displayContent);
    }

    DisplayContent getDisplayContent() {
+3 −3
Original line number Diff line number Diff line
@@ -4832,8 +4832,8 @@ public class WindowManagerService extends IWindowManager.Stub
            final int numDisplays = mDisplayContents.size();
            for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
                final DisplayContent displayContent = mDisplayContents.valueAt(displayNdx);
                TaskStack stack = displayContent.createStack(this, stackId, relativeStackBoxId,
                        position, weight);
                TaskStack stack = displayContent.createStack(stackId, relativeStackBoxId, position,
                        weight);
                if (stack != null) {
                    mStackIdToStack.put(stackId, stack);
                    displayContent.moveStack(stack, true);
@@ -10716,7 +10716,7 @@ public class WindowManagerService extends IWindowManager.Stub
    }

    private DisplayContent newDisplayContentLocked(final Display display) {
        DisplayContent displayContent = new DisplayContent(display);
        DisplayContent displayContent = new DisplayContent(display, this);
        final int displayId = display.getDisplayId();
        mDisplayContents.put(displayId, displayContent);
        final Rect rect = new Rect();