Use Wrapper in the readback tests.

BUG: 199413815

Test: atest VtsHalGraphicsComposer3_TargetTest
Change-Id: I3a7e81f8c04971b178ae703a3eb83de50ae0810f
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 3f1e703..45a8f6f 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
@@ -20,14 +20,12 @@
 #include <aidl/Vintf.h>
 #include <aidl/android/hardware/graphics/common/BufferUsage.h>
 #include <aidl/android/hardware/graphics/composer3/IComposer.h>
-#include <android/binder_manager.h>
 #include <composer-vts/include/ReadbackVts.h>
 #include <composer-vts/include/RenderEngineVts.h>
 #include <gtest/gtest.h>
 #include <ui/DisplayId.h>
 #include <ui/DisplayIdentification.h>
 #include <ui/GraphicBuffer.h>
-#include <ui/GraphicBufferAllocator.h>
 #include <ui/PixelFormat.h>
 #include <ui/Rect.h>
 
@@ -37,6 +35,7 @@
 #include <tinyxml2.h>
 #pragma clang diagnostic pop
 #include "composer-vts/include/GraphicsComposerCallback.h"
+#include "composer-vts/include/VtsComposerClient.h"
 
 namespace aidl::android::hardware::graphics::composer3::vts {
 namespace {
@@ -48,40 +47,25 @@
 class GraphicsCompositionTestBase : public ::testing::Test {
   protected:
     void SetUpBase(const std::string& name) {
-        ndk::SpAIBinder binder(AServiceManager_waitForService(name.c_str()));
-        ASSERT_NE(binder, nullptr);
-        ASSERT_NO_FATAL_FAILURE(mComposer = IComposer::fromBinder(binder));
-        ASSERT_NE(mComposer, nullptr);
-        ASSERT_NO_FATAL_FAILURE(mComposer->createClient(&mComposerClient));
-        mComposerCallback = ::ndk::SharedRefBase::make<GraphicsComposerCallback>();
-        mComposerClient->registerCallback(mComposerCallback);
+        mComposerClient = std::make_shared<VtsComposerClient>(name);
+        ASSERT_TRUE(mComposerClient->createClient().isOk());
 
-        // assume the first display is primary and is never removed
-        mPrimaryDisplay = waitForFirstDisplay();
-
-        ASSERT_NO_FATAL_FAILURE(mInvalidDisplayId = GetInvalidDisplayId());
-
-        int32_t activeConfig;
-        EXPECT_TRUE(mComposerClient->getActiveConfig(mPrimaryDisplay, &activeConfig).isOk());
-        EXPECT_TRUE(mComposerClient
-                            ->getDisplayAttribute(mPrimaryDisplay, activeConfig,
-                                                  DisplayAttribute::WIDTH, &mDisplayWidth)
-                            .isOk());
-        EXPECT_TRUE(mComposerClient
-                            ->getDisplayAttribute(mPrimaryDisplay, activeConfig,
-                                                  DisplayAttribute::HEIGHT, &mDisplayHeight)
-                            .isOk());
+        const auto& [status, displays] = mComposerClient->getDisplays();
+        ASSERT_TRUE(status.isOk());
+        mDisplays = displays;
 
         setTestColorModes();
 
         // explicitly disable vsync
-        EXPECT_TRUE(mComposerClient->setVsyncEnabled(mPrimaryDisplay, false).isOk());
-        mComposerCallback->setVsyncAllowed(false);
+        for (const auto& display : mDisplays) {
+            EXPECT_TRUE(mComposerClient->setVsync(display.getDisplayId(), /*enable*/ false).isOk());
+        }
+        mComposerClient->setVsyncAllowed(/*isAllowed*/ false);
 
         // set up gralloc
         mGraphicBuffer = allocate();
 
-        ASSERT_NO_FATAL_FAILURE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::ON));
+        EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::ON).isOk());
 
         ASSERT_NO_FATAL_FAILURE(
                 mTestRenderEngine = std::unique_ptr<TestRenderEngine>(new TestRenderEngine(
@@ -96,11 +80,12 @@
                                 .build())));
 
         ::android::renderengine::DisplaySettings clientCompositionDisplay;
-        clientCompositionDisplay.physicalDisplay = Rect(mDisplayWidth, mDisplayHeight);
+        clientCompositionDisplay.physicalDisplay = Rect(getDisplayWidth(), getDisplayHeight());
         clientCompositionDisplay.clip = clientCompositionDisplay.physicalDisplay;
 
         mTestRenderEngine->initGraphicBuffer(
-                static_cast<uint32_t>(mDisplayWidth), static_cast<uint32_t>(mDisplayHeight), 1,
+                static_cast<uint32_t>(getDisplayWidth()), static_cast<uint32_t>(getDisplayHeight()),
+                /*layerCount*/ 1U,
                 static_cast<uint64_t>(
                         static_cast<uint64_t>(common::BufferUsage::CPU_READ_OFTEN) |
                         static_cast<uint64_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
@@ -109,21 +94,27 @@
     }
 
     void TearDown() override {
-        ASSERT_NO_FATAL_FAILURE(mComposerClient->setPowerMode(mPrimaryDisplay, PowerMode::OFF));
+        ASSERT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk());
+        ASSERT_TRUE(mComposerClient->tearDown());
+        mComposerClient.reset();
         const auto errors = mReader.takeErrors();
         ASSERT_TRUE(mReader.takeErrors().empty());
-        ASSERT_TRUE(mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty());
-
-        if (mComposerCallback != nullptr) {
-            EXPECT_EQ(0, mComposerCallback->getInvalidHotplugCount());
-            EXPECT_EQ(0, mComposerCallback->getInvalidRefreshCount());
-            EXPECT_EQ(0, mComposerCallback->getInvalidVsyncCount());
-        }
+        ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty());
     }
 
