Attempt to fix [2152536] ANR in browser
The ANR is caused by SurfaceFlinger waiting for buffers of a removed surface to become availlable.
When it is removed from the current list, a Surface is marked as NO_INIT, which causes SF to return
immediately in the above case. For some reason, the surface here wasn't marked as NO_INIT.
This change makes the code more robust by always (irregadless or errors) setting the NO_INIT status
in all code paths where a surface is removed from the list.
Additionaly added more information in the logs, should this happen again.
diff --git a/libs/surfaceflinger/LayerBase.h b/libs/surfaceflinger/LayerBase.h
index 16ee542..0dfa4fe 100644
--- a/libs/surfaceflinger/LayerBase.h
+++ b/libs/surfaceflinger/LayerBase.h
@@ -205,10 +205,13 @@
*/
virtual bool isSecure() const { return false; }
- /** signal this layer that it's not needed any longer. called from the
- * main thread */
+ /** Called from the main thread, when the surface is removed from the
+ * draw list */
virtual status_t ditch() { return NO_ERROR; }
+ /** called with the state lock when the surface is removed from the
+ * current list */
+ virtual void onRemoved() { };
enum { // flags for doTransaction()
@@ -318,7 +321,7 @@
sp<Surface> getSurface();
virtual sp<Surface> createSurface() const;
- virtual void onRemoved() { }
+ virtual void onRemoved();
class Surface : public BnSurface
{