Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cd5e4698 authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

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
parent 8c292be7
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -303,6 +303,14 @@ bool Gralloc::isSupported(const IMapper::BufferDescriptorInfo& descriptorInfo) {
    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;
+4 −0
Original line number Diff line number Diff line
@@ -111,6 +111,10 @@ class Gralloc {

    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);

+1 −1
Original line number Diff line number Diff line
@@ -1220,7 +1220,7 @@ TEST_P(GraphicsMapperHidlTest, IsSupportedR8) {
            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";