Preserve relative z layer info when moving layers offscreen

When a layer is removed from screen, by reparenting it to null, we need to
remove its relative z info as well. Otherwise, if the layer has a visible
relative parent, it will continue to be drawn.

However, there are some scenarios where it maybe useful to preserve relative z.
When a layer is temporarily moved offscreen, and the layer has children with
relative z ordered to other children, then the client logic can be made simpler
by preserving the relative z info for all the children and only removing relative
z info if its relative parent is not on the pending removal state.

Bug: 132613412

Test: atest SurfaceFlinger_test
Test: go/wm-smoke
Change-Id: Id9e2d164673c9028fb27a38ab2b3005269ad4932
4 files changed