Fixes for parentless layers
1. When a layer is removed, it needs to latch a buffer before the buffer
can be released.
2. If a layer is removed from current state, it needs to get re-added
back to current state when it gets reparented to a layer that is not
removed from current state
3. If a layer is added as a child to a layer that has been removed from
current state, the layer adding needs to succeed, but the layer needs to
be automatically set as removed from current state.
Bug: 111297488
Test: Test with updated ActivityView that has a SurfaceControl that has
no reference in SF tree
Change-Id: I8b723666964c61aaf7119b60ac256d19f85732b0
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index ade62bf..d314942 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -68,7 +68,7 @@
ALOGE("Found stale hardware composer layers when destroying "
"surface flinger layer %s",
mName.string());
- destroyAllHwcLayers();
+ destroyAllHwcLayersPlusChildren();
}
mTimeStats.onDestroy(getSequence());