+    const VtsDisplay& getPrimaryDisplay() const { return mDisplays[0]; }
+
+    int64_t getPrimaryDisplayId() const { return getPrimaryDisplay().getDisplayId(); }
+
+    int64_t getInvalidDisplayId() const { return mComposerClient->getInvalidDisplayId(); }
+
+    int32_t getDisplayWidth() const { return getPrimaryDisplay().getDisplayWidth(); }
+
+    int32_t getDisplayHeight() const { return getPrimaryDisplay().getDisplayHeight(); }
+
     ::android::sp<::android::GraphicBuffer> allocate() {
-        const auto width = static_cast<uint32_t>(mDisplayWidth);
-        const auto height = static_cast<uint32_t>(mDisplayHeight);
+        const auto width = static_cast<uint32_t>(getDisplayWidth());
+        const auto height = static_cast<uint32_t>(getDisplayHeight());
         const auto usage = static_cast<uint32_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
                            static_cast<uint32_t>(common::BufferUsage::CPU_READ_OFTEN);
 
@@ -133,9 +124,9 @@
     }
 
     uint64_t getStableDisplayId(int64_t display) {
-        DisplayIdentification identification;
-        const auto error = mComposerClient->getDisplayIdentificationData(display, &identification);
-        EXPECT_TRUE(error.isOk());
+        const auto& [status, identification] =
+                mComposerClient->getDisplayIdentificationData(display);
+        EXPECT_TRUE(status.isOk());
 
         if (const auto info = ::android::parseDisplayIdentificationData(
                     static_cast<uint8_t>(identification.port), identification.data)) {
@@ -203,7 +194,7 @@
     }
 
     void writeLayers(const std::vector<std::shared_ptr<TestLayer>>& layers) {
-        for (auto layer : layers) {
+        for (const auto& layer : layers) {
             layer->write(mWriter);
         }
         execute();
@@ -216,59 +207,42 @@
             return;
         }
 
-        std::vector<CommandResultPayload> results;
-        auto status = mComposerClient->executeCommands(commands, &results);
+        auto [status, results] = mComposerClient->executeCommands(commands);
         ASSERT_TRUE(status.isOk()) << "executeCommands failed " << status.getDescription();
 
         mReader.parse(std::move(results));
         mWriter.reset();
     }
 
-    bool getHasReadbackBuffer() {
-        ReadbackBufferAttributes readBackBufferAttributes;
-        const auto error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay,
-                                                                        &readBackBufferAttributes);
-        mPixelFormat = readBackBufferAttributes.format;
-        mDataspace = readBackBufferAttributes.dataspace;
-        return error.isOk() && ReadbackHelper::readbackSupported(mPixelFormat, mDataspace);
+    std::pair<ScopedAStatus, bool> getHasReadbackBuffer() {
+        auto [status, readBackBufferAttributes] =
+                mComposerClient->getReadbackBufferAttributes(getPrimaryDisplayId());
+        if (status.isOk()) {
+            mPixelFormat = readBackBufferAttributes.format;
+            mDataspace = readBackBufferAttributes.dataspace;
+            return {std::move(status), ReadbackHelper::readbackSupported(mPixelFormat, mDataspace)};
+        }
+        return {std::move(status), false};
     }
 
-    std::shared_ptr<IComposer> mComposer;
-    std::shared_ptr<IComposerClient> mComposerClient;
-
-    std::shared_ptr<GraphicsComposerCallback> mComposerCallback;
-    // the first display and is assumed never to be removed
-    int64_t mPrimaryDisplay;
-    int64_t mInvalidDisplayId;
-    int32_t mDisplayWidth;
-    int32_t mDisplayHeight;
+    std::shared_ptr<VtsComposerClient> mComposerClient;
+    std::vector<VtsDisplay> mDisplays;
+    // use the slot count usually set by SF
     std::vector<ColorMode> mTestColorModes;
     ComposerClientWriter mWriter;
     ComposerClientReader mReader;
     ::android::sp<::android::GraphicBuffer> mGraphicBuffer;
     std::unique_ptr<TestRenderEngine> mTestRenderEngine;
-
     common::PixelFormat mPixelFormat;
     common::Dataspace mDataspace;
 
     static constexpr uint32_t kClientTargetSlotCount = 64;
 
   private:
-    int64_t waitForFirstDisplay() {
-        while (true) {
-            std::vector<int64_t> displays = mComposerCallback->getDisplays();
-            if (displays.empty()) {
-                usleep(5 * 1000);
-                continue;
-            }
-            return displays[0];
-        }
-    }
-
     void setTestColorModes() {
         mTestColorModes.clear();
-        std::vector<ColorMode> modes;
-        EXPECT_TRUE(mComposerClient->getColorModes(mPrimaryDisplay, &modes).isOk());
+        const auto& [status, modes] = mComposerClient->getColorModes(getPrimaryDisplayId());
+        ASSERT_TRUE(status.isOk());
 
         for (ColorMode mode : modes) {
             if (std::find(ReadbackHelper::colorModes.begin(), ReadbackHelper::colorModes.end(),
@@ -277,27 +251,6 @@
             }
         }
     }
-
-    // returns an invalid display id (one that has not been registered to a
-    // display.  Currently assuming that a device will never have close to
-    // std::numeric_limit<uint64_t>::max() displays registered while running tests
-    int64_t GetInvalidDisplayId() {
-        int64_t id = std::numeric_limits<int64_t>::max();
-        std::vector<int64_t> displays = mComposerCallback->getDisplays();
-        while (id > 0) {
-            if (std::none_of(displays.begin(), displays.end(),
-                             [&](const auto& display) { return id == display; })) {
-                return id;
-            }
-            id--;
-        }
-
-        // Although 0 could be an invalid display, a return value of 0
-        // from GetInvalidDisplayId means all other ids are in use, a condition which
-        // we are assuming a device will never have
-        EXPECT_NE(0, id);
-        return id;
-    }
 };
 
 class GraphicsCompositionTest : public GraphicsCompositionTestBase,
@@ -308,16 +261,19 @@
 
 TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) {
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
 
-        auto layer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
-        common::Rect coloredSquare({0, 0, mDisplayWidth, mDisplayHeight});
+        auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
+        common::Rect coloredSquare({0, 0, getDisplayWidth(), getDisplayHeight()});
         layer->setColor(BLUE);
         layer->setDisplayFrame(coloredSquare);
         layer->setZOrder(10);
@@ -325,25 +281,26 @@
         std::vector<std::shared_ptr<TestLayer>> layers = {layer};
 
         // expected color for each pixel
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, coloredSquare, BLUE);
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), coloredSquare, BLUE);
 
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
 
         writeLayers(layers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
         // if hwc cannot handle and asks for composition change,
         // just succeed the test
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
 
@@ -356,31 +313,35 @@
 
 TEST_P(GraphicsCompositionTest, SetLayerBuffer) {
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
 
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
-                                       {0, 0, mDisplayWidth, mDisplayHeight / 4}, RED);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
-                                       {0, mDisplayHeight / 4, mDisplayWidth, mDisplayHeight / 2},
-                                       GREEN);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
-                                       {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight},
-                                       BLUE);
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
+                                       {0, 0, getDisplayWidth(), getDisplayHeight() / 4}, RED);
+        ReadbackHelper::fillColorsArea(
+                expectedColors, getDisplayWidth(),
+                {0, getDisplayHeight() / 4, getDisplayWidth(), getDisplayHeight() / 2}, GREEN);
+        ReadbackHelper::fillColorsArea(
+                expectedColors, getDisplayWidth(),
+                {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE);
 
         auto layer = std::make_shared<TestBufferLayer>(
-                mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth,
-                mDisplayHeight, common::PixelFormat::RGBA_8888);
-        layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+                mComposerClient, mGraphicBuffer, *mTestRenderEngine, getPrimaryDisplayId(),
+                getDisplayWidth(), getDisplayHeight(), common::PixelFormat::RGBA_8888);
+        layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
         layer->setZOrder(10);
         layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
         ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors));
