[Aidl graphics API] split dataspace array into tuples.

- update VTS test to make sure primaries/transfers/ranges bits are
  correct.

Bug: 242588489
Test: build and flash; atest VtsHalGraphicsComposer3_TargetTest

Change-Id: I77536d97b98e4dead208b7c8aeed9cfbb0d82316
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl
index 3db134e..7d31ea3 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl
@@ -38,6 +38,8 @@
   boolean supportMixedColorSpaces;
   parcelable SupportedBufferCombinations {
     android.hardware.graphics.common.PixelFormat[] pixelFormats;
-    android.hardware.graphics.common.Dataspace[] dataspaces;
+    android.hardware.graphics.common.Dataspace[] standards;
+    android.hardware.graphics.common.Dataspace[] transfers;
+    android.hardware.graphics.common.Dataspace[] ranges;
   }
 }
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl
index 32688e2..c25eea4 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl
@@ -19,16 +19,24 @@
 @VintfStability
 parcelable OverlayProperties {
     parcelable SupportedBufferCombinations {
-        // List of pixelformats and dataspaces that can be used together.
-        // All pixelformats and dataspaces stored inside are valid combinations.
+        // List of pixelformats, standards, transfers and ranges dataspaces that can be used
+        // together.
+        // The pixelformats, standards, transfers and ranges stored inside are valid
+        // combinations.
+        // Dataspace identifies three components of colors - standard, transfer and
+        // range.
         android.hardware.graphics.common.PixelFormat[] pixelFormats;
-        android.hardware.graphics.common.Dataspace[] dataspaces;
+        android.hardware.graphics.common.Dataspace[] standards;
+        android.hardware.graphics.common.Dataspace[] transfers;
+        android.hardware.graphics.common.Dataspace[] ranges;
     }
-    // Array of all valid pixelformat and dataspace combinations.
-    // If all supported formats work with all supported dataspaces,
+    // Array of all valid pixelformat, standard, transfer and range combinations.
+    // If all supported formats work with all standards, transfers and ranges,
     // then this list may only have 1 entry.
-    // If some dataspaces, e.g. scRGB, only work with specific formats,
-    // then this list may contain more than 1 entry.
+    // If some dataspaces, e.g. scRGB (STANDARD_BT709 | TRANSFER_SRGB | RANGE_EXTENDED),
+    // only work with specific formats, then this list may contain more than 1 entry.
+    // If some ranges, e.g. RANGE_LIMITED, only work with specific
+    // formats/standards/transfers, then this list may contain more than 1 entry.
     SupportedBufferCombinations[] combinations;
 
     // True if the DPU is able to color manage at least two overlays
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index 7b852e0..15128ca 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -812,7 +812,7 @@
 }
 
 TEST_P(GraphicsComposerAidlTest, GetOverlaySupport) {
-    const auto& [status, _] = mComposerClient->getOverlaySupport();
+    const auto& [status, properties] = mComposerClient->getOverlaySupport();
     if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC &&
         status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
         GTEST_SUCCEED() << "getOverlaySupport is not supported";
@@ -820,6 +820,23 @@
     }
 
     ASSERT_TRUE(status.isOk());
+    for (const auto& i : properties.combinations) {
+        for (const auto standard : i.standards) {
+            const auto val = static_cast<int32_t>(standard) &
+                             static_cast<int32_t>(common::Dataspace::STANDARD_MASK);
+            ASSERT_TRUE(val == static_cast<int32_t>(standard));
+        }
+        for (const auto transfer : i.transfers) {
+            const auto val = static_cast<int32_t>(transfer) &
+                             static_cast<int32_t>(common::Dataspace::TRANSFER_MASK);
+            ASSERT_TRUE(val == static_cast<int32_t>(transfer));
+        }
+        for (const auto range : i.ranges) {
+            const auto val = static_cast<int32_t>(range) &
+                             static_cast<int32_t>(common::Dataspace::RANGE_MASK);
+            ASSERT_TRUE(val == static_cast<int32_t>(range));
+        }
+    }
 }
 
 TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation_BadDisplay) {