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

Commit 412fd617 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add isSupportedNoFailure and call in IsSupportedR8"

parents b94529e5 cd5e4698
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";