ClientComposition test fix

Client composition test was broken because there was a buffer
created at the test creation and this is not how
this test works for client composition trigger.
And for the fence that was used is different from what it
needs previously fence was acquired through gralloc but now
it's internal to the Graphic Buffer and we no longer
have to  wait for the fence to signal it's taken care
by the graphicBuffer->unlock call, the unlock call waits
for us.
See for unlock https://source.corp.google.com/android/frameworks/native/libs/ui/GraphicBufferMapper.cpp;rcl=HEAD;l=139

BUG: 216170021

Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I8fa25d8910a4e2b1df2f0e2270445a658e3b1a39
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp
index 68956b0..92fa20c 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/VtsHalGraphicsComposer3_ReadbackTest.cpp
@@ -562,16 +562,18 @@
             ASSERT_NO_FATAL_FAILURE(
                     ReadbackHelper::fillBuffer(layer->getWidth(), layer->getHeight(), stride,
                                                clientBufData, clientFormat, expectedColors));
-            EXPECT_EQ(::android::OK, graphicBuffer->unlock());
+            int32_t clientFence;
+            const auto unlockStatus = graphicBuffer->unlockAsync(&clientFence);
+            ASSERT_EQ(::android::OK, unlockStatus);
+            if (clientFence >= 0) {
+                sync_wait(clientFence, -1);
+                close(clientFence);
+            }
 
-            const auto& [status, bufferFence] =
-                    mComposerClient->getReadbackBufferFence(getPrimaryDisplayId());
-            EXPECT_TRUE(status.isOk());
-
-            layer->setToClientComposition(mWriter);
-            mWriter.acceptDisplayChanges(getPrimaryDisplayId());
-            mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, bufferFence.get(),
+            mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence,
                                     clientDataspace, std::vector<common::Rect>(1, damage));
+            layer->setToClientComposition(mWriter);
+            mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
             execute();
             changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
             ASSERT_TRUE(changedCompositionTypes.empty());
@@ -671,16 +673,18 @@
         ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBuffer(
                 static_cast<uint32_t>(getDisplayWidth()), static_cast<uint32_t>(getDisplayHeight()),
                 graphicBuffer->getStride(), clientBufData, clientFormat, clientColors));
-        EXPECT_EQ(::android::OK, graphicBuffer->unlock());
+        int32_t clientFence;
+        const auto unlockStatus = graphicBuffer->unlockAsync(&clientFence);
+        ASSERT_EQ(::android::OK, unlockStatus);
+        if (clientFence >= 0) {
+            sync_wait(clientFence, -1);
+            close(clientFence);
+        }
 
-        const auto& [status, bufferFence] =
-                mComposerClient->getReadbackBufferFence(getPrimaryDisplayId());
-        EXPECT_TRUE(status.isOk());
-
-        clientLayer->setToClientComposition(mWriter);
-        mWriter.acceptDisplayChanges(getPrimaryDisplayId());
-        mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, bufferFence.get(),
+        mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence,
                                 clientDataspace, std::vector<common::Rect>(1, clientFrame));
+        clientLayer->setToClientComposition(mWriter);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
         changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
         ASSERT_TRUE(changedCompositionTypes.empty());