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

Commit 6025770e authored by Craig Mautner's avatar Craig Mautner
Browse files

Don't remove active stacks from window manager

Background:

In ag/406771 we stopped deleting empty stacks in activity manager
and window manager. This fixed a problem where dormant tasks were
being added back to stacks later.

In ag/476888 we introduced a callback to inform the ActivityView
holder that the embedded task was complete. This callback was made
from the new method ActivityContainer.onTaskListEmpty().

In ag/483035 onTaskListEmpty() was expanded to detach the stack of the
ActivityView and also removed the stack from window manager. There
was a mistake in that CL that causes it to remove any non-home stacks,
not just ones in ActivityViews.

That mistake left us with an empty stack in activity manager and no
corresponding stack in window manager. As a result, when trying to
bring back a task that used to be in this stack window manager threw
up an exception.

This fix limits the stacks detached by onTaskListEmpty() to those
on VirtualDisplays.

Fixes bug 17469145.

Change-Id: I85a4452e8e85625e657d88e4cb9f366fd4026441
parent 36e793c7
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -3673,7 +3673,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
            }
        }

        private void detachLocked() {
        protected void detachLocked() {
            if (DEBUG_STACK) Slog.d(TAG, "detachLocked: " + this + " from display="
                    + mActivityDisplay + " Callers=" + Debug.getCallers(2));
            if (mActivityDisplay != null) {
@@ -3797,12 +3797,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
        }

        void onTaskListEmptyLocked() {
            mHandler.removeMessages(CONTAINER_TASK_LIST_EMPTY_TIMEOUT, this);
            if (!mStack.isHomeStack()) {
                detachLocked();
                deleteActivityContainer(this);
            }
            mHandler.obtainMessage(CONTAINER_CALLBACK_TASK_LIST_EMPTY, this).sendToTarget();
        }

        @Override
@@ -3891,6 +3885,13 @@ public final class ActivityStackSupervisor implements DisplayListener {
            return false;
        }

        void onTaskListEmptyLocked() {
            mHandler.removeMessages(CONTAINER_TASK_LIST_EMPTY_TIMEOUT, this);
            detachLocked();
            deleteActivityContainer(this);
            mHandler.obtainMessage(CONTAINER_CALLBACK_TASK_LIST_EMPTY, this).sendToTarget();
        }

        private void setSurfaceIfReadyLocked() {
            if (DEBUG_STACK) Slog.v(TAG, "setSurfaceIfReadyLocked: mDrawn=" + mDrawn +
                    " mContainerState=" + mContainerState + " mSurface=" + mSurface);