blast: ordering layer death and callbacks
There is an edge case where Transaction callbacks don't contain
all the SurfaceControls that the Transaction had. This happens if:
1) A transaction is applied in the app process
2) A surface control is released/destroyed in the app process
3) The surface control is destroyed in surfaceflinger
4) The transaction is applied in surfaceflinger
If the layer associated with the surface control is removed from
surfaceflinger, the surface control won't be added to the callback.
We need to add the surface control as unpresented to the callback
once we realize the layer no longer exists.
Bug: 135766997
Test: Transaction_test
Change-Id: Ia7d7f15ead736c8a17343ceec84c8515a7000bbe
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index a96305e..f92df61 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3931,6 +3931,11 @@
sp<Layer> layer(client->getLayerUser(s.surface));
if (layer == nullptr) {
+ for (auto& listenerCallback : listenerCallbacks) {
+ mTransactionCompletedThread.addUnpresentedCallbackHandle(
+ new CallbackHandle(listenerCallback.transactionCompletedListener,
+ listenerCallback.callbackIds, s.surface));
+ }
return 0;
}