Maintain Z order for all layers in offscreen hierarchy

There was already code in place to ensure that z order was maintained in
the offscreen tree. However, this didn't work if a layer was moved to become
a child of an offscreen layer. The z order was only maintained beneath
the new offscreen layer, not the entire subtree.

This change uses the root of the offscreen subtree to ensure the z order
is maintained even when new offscreen layers are added to the subtree.

Fixes: 157188227
Test: IME gets correct relative z
Test: RelativeZTest.LayerWithRelativeReparentedToOffscreen
Change-Id: I62553ce245dacd2a8684d8bb02de67f60ddc6774
3 files changed