@@ -389,16 +350,16 @@
 
         writeLayers(layers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
 
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
 
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
 
         ASSERT_TRUE(mReader.takeErrors().empty());
@@ -412,16 +373,19 @@
 
 TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) {
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
 
-        auto layer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
-        common::Rect coloredSquare({0, 0, mDisplayWidth, mDisplayHeight});
+        auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
+        common::Rect coloredSquare({0, 0, getDisplayWidth(), getDisplayHeight()});
         layer->setColor(BLUE);
         layer->setDisplayFrame(coloredSquare);
         layer->setZOrder(10);
@@ -432,28 +396,31 @@
                 static_cast<uint64_t>(static_cast<uint64_t>(common::BufferUsage::CPU_READ_OFTEN) |
                                       static_cast<uint64_t>(common::BufferUsage::CPU_WRITE_OFTEN));
 
-        mGraphicBuffer->reallocate(static_cast<uint32_t>(mDisplayWidth),
-                                   static_cast<uint32_t>(mDisplayHeight), 1,
+        mGraphicBuffer->reallocate(static_cast<uint32_t>(getDisplayWidth()),
+                                   static_cast<uint32_t>(getDisplayHeight()), 1,
                                    static_cast<uint32_t>(common::PixelFormat::RGBA_8888), usage);
-        mWriter.setLayerBuffer(mPrimaryDisplay, layer->getLayer(), 0, mGraphicBuffer->handle, -1);
+        mWriter.setLayerBuffer(getPrimaryDisplayId(), layer->getLayer(), /*slot*/ 0,
+                               mGraphicBuffer->handle,
+                               /*acquireFence*/ -1);
 
         // expected color for each pixel
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, coloredSquare, BLUE);
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), coloredSquare, BLUE);
 
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
 
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
 
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
 
@@ -462,111 +429,118 @@
 }
 
 TEST_P(GraphicsCompositionTest, SetReadbackBuffer) {
-    if (!getHasReadbackBuffer()) {
+    const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+    EXPECT_TRUE(readbackStatus.isOk());
+    if (!isSupported) {
         GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
         return;
     }
 
-    ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, mDisplayHeight,
-                                  mPixelFormat, mDataspace);
+    ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                  getDisplayHeight(), mPixelFormat, mDataspace);
 
     ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
 }
 
-TEST_P(GraphicsCompositionTest, SetReadbackBufferBadDisplay) {
-    if (!getHasReadbackBuffer()) {
+TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadDisplay) {
+    const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+    EXPECT_TRUE(readbackStatus.isOk());
+    if (!isSupported) {
         GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
         return;
     }
 
     ASSERT_NE(nullptr, mGraphicBuffer);
     ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck());
-    aidl::android::hardware::common::NativeHandle bufferHandle =
-            ::android::dupToAidl(mGraphicBuffer->handle);
+    const auto& bufferHandle = mGraphicBuffer->handle;
     ::ndk::ScopedFileDescriptor fence = ::ndk::ScopedFileDescriptor(-1);
 
-    const auto error = mComposerClient->setReadbackBuffer(mInvalidDisplayId, bufferHandle, fence);
+    const auto status =
+            mComposerClient->setReadbackBuffer(getInvalidDisplayId(), bufferHandle, fence);
 
-    EXPECT_FALSE(error.isOk());
-    ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, error.getServiceSpecificError());
+    EXPECT_FALSE(status.isOk());
+    ASSERT_EQ(IComposerClient::EX_BAD_DISPLAY, status.getServiceSpecificError());
 }
 
-TEST_P(GraphicsCompositionTest, SetReadbackBufferBadParameter) {
-    if (!getHasReadbackBuffer()) {
+TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadParameter) {
+    const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+    EXPECT_TRUE(readbackStatus.isOk());
+    if (!isSupported) {
         GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
         return;
     }
 
-    aidl::android::hardware::common::NativeHandle bufferHandle;
-    {
-        ::android::sp<::android::GraphicBuffer> buffer = allocate();
-        ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck());
-        ::android::makeToAidl(mGraphicBuffer->handle);
-    }
-
+    const native_handle_t bufferHandle{};
     ndk::ScopedFileDescriptor releaseFence = ndk::ScopedFileDescriptor(-1);
-    const auto error =
-            mComposerClient->setReadbackBuffer(mPrimaryDisplay, bufferHandle, releaseFence);
+    const auto status =
+            mComposerClient->setReadbackBuffer(getPrimaryDisplayId(), &bufferHandle, releaseFence);
 
-    EXPECT_FALSE(error.isOk());
-    ASSERT_EQ(IComposerClient::EX_BAD_PARAMETER, error.getServiceSpecificError());
+    EXPECT_FALSE(status.isOk());
+    ASSERT_EQ(IComposerClient::EX_BAD_PARAMETER, status.getServiceSpecificError());
 }
 
 TEST_P(GraphicsCompositionTest, GetReadbackBufferFenceInactive) {
-    if (!getHasReadbackBuffer()) {
+    const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+    EXPECT_TRUE(readbackStatus.isOk());
+    if (!isSupported) {
         GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
         return;
     }
 
-    ndk::ScopedFileDescriptor releaseFence;
-    const auto error = mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &releaseFence);
+    const auto& [status, releaseFence] =
+            mComposerClient->getReadbackBufferFence(getPrimaryDisplayId());
 
-    ASSERT_FALSE(error.isOk());
-    EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, error.getServiceSpecificError());
+    EXPECT_FALSE(status.isOk());
+    EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, status.getServiceSpecificError());
     EXPECT_EQ(-1, releaseFence.get());
 }
 
 TEST_P(GraphicsCompositionTest, ClientComposition) {
-    EXPECT_TRUE(mComposerClient->setClientTargetSlotCount(mPrimaryDisplay, kClientTargetSlotCount)
-                        .isOk());
+    EXPECT_TRUE(
+            mComposerClient->setClientTargetSlotCount(getPrimaryDisplayId(), kClientTargetSlotCount)
+                    .isOk());
 
     for (ColorMode mode : mTestColorModes) {
-        EXPECT_TRUE(mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
                             .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
 
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
-                                       {0, 0, mDisplayWidth, mDisplayHeight / 4}, RED);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
-                                       {0, mDisplayHeight / 4, mDisplayWidth, mDisplayHeight / 2},
-                                       GREEN);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
-                                       {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight},
-                                       BLUE);
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
+                                       {0, 0, getDisplayWidth(), getDisplayHeight() / 4}, RED);
+        ReadbackHelper::fillColorsArea(
+                expectedColors, getDisplayWidth(),
+                {0, getDisplayHeight() / 4, getDisplayWidth(), getDisplayHeight() / 2}, GREEN);
+        ReadbackHelper::fillColorsArea(
+                expectedColors, getDisplayWidth(),
+                {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE);
 
         auto layer = std::make_shared<TestBufferLayer>(
-                mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth,
-                mDisplayHeight, PixelFormat::RGBA_FP16);
-        layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+                mComposerClient, mGraphicBuffer, *mTestRenderEngine, getPrimaryDisplayId(),
+                getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_FP16);
+        layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
         layer->setZOrder(10);
         layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
 
         std::vector<std::shared_ptr<TestLayer>> layers = {layer};
 
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
         writeLayers(layers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
 
-        auto changedCompositionTypes = mReader.takeChangedCompositionTypes(mPrimaryDisplay);
+        auto changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
         if (!changedCompositionTypes.empty()) {
             ASSERT_EQ(1, changedCompositionTypes.size());
             ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0].composition);
