[SurfaceComposerClient] Avoid mSurfaceStats mutex contention

Previous logic acquired mSurfaceStats mutex and called the listeners
with the mutex held between buffer releases. Instead release all the
buffers before handling surface stats listener callbacks and updating
jank data.

Bug: 294935709
Test: presubmit and perfetto traces
Change-Id: Ie90ccde431059bdcdb6900148c6027d313e7434f
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index db99726..ae0cdc9 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -450,7 +450,9 @@
             callbackFunction(transactionStats.latchTime, transactionStats.presentFence,
                              surfaceControlStats);
         }
+    }
 
+    for (const auto& transactionStats : listenerStats.transactionStats) {
         for (const auto& surfaceStats : transactionStats.surfaceStats) {
             // The callbackMap contains the SurfaceControl object, which we need to look up the
             // layerId. Since we don't know which callback contains the SurfaceControl, iterate