Add isSupportedNoFailure and call in IsSupportedR8
The upper layers will treat this failure as a lack of support, so make
the test do the same. This allows the test to pass on flame.
Bug: 219606432
Test: atest VtsHalGraphicsMapperV4_0TargetTest
Change-Id: I57eab60de81989cae59baa8c25b53a1c94229187
diff --git a/graphics/mapper/4.0/utils/vts/MapperVts.cpp b/graphics/mapper/4.0/utils/vts/MapperVts.cpp
index 5b2a94e..901f0e3 100644
--- a/graphics/mapper/4.0/utils/vts/MapperVts.cpp
+++ b/graphics/mapper/4.0/utils/vts/MapperVts.cpp
@@ -303,6 +303,14 @@
return supported;
}
+bool Gralloc::isSupportedNoFailure(const IMapper::BufferDescriptorInfo& descriptorInfo) {
+ bool supported = false;
+ mMapper->isSupported(descriptorInfo, [&](const auto& tmpError, const auto& tmpSupported) {
+ supported = tmpSupported && tmpError == Error::NONE;
+ });
+ return supported;
+}
+
Error Gralloc::get(const native_handle_t* bufferHandle, const IMapper::MetadataType& metadataType,
hidl_vec<uint8_t>* outVec) {
Error err;
diff --git a/graphics/mapper/4.0/utils/vts/include/mapper-vts/4.0/MapperVts.h b/graphics/mapper/4.0/utils/vts/include/mapper-vts/4.0/MapperVts.h
index 22a935f..c5406c9 100644
--- a/graphics/mapper/4.0/utils/vts/include/mapper-vts/4.0/MapperVts.h
+++ b/graphics/mapper/4.0/utils/vts/include/mapper-vts/4.0/MapperVts.h
@@ -111,6 +111,10 @@
bool isSupported(const IMapper::BufferDescriptorInfo& descriptorInfo);
+ // A version of isSupported that simply treats failure as no support, so it
+ // does not fail the test.
+ bool isSupportedNoFailure(const IMapper::BufferDescriptorInfo& descriptorInfo);
+
Error get(const native_handle_t* bufferHandle, const IMapper::MetadataType& metadataType,
hidl_vec<uint8_t>* outVec);
diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
index 5e012f6..463b565 100644
--- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
+++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
@@ -1220,7 +1220,7 @@
aidl::android::hardware::graphics::common::PixelFormat::R_8);
bool supported = false;
- ASSERT_NO_FATAL_FAILURE(supported = mGralloc->isSupported(info));
+ supported = mGralloc->isSupportedNoFailure(info);
if (!supported) {
GTEST_SUCCEED() << "R_8 is optional; unsupported so skipping allocation test";