[sf] protect against out of order transactions

If the client submits transactions out of order, we could end up
in a situation where a frame barrier will never be satisfied and
bring down the client. Fix this by being more resiliant to out of
order transactions.

Bug: 272189296
Test: repro steps from bug
Change-Id: I781b7751bdd6259fc164692248734c0cb268c238
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 1af648a..248fcec 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -140,9 +140,16 @@
         bool dataspaceRequested;
 
         uint64_t frameNumber;
+        // high watermark framenumber to use to check for barriers to protect ourselves
+        // from out of order transactions
+        uint64_t barrierFrameNumber;
         ui::Transform transform;
 
         uint32_t producerId = 0;
+        // high watermark producerId to use to check for barriers to protect ourselves
+        // from out of order transactions
+        uint32_t barrierProducerId = 0;
+
         uint32_t bufferTransform;
         bool transformToDisplayInverse;
         Region transparentRegionHint;