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

Commit 704a3c0d authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Make sure wm Stack gets override config on creation

Bug was introduced in ag/2840516 where we started to use
ConfigurationContainerListener to send override configuration changes
from AM containers to WM containers. However, the stack object on the wm
side didn't set its controller in the constructor like the other
container objects so will not have the right information for anything it
tries to do in the ctor or shortly after.
We now pass the controller into the container ctor like we do for the
other container classes.

Change-Id: Iae4166a3511e69f4823e7fb9191774c34cc02700
Fixes: 65738339
Test: run-test CtsWindowManagerDeviceTestCases android.server.wm.CrossAppDragAndDropTests
parent 18d501ac
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -1722,21 +1722,22 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        out.set(mContentRect);
    }

    TaskStack addStackToDisplay(int stackId, boolean onTop) {
    TaskStack addStackToDisplay(int stackId, boolean onTop, StackWindowController controller) {
        if (DEBUG_STACK) Slog.d(TAG_WM, "Create new stackId=" + stackId + " on displayId="
                + mDisplayId);

        TaskStack stack = getStackById(stackId);
        if (stack != null) {
            // It's already attached to the display...clear mDeferRemoval and move stack to
            // appropriate z-order on display as needed.
            // It's already attached to the display...clear mDeferRemoval, set controller, and move
            // stack to appropriate z-order on display as needed.
            stack.mDeferRemoval = false;
            stack.setController(controller);
            // We're not moving the display to front when we're adding stacks, only when
            // requested to change the position of stack explicitly.
            mTaskStackContainers.positionChildAt(onTop ? POSITION_TOP : POSITION_BOTTOM, stack,
                    false /* includingParents */);
        } else {
            stack = new TaskStack(mService, stackId);
            stack = new TaskStack(mService, stackId, controller);
            mTaskStackContainers.addStackToDisplay(stack, onTop);
        }

+1 −4
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ package com.android.server.wm;

import static android.app.ActivityManager.StackId.PINNED_STACK_ID;

import android.app.ActivityManager.StackId;
import android.app.WindowConfiguration;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.os.Handler;
@@ -76,8 +74,7 @@ public class StackWindowController
                        + " to unknown displayId=" + displayId);
            }

            final TaskStack stack = dc.addStackToDisplay(stackId, onTop);
            stack.setController(this);
            dc.addStackToDisplay(stackId, onTop, this);
            getRawBounds(outBounds);
        }
    }
+2 −1
Original line number Diff line number Diff line
@@ -149,9 +149,10 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye

    Rect mPreAnimationBounds = new Rect();

    TaskStack(WindowManagerService service, int stackId) {
    TaskStack(WindowManagerService service, int stackId, StackWindowController controller) {
        mService = service;
        mStackId = stackId;
        setController(controller);
        mDockedStackMinimizeThickness = service.mContext.getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.docked_stack_minimize_thickness);
        EventLog.writeEvent(EventLogTags.WM_STACK_CREATED, stackId);
+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ public class WindowFrameTests extends WindowTestsBase {
        sWm.mSystemDecorLayer = 10000;

        mWindowToken = new WindowTestUtils.TestAppWindowToken(sWm.getDefaultDisplayContentLocked());
        mStubStack = new TaskStack(sWm, 0);
        mStubStack = new TaskStack(sWm, 0, null);
    }

    public void assertRect(Rect rect, int left, int top, int right, int bottom) {
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public class WindowTestUtils {
     */
    public static class TestTaskStack extends TaskStack {
        TestTaskStack(WindowManagerService service, int stackId) {
            super(service, stackId);
            super(service, stackId, null);
        }

        @Override