Ensure currentState is copied to drawingState for offscreen layers

When a layer is re-parented to null, it becomes offscreen. This means it
can't be reached when traversing layers. The layer can still be around
in memory and modified since the client can still access it. If the
layer makes changes to other layers it references (children or relative),
that info will never get copied from currentState to drawingState. This
could possibly cause leaks since the offscreen layer will continue to hold
a reference to another layer even if the layer requested to be re-parented.

This change stores a raw reference to the offscreen layers so their
states can get copied from current to drawing, ensuring that any
references are updated properly.

Test: Steps from bug does not create buffer leak
Test: go/wm-smoke no buffer leak
Fixes: 131265073
Fixes: 126185092
Change-Id: I3b32350cfdb7e7cbd75eab107d986877c6d6f6ba
3 files changed