Integrate transaction tracing with perfetto

Define the perfetto custom data source TransactionDataSource.
TransactionDataSource is registered with perfetto and is used
to listen to perfetto events (setup, start, stop, flush)
and to write trace packets to perfetto.

The user can configure/start/stop tracing via /system/bin/perfetto.

Tracing can operate in the following modes.

ACTIVE mode:
The transactions ring buffer (starting state + following committed
transactions) is written (only once) to perfetto when the 'start'
event is received.
Transactions are then written to perfetto each time they are committed.
On the receiver side, the data source is to be configured to periodically
flush data to disk providing a virtually infinite storage.

CONTINUOUS mode:
Listens to the perfetto 'flush' event (e.g. when a bugreport is taken).
When a 'flush' event is received, the ring buffer (starting state + following
committed transactions) hold by TransactionTracing is written to perfetto.
On the receiver side, the data source is to be configured with a dedicated
buffer large enough to store all the flushed data.

Bug: b/284424784
Test: atest libsurfaceflinger_unittest && atest transactiontrace_testsuite
Change-Id: I342db500bf258b25aac071c1759b5de924df45dc
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 65d56a8..386ef2f 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -6924,7 +6924,7 @@
                         // Transaction tracing is always running but allow the user to temporarily
                         // increase the buffer when actively debugging.
                         mTransactionTracing->setBufferSize(
-                                TransactionTracing::ACTIVE_TRACING_BUFFER_SIZE);
+                                TransactionTracing::LEGACY_ACTIVE_TRACING_BUFFER_SIZE);
                     } else {
                         TransactionTraceWriter::getInstance().invoke("", /* overwrite= */ true);
                         mTransactionTracing->setBufferSize(
@@ -6934,7 +6934,7 @@
                 reply->writeInt32(NO_ERROR);
                 return NO_ERROR;
             }
-            case 1042: { // Write layers trace or transaction trace to file
+            case 1042: { // Write transaction trace to file
                 if (mTransactionTracing) {
                     mTransactionTracing->writeToFile();
                 }