@@ -577,7 +551,7 @@
                     static_cast<uint32_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
                     static_cast<uint32_t>(common::BufferUsage::COMPOSER_CLIENT_TARGET));
             Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode);
-            common::Rect damage{0, 0, mDisplayWidth, mDisplayHeight};
+            common::Rect damage{0, 0, getDisplayWidth(), getDisplayHeight()};
 
             // create client target buffer
             mGraphicBuffer->reallocate(layer->getWidth(), layer->getHeight(),
@@ -595,21 +569,22 @@
                                                clientBufData, clientFormat, expectedColors));
             EXPECT_EQ(::android::OK, mGraphicBuffer->unlock());
 
-            ndk::ScopedFileDescriptor fenceHandle;
-            EXPECT_TRUE(
-                    mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fenceHandle).isOk());
+            const auto& [status, bufferFence] =
+                    mComposerClient->getReadbackBufferFence(getPrimaryDisplayId());
+            EXPECT_TRUE(status.isOk());
 
             layer->setToClientComposition(mWriter);
-            mWriter.acceptDisplayChanges(mPrimaryDisplay);
-            mWriter.setClientTarget(mPrimaryDisplay, 0, mGraphicBuffer->handle, fenceHandle.get(),
-                                    clientDataspace, std::vector<common::Rect>(1, damage));
+            mWriter.acceptDisplayChanges(getPrimaryDisplayId());
+            mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, mGraphicBuffer->handle,
+                                    bufferFence.get(), clientDataspace,
+                                    std::vector<common::Rect>(1, damage));
             execute();
-            changedCompositionTypes = mReader.takeChangedCompositionTypes(mPrimaryDisplay);
+            changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
             ASSERT_TRUE(changedCompositionTypes.empty());
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
 
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
 
         ASSERT_TRUE(mReader.takeErrors().empty());
@@ -619,31 +594,37 @@
 }
 
 TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) {
-    ASSERT_NO_FATAL_FAILURE(
-            mComposerClient->setClientTargetSlotCount(mPrimaryDisplay, kClientTargetSlotCount));
+    ASSERT_TRUE(
+            mComposerClient->setClientTargetSlotCount(getPrimaryDisplayId(), kClientTargetSlotCount)
+                    .isOk());
 
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
 
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
-                                       {0, 0, mDisplayWidth, mDisplayHeight / 2}, GREEN);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
-                                       {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight}, RED);
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
+                                       {0, 0, getDisplayWidth(), getDisplayHeight() / 2}, GREEN);
+        ReadbackHelper::fillColorsArea(
+                expectedColors, getDisplayWidth(),
+                {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, RED);
 
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
 
         auto deviceLayer = std::make_shared<TestBufferLayer>(
-                mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth,
-                mDisplayHeight / 2, PixelFormat::RGBA_8888);
+                mComposerClient, mGraphicBuffer, *mTestRenderEngine, getPrimaryDisplayId(),
+                getDisplayWidth(), getDisplayHeight() / 2, PixelFormat::RGBA_8888);
         std::vector<Color> deviceColors(deviceLayer->getWidth() * deviceLayer->getHeight());
         ReadbackHelper::fillColorsArea(deviceColors, static_cast<int32_t>(deviceLayer->getWidth()),
                                        {0, 0, static_cast<int32_t>(deviceLayer->getWidth()),
@@ -662,54 +643,59 @@
                 static_cast<uint32_t>(common::BufferUsage::CPU_WRITE_OFTEN) |
                 static_cast<uint32_t>(common::BufferUsage::COMPOSER_CLIENT_TARGET));
         Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode);
-        int32_t clientWidth = mDisplayWidth;
-        int32_t clientHeight = mDisplayHeight / 2;
+        int32_t clientWidth = getDisplayWidth();
+        int32_t clientHeight = getDisplayHeight() / 2;
 
         auto clientLayer = std::make_shared<TestBufferLayer>(
-                mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, clientWidth,
-                clientHeight, PixelFormat::RGBA_FP16, Composition::DEVICE);
-        common::Rect clientFrame = {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight};
+                mComposerClient, mGraphicBuffer, *mTestRenderEngine, getPrimaryDisplayId(),
+                clientWidth, clientHeight, PixelFormat::RGBA_FP16, Composition::DEVICE);
+        common::Rect clientFrame = {0, getDisplayHeight() / 2, getDisplayWidth(),
+                                    getDisplayHeight()};
         clientLayer->setDisplayFrame(clientFrame);
         clientLayer->setZOrder(0);
         clientLayer->write(mWriter);
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
 
-        auto changedCompositionTypes = mReader.takeChangedCompositionTypes(mPrimaryDisplay);
+        auto changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
         if (changedCompositionTypes.size() != 1) {
             continue;
         }
         // create client target buffer
         ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0].composition);
-        mGraphicBuffer->reallocate(static_cast<uint32_t>(mDisplayWidth),
-                                   static_cast<uint32_t>(mDisplayHeight),
+        mGraphicBuffer->reallocate(static_cast<uint32_t>(getDisplayWidth()),
+                                   static_cast<uint32_t>(getDisplayHeight()),
                                    static_cast<int32_t>(common::PixelFormat::RGBA_8888),
                                    clientLayer->getLayerCount(), clientUsage);
         ASSERT_NE(nullptr, mGraphicBuffer->handle);
 
         void* clientBufData;
-        mGraphicBuffer->lock(clientUsage, {0, 0, mDisplayWidth, mDisplayHeight}, &clientBufData);
+        mGraphicBuffer->lock(clientUsage, {0, 0, getDisplayWidth(), getDisplayHeight()},
+                             &clientBufData);
 
-        std::vector<Color> clientColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
-        ReadbackHelper::fillColorsArea(clientColors, mDisplayWidth, clientFrame, RED);
+        std::vector<Color> clientColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+        ReadbackHelper::fillColorsArea(clientColors, getDisplayWidth(), clientFrame, RED);
         ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBuffer(
-                static_cast<uint32_t>(mDisplayWidth), static_cast<uint32_t>(mDisplayHeight),
+                static_cast<uint32_t>(getDisplayWidth()), static_cast<uint32_t>(getDisplayHeight()),
                 mGraphicBuffer->getStride(), clientBufData, clientFormat, clientColors));
         EXPECT_EQ(::android::OK, mGraphicBuffer->unlock());
 
