Fix Transaction tracking for FrameTimeline

The current setup only supports one SurfaceFrame per DrawingState for
Transactions. This becomes problematic if more than one Transaction is
submitted for the same vsync, on the same layer. On top of this, the
Blast transactions can have a buffer that could result in a buffer drop.

This change adds the support to hold multiple SurfaceFrames in the
Layer's State. It also adds a bufferSurfaceFrame that's intended only
for Blast Transactions with a Buffer. All other Transactions are tracked
in the bufferlessSurfaceFrames.

Additionally, this change also adds a lastLatchTime. It is needed for
classifying BufferStuffing properly.

Bug: 176106798
Test: open any app from the launcher and at the same time check dumpsys
Change-Id: Id3b8369ca206f8b89be3041e5fc018f1f1be1d23
Merged-In: Id3b8369ca206f8b89be3041e5fc018f1f1be1d23
diff --git a/services/surfaceflinger/BufferStateLayer.h b/services/surfaceflinger/BufferStateLayer.h
index b93d567..ea832a2 100644
--- a/services/surfaceflinger/BufferStateLayer.h
+++ b/services/surfaceflinger/BufferStateLayer.h
@@ -72,7 +72,7 @@
     bool setBuffer(const sp<GraphicBuffer>& buffer, const sp<Fence>& acquireFence, nsecs_t postTime,
                    nsecs_t desiredPresentTime, bool isAutoTimestamp,
                    const client_cache_t& clientCacheId, uint64_t frameNumber,
-                   std::optional<nsecs_t> dequeueTime) override;
+                   std::optional<nsecs_t> dequeueTime, const FrameTimelineInfo& info) override;
     bool setAcquireFence(const sp<Fence>& fence) override;
     bool setDataspace(ui::Dataspace dataspace) override;
     bool setHdrMetadata(const HdrMetadata& hdrMetadata) override;
@@ -124,6 +124,8 @@
 
 private:
     friend class SlotGenerationTest;
+    friend class TransactionSurfaceFrameTest;
+
     inline void tracePendingBufferCount();
 
     bool updateFrameEventHistory(const sp<Fence>& acquireFence, nsecs_t postedTime,