Do not drop MonitoredProducer in binder calls
Currently the MonitoredProducer is left out when the producer is
marshalled for binder calls. If others than the owning layer have
references to the underlying surface, clearing the layer leads to the
surface being removed from the SF tracking list. This is in clear
contradiction with the test case
libgui_test.SurfaceTest#QueuesToWindowComposerIsTrueWhenPurgatorized.
Unfortunately the test case has not accounted for the async nature of
the operation and has been only intermittently failing for a long
while. Change also changes the test to wait for the clear operation to
complete.
Test: libgui_test, AUPT on Pixel XL
Bug: 31045556
Change-Id: Iddb1cef82c492e8b3beeb32de7e11587e0c1ebed
diff --git a/services/surfaceflinger/MonitoredProducer.cpp b/services/surfaceflinger/MonitoredProducer.cpp
index 359ca4e..8bf6e82 100644
--- a/services/surfaceflinger/MonitoredProducer.cpp
+++ b/services/surfaceflinger/MonitoredProducer.cpp
@@ -49,7 +49,7 @@
wp<IBinder> mProducer;
};
- mFlinger->postMessageAsync(new MessageCleanUpList(mFlinger, asBinder(this)));
+ mFlinger->postMessageAsync(new MessageCleanUpList(mFlinger, asBinder(mProducer)));
}
status_t MonitoredProducer::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
@@ -156,7 +156,7 @@
}
IBinder* MonitoredProducer::onAsBinder() {
- return IInterface::asBinder(mProducer).get();
+ return this;
}
// ---------------------------------------------------------------------------