-        ndk::ScopedFileDescriptor fenceHandle;
-        EXPECT_TRUE(mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fenceHandle).isOk());
+        const auto& [status, bufferFence] =
+                mComposerClient->getReadbackBufferFence(getPrimaryDisplayId());
+        EXPECT_TRUE(status.isOk());
 
         clientLayer->setToClientComposition(mWriter);
-        mWriter.acceptDisplayChanges(mPrimaryDisplay);
-        mWriter.setClientTarget(mPrimaryDisplay, 0, mGraphicBuffer->handle, fenceHandle.get(),
-                                clientDataspace, std::vector<common::Rect>(1, clientFrame));
+        mWriter.acceptDisplayChanges(getPrimaryDisplayId());
+        mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, mGraphicBuffer->handle,
+                                bufferFence.get(), clientDataspace,
+                                std::vector<common::Rect>(1, clientFrame));
         execute();
-        changedCompositionTypes = mReader.takeChangedCompositionTypes(mPrimaryDisplay);
+        changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId());
         ASSERT_TRUE(changedCompositionTypes.empty());
         ASSERT_TRUE(mReader.takeErrors().empty());
 
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
@@ -718,66 +704,72 @@
 
 TEST_P(GraphicsCompositionTest, SetLayerDamage) {
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
 
-        common::Rect redRect = {0, 0, mDisplayWidth / 4, mDisplayHeight / 4};
+        common::Rect redRect = {0, 0, getDisplayWidth() / 4, getDisplayHeight() / 4};
 
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED);
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED);
 
         auto layer = std::make_shared<TestBufferLayer>(
-                mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth,
-                mDisplayHeight, PixelFormat::RGBA_8888);
-        layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+                mComposerClient, mGraphicBuffer, *mTestRenderEngine, getPrimaryDisplayId(),
+                getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888);
+        layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
         layer->setZOrder(10);
         layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
         ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors));
 
         std::vector<std::shared_ptr<TestLayer>> layers = {layer};
 
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
 
         writeLayers(layers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
 
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
 
         // update surface damage and recheck
-        redRect = {mDisplayWidth / 4, mDisplayHeight / 4, mDisplayWidth / 2, mDisplayHeight / 2};
-        ReadbackHelper::clearColors(expectedColors, mDisplayWidth, mDisplayHeight, mDisplayWidth);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED);
+        redRect = {getDisplayWidth() / 4, getDisplayHeight() / 4, getDisplayWidth() / 2,
+                   getDisplayHeight() / 2};
+        ReadbackHelper::clearColors(expectedColors, getDisplayWidth(), getDisplayHeight(),
+                                    getDisplayWidth());
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED);
 
         ASSERT_NO_FATAL_FAILURE(layer->fillBuffer(expectedColors));
         layer->setSurfaceDamage(
-                std::vector<common::Rect>(1, {0, 0, mDisplayWidth / 2, mDisplayWidth / 2}));
+                std::vector<common::Rect>(1, {0, 0, getDisplayWidth() / 2, getDisplayWidth() / 2}));
 
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
 
         writeLayers(layers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
-        ASSERT_TRUE(mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty());
-        mWriter.presentDisplay(mPrimaryDisplay);
+        ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty());
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
 
@@ -787,43 +779,47 @@
 
 TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) {
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
 
-        auto layer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
+        auto layer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
         layer->setColor(RED);
-        layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+        layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
         layer->setZOrder(10);
         layer->setAlpha(0);
         layer->setBlendMode(BlendMode::PREMULTIPLIED);
 
         std::vector<std::shared_ptr<TestLayer>> layers = {layer};
 
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
 
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
 
         writeLayers(layers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
 
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
 
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
 
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
         mTestRenderEngine->setRenderLayers(layers);
@@ -834,50 +830,54 @@
 
 TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) {
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
 
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
-                                       {0, 0, mDisplayWidth, mDisplayHeight / 4}, RED);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
-                                       {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight},
-                                       BLUE);
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
+                                       {0, 0, getDisplayWidth(), getDisplayHeight() / 4}, RED);
+        ReadbackHelper::fillColorsArea(
+                expectedColors, getDisplayWidth(),
+                {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, BLUE);
 
         auto layer = std::make_shared<TestBufferLayer>(
-                mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth,
-                mDisplayHeight, PixelFormat::RGBA_8888);
-        layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+                mComposerClient, mGraphicBuffer, *mTestRenderEngine, getPrimaryDisplayId(),
+                getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888);
+        layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
         layer->setZOrder(10);
         layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
-        layer->setSourceCrop({0, static_cast<float>(mDisplayHeight / 2),
-                              static_cast<float>(mDisplayWidth),
-                              static_cast<float>(mDisplayHeight)});
+        layer->setSourceCrop({0, static_cast<float>(getDisplayHeight() / 2),
+                              static_cast<float>(getDisplayWidth()),
+                              static_cast<float>(getDisplayHeight())});
         ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors));
 
         std::vector<std::shared_ptr<TestLayer>> layers = {layer};
 
         // update expected colors to match crop
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
-                                       {0, 0, mDisplayWidth, mDisplayHeight}, BLUE);
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
+                                       {0, 0, getDisplayWidth(), getDisplayHeight()}, BLUE);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
         writeLayers(layers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
@@ -889,67 +889,72 @@
 
 TEST_P(GraphicsCompositionTest, SetLayerZOrder) {
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
 
-        common::Rect redRect = {0, 0, mDisplayWidth, mDisplayHeight / 2};
-        common::Rect blueRect = {0, mDisplayHeight / 4, mDisplayWidth, mDisplayHeight};
-        auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
+        common::Rect redRect = {0, 0, getDisplayWidth(), getDisplayHeight() / 2};
+        common::Rect blueRect = {0, getDisplayHeight() / 4, getDisplayWidth(), getDisplayHeight()};
+        auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
         redLayer->setColor(RED);
         redLayer->setDisplayFrame(redRect);
 
-        auto blueLayer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
+        auto blueLayer = std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
         blueLayer->setColor(BLUE);
         blueLayer->setDisplayFrame(blueRect);
         blueLayer->setZOrder(5);
 
         std::vector<std::shared_ptr<TestLayer>> layers = {redLayer, blueLayer};
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
 
         // red in front of blue
         redLayer->setZOrder(10);
 
         // fill blue first so that red will overwrite on overlap
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, blueRect, BLUE);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED);
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), blueRect, BLUE);
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED);
 
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
 
         writeLayers(layers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
 
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
 
         redLayer->setZOrder(1);
-        ReadbackHelper::clearColors(expectedColors, mDisplayWidth, mDisplayHeight, mDisplayWidth);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, blueRect, BLUE);
+        ReadbackHelper::clearColors(expectedColors, getDisplayWidth(), getDisplayHeight(),
+                                    getDisplayWidth());
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED);
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), blueRect, BLUE);
 
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
 
         writeLayers(layers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
-        ASSERT_TRUE(mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty());
+        ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty());
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
 
