Reparent child surfaces when swapping out new surfaces

When we need to create a new surface and swap out the old surface, we need to
preserve the old surface and wait for the new surface to be drawn by the client. The
old surface's z order is boosted so any new surface is drawn below the preserved
surface. Once the new surface is drawn, the preserved surface is hidden, new surface
is shown and the child surfaces of the preserved surface is reparented to the new
surface, all in one transaction.

If we have to create another surface before the swap has happened, we keep the
preserved surface and destroy the new but not shown surface. In this scenario,
this fix ensures we reparent any children back to the preserved surface.

Bug: 138380754
Test: Open SurfaceView app in split screen tap divider
Test: go/wm-smoke
Change-Id: Ibc1e82acdfd76f369af201ac0a7f6f0129a681a3
1 file changed