Fix stack reference is not updated if the task is organized

There is an additional stack level for split-screen mode, the child
of the organizer may be the instance referenced by task display area.
So if the child is removed, the stack reference should also be updated.

The corresponding operations of removeChild should be put in the
redirected implementation method, otherwise it will be missed when
propagating the removal to parent, that may cause reusing a detached
task and then crash because it does not have parent and display.

Bug: 154679904
Test: ActivityStackTests#testRemoveOrganizedTask_UpdateStackReference
Change-Id: I9c4032409345c772baa055e32da9eaba9a274b53
2 files changed