@@ -961,9 +966,9 @@
 }
 
 TEST_P(GraphicsCompositionTest, SetLayerWhitePointDims) {
-    std::vector<DisplayCapability> capabilities;
-    const auto error = mComposerClient->getDisplayCapabilities(mPrimaryDisplay, &capabilities);
-    ASSERT_TRUE(error.isOk());
+    const auto& [status, capabilities] =
+            mComposerClient->getDisplayCapabilities(getPrimaryDisplayId());
+    ASSERT_TRUE(status.isOk());
 
     const bool brightnessSupport = std::find(capabilities.begin(), capabilities.end(),
                                              DisplayCapability::BRIGHTNESS) != capabilities.end();
@@ -974,7 +979,7 @@
     }
 
     const std::optional<float> maxBrightnessNitsOptional =
-            getMaxDisplayBrightnessNits(mPrimaryDisplay);
+            getMaxDisplayBrightnessNits(getPrimaryDisplayId());
 
     ASSERT_TRUE(maxBrightnessNitsOptional.has_value());
 
@@ -983,29 +988,34 @@
     // Preconditions to successfully run are knowing the max brightness and successfully applying
     // the max brightness
     ASSERT_GT(maxBrightnessNits, 0.f);
-    mWriter.setDisplayBrightness(mPrimaryDisplay, 1.f);
+    mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 1.f);
     execute();
     ASSERT_TRUE(mReader.takeErrors().empty());
 
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace for "
                                "color mode: "
                             << toString(mode);
             continue;
         }
-        const common::Rect redRect = {0, 0, mDisplayWidth, mDisplayHeight / 2};
-        const common::Rect dimmerRedRect = {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight};
-        const auto redLayer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
+        const common::Rect redRect = {0, 0, getDisplayWidth(), getDisplayHeight() / 2};
+        const common::Rect dimmerRedRect = {0, getDisplayHeight() / 2, getDisplayWidth(),
+                                            getDisplayHeight()};
+        const auto redLayer =
+                std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
         redLayer->setColor(RED);
         redLayer->setDisplayFrame(redRect);
         redLayer->setWhitePointNits(maxBrightnessNits);
 
         const auto dimmerRedLayer =
-                std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
+                std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
         dimmerRedLayer->setColor(RED);
         dimmerRedLayer->setDisplayFrame(dimmerRedRect);
         // Intentionally use a small dimming ratio as some implementations may be more likely to
@@ -1014,26 +1024,27 @@
         dimmerRedLayer->setWhitePointNits(maxBrightnessNits * kDimmingRatio);
 
         const std::vector<std::shared_ptr<TestLayer>> layers = {redLayer, dimmerRedLayer};
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
 
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, dimmerRedRect, DIM_RED);
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED);
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), dimmerRedRect, DIM_RED);
 
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
 
         writeLayers(layers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED()
                     << "Readback verification not supported for GPU composition for color mode: "
                     << toString(mode);
             continue;
         }
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
 
@@ -1060,19 +1071,22 @@
 
     void setUpLayers(BlendMode blendMode) {
         mLayers.clear();
-        std::vector<Color> topLayerPixelColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
-        ReadbackHelper::fillColorsArea(topLayerPixelColors, mDisplayWidth,
-                                       {0, 0, mDisplayWidth, mDisplayHeight}, mTopLayerColor);
+        std::vector<Color> topLayerPixelColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+        ReadbackHelper::fillColorsArea(topLayerPixelColors, getDisplayWidth(),
+                                       {0, 0, getDisplayWidth(), getDisplayHeight()},
+                                       mTopLayerColor);
 
-        auto backgroundLayer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
-        backgroundLayer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+        auto backgroundLayer =
+                std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
+        backgroundLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
         backgroundLayer->setZOrder(0);
         backgroundLayer->setColor(mBackgroundColor);
 
         auto layer = std::make_shared<TestBufferLayer>(
-                mComposerClient, mGraphicBuffer, *mTestRenderEngine, mPrimaryDisplay, mDisplayWidth,
-                mDisplayHeight, PixelFormat::RGBA_8888);
-        layer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+                mComposerClient, mGraphicBuffer, *mTestRenderEngine, getPrimaryDisplayId(),
+                getDisplayWidth(), getDisplayHeight(), PixelFormat::RGBA_8888);
+        layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
         layer->setZOrder(10);
         layer->setDataspace(Dataspace::UNKNOWN, mWriter);
         ASSERT_NO_FATAL_FAILURE(layer->setBuffer(topLayerPixelColors));
