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

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

Merge "Call WC#onDisplayChanged in setParent"

parents 78ad51e1 bde15130
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1246,7 +1246,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            // First time we are adding the activity to the system.
            mVoiceInteraction = newTask.voiceSession != null;
            mInputDispatchingTimeoutNanos = getInputDispatchingTimeoutLocked(this) * 1000000L;
            onDisplayChanged(task.getDisplayContent());

            // TODO(b/36505427): Maybe this call should be moved inside
            // updateOverrideConfiguration()
            newTask.updateOverrideConfigurationFromLaunchBounds();
+1 −5
Original line number Diff line number Diff line
@@ -637,7 +637,7 @@ class ActivityStack extends WindowContainer<WindowContainer> implements BoundsAn
    }

    ActivityStack(DisplayContent display, int stackId, ActivityStackSupervisor supervisor,
            int windowingMode, int activityType, boolean onTop) {
            int activityType) {
        super(supervisor.mService.mWindowManager);
        mStackId = stackId;
        mDockedStackMinimizeThickness =
@@ -654,10 +654,6 @@ class ActivityStack extends WindowContainer<WindowContainer> implements BoundsAn
        // stacks on a wrong display.
        mDisplayId = display.mDisplayId;
        setActivityType(activityType);
        display.addStack(this, onTop ? POSITION_TOP : POSITION_BOTTOM);
        setWindowingMode(windowingMode, false /* animate */, false /* showRecents */,
                false /* enteringSplitScreenMode */, false /* deferEnsuringVisibility */,
                true /* creating */);
    }

    /**
+14 −4
Original line number Diff line number Diff line
@@ -1090,7 +1090,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        return token.asActivityRecord();
    }

    private void addWindowToken(IBinder binder, WindowToken token) {
    void addWindowToken(IBinder binder, WindowToken token) {
        final DisplayContent dc = mWmService.mRoot.getWindowTokenDisplay(token);
        if (dc != null) {
            // We currently don't support adding a window token to the display if the display
@@ -1112,6 +1112,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        mTokenMap.put(binder, token);

        if (token.asActivityRecord() == null) {
            // Set displayContent for non-app token to prevent same token will add twice after
            // onDisplayChanged.
            // TODO: Check if it's fine that super.onDisplayChanged of WindowToken
            //  (WindowsContainer#onDisplayChanged) may skipped when token.mDisplayContent assigned.
            token.mDisplayContent = this;
            // Add non-app token to container hierarchy on the display. App tokens are added through
            // the parent container managing them (e.g. Tasks).
            switch (token.windowType) {
@@ -4287,7 +4292,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            // The reparenting case is handled in WindowContainer.
            if (!stack.mReparenting) {
                setLayoutNeeded();
                stack.onDisplayChanged(DisplayContent.this);
            }
        }

@@ -5745,8 +5749,14 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            throw new IllegalArgumentException("Stack with windowing mode cannot with non standard "
                    + "activity type.");
        }
        return new ActivityStack(this, stackId, mRootActivityContainer.mStackSupervisor,
                windowingMode, activityType, onTop);
        final ActivityStack stack = new ActivityStack(this, stackId,
                mRootActivityContainer.mStackSupervisor, activityType);
        addStack(stack, onTop ? POSITION_TOP : POSITION_BOTTOM);
        stack.setWindowingMode(windowingMode, false /* animate */, false /* showRecents */,
                false /* enteringSplitScreenMode */, false /* deferEnsuringVisibility */,
                true /* creating */);

        return stack;
    }

    /**
+4 −0
Original line number Diff line number Diff line
@@ -315,6 +315,10 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
            mParent.onChildAdded(this);
        }
        if (!mReparenting) {
            if (mParent != null && mParent.mDisplayContent != null
                    && mDisplayContent != mParent.mDisplayContent) {
                onDisplayChanged(mParent.mDisplayContent);
            }
            onParentChanged(mParent, oldParent);
        }
    }
+7 −3
Original line number Diff line number Diff line
@@ -797,9 +797,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            mSubLayer = mPolicy.getSubWindowLayerFromTypeLw(a.type);
            mIsChildWindow = true;

            ProtoLog.v(WM_DEBUG_ADD_REMOVE, "Adding %s to %s", this, parentWindow);
            parentWindow.addChild(this, sWindowSubLayerComparator);

            mLayoutAttached = mAttrs.type !=
                    WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
            mIsImWindow = parentWindow.mAttrs.type == TYPE_INPUT_METHOD
@@ -836,6 +833,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mInputWindowHandle = new InputWindowHandle(
                mActivityRecord != null ? mActivityRecord.mInputApplicationHandle : null,
                    getDisplayId());

        // Make sure we initial all fields before adding to parentWindow, to prevent exception
        // during onDisplayChanged.
        if (mIsChildWindow) {
            ProtoLog.v(WM_DEBUG_ADD_REMOVE, "Adding %s to %s", this, parentWindow);
            parentWindow.addChild(this, sWindowSubLayerComparator);
        }
    }

    void attach() {
Loading