SF: Make screenshot surface async
It will only ever have one frame pushed to it and this guarantees that
the late-latching logic will always latch it immediately.
Bug 30209608
Change-Id: I875cb5ea258ebb0afae5d1af4ad946475c2240bc
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 5c7db2b..e5d5ebe 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3498,6 +3498,14 @@
// create a surface (because we're a producer, and we need to
// dequeue/queue a buffer)
sp<Surface> sur = new Surface(producer, false);
+
+ // Put the screenshot Surface into async mode so that
+ // Layer::headFenceHasSignaled will always return true and we'll latch the
+ // first buffer regardless of whether or not its acquire fence has
+ // signaled. This is needed to avoid a race condition in the rotation
+ // animation. See b/30209608
+ sur->setAsyncMode(true);
+
ANativeWindow* window = sur.get();
status_t result = native_window_api_connect(window, NATIVE_WINDOW_API_EGL);