@@ -1086,7 +1100,8 @@
 
     void setExpectedColors(std::vector<Color>& expectedColors) {
         ASSERT_EQ(2, mLayers.size());
-        ReadbackHelper::clearColors(expectedColors, mDisplayWidth, mDisplayHeight, mDisplayWidth);
+        ReadbackHelper::clearColors(expectedColors, getDisplayWidth(), getDisplayHeight(),
+                                    getDisplayWidth());
 
         auto layer = mLayers[1];
         BlendMode blendMode = layer->getBlendMode();
@@ -1126,34 +1141,38 @@
 
 TEST_P(GraphicsBlendModeCompositionTest, None) {
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
 
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
 
         setBackgroundColor(BLACK);
         setTopLayerColor(TRANSLUCENT_RED);
         setUpLayers(BlendMode::NONE);
         setExpectedColors(expectedColors);
 
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
         writeLayers(mLayers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
 
@@ -1166,15 +1185,19 @@
 
 TEST_P(GraphicsBlendModeCompositionTest, Coverage) {
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
 
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
 
         setBackgroundColor(BLACK);
         setTopLayerColor(TRANSLUCENT_RED);
@@ -1182,19 +1205,19 @@
         setUpLayers(BlendMode::COVERAGE);
         setExpectedColors(expectedColors);
 
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
         writeLayers(mLayers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
@@ -1203,34 +1226,38 @@
 
 TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) {
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
 
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
 
         setBackgroundColor(BLACK);
         setTopLayerColor(TRANSLUCENT_RED);
         setUpLayers(BlendMode::PREMULTIPLIED);
         setExpectedColors(expectedColors);
 
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
         writeLayers(mLayers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
@@ -1245,18 +1272,20 @@
     void SetUp() override {
         GraphicsCompositionTest::SetUp();
 
-        auto backgroundLayer = std::make_shared<TestColorLayer>(mComposerClient, mPrimaryDisplay);
+        auto backgroundLayer =
+                std::make_shared<TestColorLayer>(mComposerClient, getPrimaryDisplayId());
         backgroundLayer->setColor({0.0f, 0.0f, 0.0f, 0.0f});
-        backgroundLayer->setDisplayFrame({0, 0, mDisplayWidth, mDisplayHeight});
+        backgroundLayer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()});
         backgroundLayer->setZOrder(0);
 
-        mSideLength = mDisplayWidth < mDisplayHeight ? mDisplayWidth : mDisplayHeight;
+        mSideLength =
+                getDisplayWidth() < getDisplayHeight() ? getDisplayWidth() : getDisplayHeight();
         common::Rect redRect = {0, 0, mSideLength / 2, mSideLength / 2};
         common::Rect blueRect = {mSideLength / 2, mSideLength / 2, mSideLength, mSideLength};
 
-        mLayer = std::make_shared<TestBufferLayer>(mComposerClient, mGraphicBuffer,
-                                                   *mTestRenderEngine, mPrimaryDisplay, mSideLength,
-                                                   mSideLength, PixelFormat::RGBA_8888);
+        mLayer = std::make_shared<TestBufferLayer>(
+                mComposerClient, mGraphicBuffer, *mTestRenderEngine, getPrimaryDisplayId(),
+                mSideLength, mSideLength, PixelFormat::RGBA_8888);
         mLayer->setDisplayFrame({0, 0, mSideLength, mSideLength});
         mLayer->setZOrder(10);
 
@@ -1275,41 +1304,44 @@
 
 TEST_P(GraphicsTransformCompositionTest, FLIP_H) {
     for (ColorMode mode : mTestColorModes) {
-        auto error =
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC);
-        if (!error.isOk() &&
-            (error.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED ||
-             error.getServiceSpecificError() == IComposerClient::EX_BAD_PARAMETER)) {
+        auto status = mComposerClient->setColorMode(getPrimaryDisplayId(), mode,
+                                                    RenderIntent::COLORIMETRIC);
+        if (!status.isOk() &&
+            (status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED ||
+             status.getServiceSpecificError() == IComposerClient::EX_BAD_PARAMETER)) {
             SUCCEED() << "ColorMode not supported, skip test";
             return;
         }
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
         mLayer->setTransform(Transform::FLIP_H);
         mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
 
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
                                        {mSideLength / 2, 0, mSideLength, mSideLength / 2}, RED);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
                                        {0, mSideLength / 2, mSideLength / 2, mSideLength}, BLUE);
 
         writeLayers(mLayers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
 
@@ -1322,36 +1354,40 @@
 
 TEST_P(GraphicsTransformCompositionTest, FLIP_V) {
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
 
         mLayer->setTransform(Transform::FLIP_V);
         mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
 
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
                                        {0, mSideLength / 2, mSideLength / 2, mSideLength}, RED);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
                                        {mSideLength / 2, 0, mSideLength, mSideLength / 2}, BLUE);
 
         writeLayers(mLayers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
@@ -1363,37 +1399,41 @@
 
 TEST_P(GraphicsTransformCompositionTest, ROT_180) {
     for (ColorMode mode : mTestColorModes) {
-        ASSERT_NO_FATAL_FAILURE(
-                mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC));
+        EXPECT_TRUE(mComposerClient
+                            ->setColorMode(getPrimaryDisplayId(), mode, RenderIntent::COLORIMETRIC)
+                            .isOk());
 
-        if (!getHasReadbackBuffer()) {
+        const auto& [readbackStatus, isSupported] = getHasReadbackBuffer();
+        EXPECT_TRUE(readbackStatus.isOk());
+        if (!isSupported) {
             GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace";
             return;
         }
-        ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth,
-                                      mDisplayHeight, mPixelFormat, mDataspace);
+        ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(),
+                                      getDisplayHeight(), mPixelFormat, mDataspace);
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer());
 
         mLayer->setTransform(Transform::ROT_180);
         mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter);
 
-        std::vector<Color> expectedColors(static_cast<size_t>(mDisplayWidth * mDisplayHeight));
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
+        std::vector<Color> expectedColors(
+                static_cast<size_t>(getDisplayWidth() * getDisplayHeight()));
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
                                        {mSideLength / 2, mSideLength / 2, mSideLength, mSideLength},
                                        RED);
-        ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth,
+        ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(),
                                        {0, 0, mSideLength / 2, mSideLength / 2}, BLUE);
 
         writeLayers(mLayers);
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.validateDisplay(mPrimaryDisplay, ComposerClientWriter::kNoTimestamp);
+        mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp);
         execute();
-        if (!mReader.takeChangedCompositionTypes(mPrimaryDisplay).empty()) {
+        if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) {
             GTEST_SUCCEED();
             return;
         }
         ASSERT_TRUE(mReader.takeErrors().empty());
-        mWriter.presentDisplay(mPrimaryDisplay);
+        mWriter.presentDisplay(getPrimaryDisplayId());
         execute();
         ASSERT_TRUE(mReader.takeErrors().empty());
         ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors));
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/ReadbackVts.cpp b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/ReadbackVts.cpp
index 587c523..1aca76f 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/ReadbackVts.cpp
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/ReadbackVts.cpp
@@ -14,19 +14,12 @@
  * limitations under the License.
  */
 
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wconversion"
-
 #include "include/ReadbackVts.h"
 #include <aidl/android/hardware/graphics/common/BufferUsage.h>
 #include "include/RenderEngineVts.h"
 #include "renderengine/ExternalTexture.h"
 #include "renderengine/impl/ExternalTexture.h"
 
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic pop  // ignored "-Wconversion
-
 namespace aidl::android::hardware::graphics::composer3::vts {
 
 const std::vector<ColorMode> ReadbackHelper::colorModes = {ColorMode::SRGB, ColorMode::DISPLAY_P3};
@@ -195,13 +188,12 @@
     }
 }
 
-ReadbackBuffer::ReadbackBuffer(int64_t display, const std::shared_ptr<IComposerClient>& client,
+ReadbackBuffer::ReadbackBuffer(int64_t display, const std::shared_ptr<VtsComposerClient>& client,
                                int32_t width, int32_t height, common::PixelFormat pixelFormat,
-                               common::Dataspace dataspace) {
+                               common::Dataspace dataspace)
+    : mComposerClient(client) {
     mDisplay = display;
 
-    mComposerClient = client;
-
     mPixelFormat = pixelFormat;
     mDataspace = dataspace;
 
@@ -227,23 +219,22 @@
     mGraphicBuffer = allocate();
     ASSERT_NE(nullptr, mGraphicBuffer);
     ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck());
-    aidl::android::hardware::common::NativeHandle bufferHandle =
-            ::android::dupToAidl(mGraphicBuffer->handle);
+    const auto& bufferHandle = mGraphicBuffer->handle;
     ::ndk::ScopedFileDescriptor fence = ::ndk::ScopedFileDescriptor(-1);
     EXPECT_TRUE(mComposerClient->setReadbackBuffer(mDisplay, bufferHandle, fence).isOk());
 }
 
