Adds a flush jank data layer state update type.

A transaction can be sent to SurfaceFlinger with a layer state change
of this type to wake up SurfaceFlinger and have it perform the layer
state update logic, without updating anything, but triggering any
side-effects, especially jank data processing.

Bug: 235178314
Bug: 221393601
Bug: 225105422
Test: atest SurfaceFlinger_test
Change-Id: Idf458c96cbe8f54224ebde6f517c08b9a5c48a06
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 9092f5f..044fb4b 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -1180,6 +1180,19 @@
 void SurfaceComposerClient::Transaction::setDefaultApplyToken(sp<IBinder> applyToken) {
     sApplyToken = applyToken;
 }
+
+status_t SurfaceComposerClient::Transaction::sendSurfaceFlushJankDataTransaction(
+        const sp<SurfaceControl>& sc) {
+    Transaction t;
+    layer_state_t* s = t.getLayerState(sc);
+    if (!s) {
+        return BAD_INDEX;
+    }
+
+    s->what |= layer_state_t::eFlushJankData;
+    t.registerSurfaceControlForCallback(sc);
+    return t.apply(/*sync=*/false, /* oneWay=*/true);
+}
 // ---------------------------------------------------------------------------
 
 sp<IBinder> SurfaceComposerClient::createDisplay(const String8& displayName, bool secure,