summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Macnak <natsu@google.com>2022-05-11 21:56:30 +0000
committerAlec Mouri <alecmouri@google.com>2022-05-11 22:25:28 +0000
commit895d411403e9c4bcfa1c2cf212274ddfb985424a (patch)
treed643fe73e7082924ffd59557d833189b435ae3b2
parent59770b6f4fe0ceddc443f7407a8a00765607352a (diff)
Update Mapper4 SetBadMetadata VTS test for optional metadata
The common decode function for optional gralloc4 metadata `android::gralloc4::decodeOptionalMetadata()` treats an empty input `hidl_vec<uint8_t>` as `std::nullopt` and not a bad value. aosp/1907915 previously tried to update the encoding and decoding of optional metadata in order to distinguish this case but the change broke GRF. Instead, let's update the SetBadMetadata test to use some actual incorrect data for the optional metadata tests instead of an empty vec. Bug: b/207388558 Test: cvd start Test: VtsHalGraphicsMapperV4_0TargetTest Change-Id: I87c20930cb701e87c89489bd0359cce0522cfe44
-rw-r--r--graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
index 8f440e4d1e..2aac337ca7 100644
--- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
+++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
@@ -2212,6 +2212,11 @@ TEST_P(GraphicsMapperHidlTest, SetBadMetadata) {
mGralloc->set(bufferHandle, gralloc4::MetadataType_Dataspace, vec));
ASSERT_EQ(Error::UNSUPPORTED,
mGralloc->set(bufferHandle, gralloc4::MetadataType_BlendMode, vec));
+
+ // 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,