-void ReadbackBuffer::checkReadbackBuffer(std::vector<Color> expectedColors) {
+void ReadbackBuffer::checkReadbackBuffer(const std::vector<Color>& expectedColors) {
     ASSERT_NE(nullptr, mGraphicBuffer);
     // lock buffer for reading
-    ndk::ScopedFileDescriptor fenceHandle;
-    EXPECT_TRUE(mComposerClient->getReadbackBufferFence(mDisplay, &fenceHandle).isOk());
+    const auto& [fenceStatus, bufferFence] = mComposerClient->getReadbackBufferFence(mDisplay);
+    EXPECT_TRUE(fenceStatus.isOk());
 
     int bytesPerPixel = -1;
     int bytesPerStride = -1;
     void* bufData = nullptr;
 
-    auto status = mGraphicBuffer->lockAsync(mUsage, mAccessRegion, &bufData, dup(fenceHandle.get()),
+    auto status = mGraphicBuffer->lockAsync(mUsage, mAccessRegion, &bufData, dup(bufferFence.get()),
                                             &bytesPerPixel, &bytesPerStride);
     EXPECT_EQ(::android::OK, status);
     ASSERT_TRUE(mPixelFormat == PixelFormat::RGB_888 || mPixelFormat == PixelFormat::RGBA_8888);
@@ -270,7 +261,7 @@
     return layerSettings;
 }
 
-TestBufferLayer::TestBufferLayer(const std::shared_ptr<IComposerClient>& client,
+TestBufferLayer::TestBufferLayer(const std::shared_ptr<VtsComposerClient>& client,
                                  const ::android::sp<::android::GraphicBuffer>& graphicBuffer,
                                  TestRenderEngine& renderEngine, int64_t display, uint32_t width,
                                  uint32_t height, common::PixelFormat format,
@@ -318,8 +309,8 @@
     const float translateY = mSourceCrop.top / (static_cast<float>(mHeight));
 
     layerSettings.source.buffer.textureTransform =
-            ::android::mat4::translate(::android::vec4(translateX, translateY, 0, 1.0)) *
-            ::android::mat4::scale(::android::vec4(scaleX, scaleY, 1.0, 1.0));
+            ::android::mat4::translate(::android::vec4(translateX, translateY, 0.0f, 1.0f)) *
+            ::android::mat4::scale(::android::vec4(scaleX, scaleY, 1.0f, 1.0f));
 
     return layerSettings;
 }
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/ReadbackVts.h b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/ReadbackVts.h
index da2e5c1..7135dca 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/ReadbackVts.h
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/ReadbackVts.h
@@ -16,10 +16,6 @@
 
 #pragma once
 
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wconversion"
-
 #include <aidl/android/hardware/graphics/composer3/IComposerClient.h>
 #include <android-base/unique_fd.h>
 #include <android/hardware/graphics/composer3/ComposerClientReader.h>
@@ -31,9 +27,6 @@
 #include "GraphicsComposerCallback.h"
 #include "VtsComposerClient.h"
 
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic pop  // ignored "-Wconversion
-
 namespace aidl::android::hardware::graphics::composer3::vts {
 
 using ::android::renderengine::LayerSettings;
@@ -56,9 +49,11 @@
 
 class TestLayer {
   public:
-    TestLayer(const std::shared_ptr<IComposerClient>& client, int64_t display)
-        : mDisplay(display), mComposerClient(client) {
-        client->createLayer(display, kBufferSlotCount, &mLayer);
+    TestLayer(const std::shared_ptr<VtsComposerClient>& client, int64_t display)
+        : mDisplay(display) {
+        const auto& [status, layer] = client->createLayer(display, kBufferSlotCount);
+        EXPECT_TRUE(status.isOk());
+        mLayer = layer;
     }
 
     // ComposerClient will take care of destroying layers, no need to explicitly
@@ -103,14 +98,11 @@
     float mAlpha = 1.0;
     BlendMode mBlendMode = BlendMode::NONE;
     uint32_t mZOrder = 0;
-
-  private:
-    std::shared_ptr<IComposerClient> const mComposerClient;
 };
 
 class TestColorLayer : public TestLayer {
   public:
-    TestColorLayer(const std::shared_ptr<IComposerClient>& client, int64_t display)
+    TestColorLayer(const std::shared_ptr<VtsComposerClient>& client, int64_t display)
         : TestLayer{client, display} {}
 
     void write(ComposerClientWriter& writer) override;
@@ -125,7 +117,7 @@
 
 class TestBufferLayer : public TestLayer {
   public:
-    TestBufferLayer(const std::shared_ptr<IComposerClient>& client,
+    TestBufferLayer(const std::shared_ptr<VtsComposerClient>& client,
                     const ::android::sp<::android::GraphicBuffer>& graphicBuffer,
                     TestRenderEngine& renderEngine, int64_t display, uint32_t width,
                     uint32_t height, common::PixelFormat format,
@@ -195,12 +187,12 @@
 
 class ReadbackBuffer {
   public:
-    ReadbackBuffer(int64_t display, const std::shared_ptr<IComposerClient>& client, int32_t width,
+    ReadbackBuffer(int64_t display, const std::shared_ptr<VtsComposerClient>& client, int32_t width,
                    int32_t height, common::PixelFormat pixelFormat, common::Dataspace dataspace);
 
     void setReadbackBuffer();
 
-    void checkReadbackBuffer(std::vector<Color> expectedColors);
+    void checkReadbackBuffer(const std::vector<Color>& expectedColors);
 
     ::android::sp<::android::GraphicBuffer> allocate();
 
@@ -213,7 +205,7 @@
     Dataspace mDataspace;
     int64_t mDisplay;
     ::android::sp<::android::GraphicBuffer> mGraphicBuffer;
-    std::shared_ptr<IComposerClient> mComposerClient;
+    std::shared_ptr<VtsComposerClient> mComposerClient;
     ::android::Rect mAccessRegion;
     native_handle_t mBufferHandle;
 };
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/RenderEngineVts.h b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/RenderEngineVts.h
index 4afac68..43d3a42 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/RenderEngineVts.h
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/vts/functional/composer-vts/include/RenderEngineVts.h
@@ -15,10 +15,6 @@
  */
 #pragma once
 
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wconversion"
-
 #include <mapper-vts/2.1/MapperVts.h>
 #include <math/half.h>
 #include <math/vec3.h>
@@ -31,9 +27,6 @@
 #include <ui/Region.h>
 #include "ReadbackVts.h"
 
-// TODO(b/129481165): remove the #pragma below and fix conversion issues
-#pragma clang diagnostic pop  // ignored "-Wconversion
-
 namespace aidl::android::hardware::graphics::composer3::vts {
 
 using ::android::hardware::graphics::mapper::V2_1::IMapper;