From 2ee3317613d43900d9d2d7e124968c2387e34624 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Fri, 4 Aug 2023 21:59:23 +0000 Subject: [PATCH] Add API level for IMapper 4's bad metadata test Some devices shipped with broken validation for HDR metadata. Relax the test for vendor freeze purposes. Bug: 276843519 Test: VtsHalGraphicsMapperV4_0TargetTest Change-Id: I564f4bd12145f7831faa1e5a0f2d2abe074e4769 --- .../VtsHalGraphicsMapperV4_0TargetTest.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp index 03d9041fd2..bae362f04e 100644 --- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp +++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp @@ -2223,11 +2223,14 @@ TEST_P(GraphicsMapperHidlTest, SetBadMetadata) { // Keep optional metadata types below and populate the encoded metadata vec // with some arbitrary different metadata because the common gralloc4::decode*() // functions do not distinguish between an empty vec and bad value. - ASSERT_EQ(NO_ERROR, gralloc4::encodeDataspace(Dataspace::SRGB_LINEAR, &vec)); - ASSERT_EQ(Error::UNSUPPORTED, - mGralloc->set(bufferHandle, gralloc4::MetadataType_Smpte2086, vec)); - ASSERT_EQ(Error::UNSUPPORTED, - mGralloc->set(bufferHandle, gralloc4::MetadataType_Cta861_3, vec)); + if (base::GetIntProperty("ro.vendor.api_level", __ANDROID_API_FUTURE__) >= __ANDROID_API_T__) { + // Some old grallocs shipped with broken validation. + ASSERT_EQ(NO_ERROR, gralloc4::encodeDataspace(Dataspace::SRGB_LINEAR, &vec)); + ASSERT_EQ(Error::UNSUPPORTED, + mGralloc->set(bufferHandle, gralloc4::MetadataType_Smpte2086, vec)); + ASSERT_EQ(Error::UNSUPPORTED, + mGralloc->set(bufferHandle, gralloc4::MetadataType_Cta861_3, vec)); + } } /**