Update producer's cache of frame events in de/queue

* Cache is only updated during queue and dequeue if
    the getFrameTimestamps is enabled.
* The consumer avoids sending a copy of the acquire
    fence back to the producer since the producer
    already has a copy.

Test: adb shell /data/nativetest/libgui_test/libgui_test
--gtest_filter=*GetFrameTimestamps*

Change-Id: I6a8b965ae79441a40893b5df937f9ed004fe7359
diff --git a/libs/gui/FrameTimestamps.cpp b/libs/gui/FrameTimestamps.cpp
index 4b98cff..30ff65f 100644
--- a/libs/gui/FrameTimestamps.cpp
+++ b/libs/gui/FrameTimestamps.cpp
@@ -301,7 +301,6 @@
             // Existing frame. Merge.
             // Consumer never sends timestamps of fences, only the fences
             // themselves, so we never need to update the fence timestamps here.
-            applyFenceDelta(&frame.acquireFence, d.mAcquireFence);
             applyFenceDelta(
                     &frame.gpuCompositionDoneFence, d.mGpuCompositionDoneFence);
             applyFenceDelta(&frame.displayPresentFence, d.mDisplayPresentFence);
@@ -318,7 +317,7 @@
 
             // Set aquire fence and time at this point.
             frame.acquireTime = 0;
-            frame.acquireFence = d.mAcquireFence;
+            frame.acquireFence = Fence::NO_FENCE;
 
             // Reset fence-related timestamps
             frame.gpuCompositionDoneTime = 0;
@@ -348,8 +347,11 @@
     newTimestamps.acquireFence = newEntry.acquireFence;
     newTimestamps.valid = true;
     mFrames[mQueueOffset] = newTimestamps;
+
+    // Note: We avoid sending the acquire fence back to the caller since
+    // they have the original one already, so there is no need to set the
+    // acquire dirty bit.
     mFramesDirty[mQueueOffset].setDirty<FrameEvent::POSTED>();
-    mFramesDirty[mQueueOffset].setDirty<FrameEvent::ACQUIRE>();
 
     mQueueOffset = (mQueueOffset + 1) % mFrames.size();
 }
@@ -456,8 +458,6 @@
       mLatchTime(frameTimestamps.latchTime),
       mFirstRefreshStartTime(frameTimestamps.firstRefreshStartTime),
       mLastRefreshStartTime(frameTimestamps.lastRefreshStartTime) {
-    mAcquireFence = dirtyFields.isDirty<FrameEvent::ACQUIRE>() ?
-            frameTimestamps.acquireFence : Fence::NO_FENCE;
     mGpuCompositionDoneFence =
             dirtyFields.isDirty<FrameEvent::GL_COMPOSITION_DONE>() ?
                     frameTimestamps.gpuCompositionDoneFence : Fence::NO_FENCE;