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
1 file changed