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

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

Merge "[sf] Add layer metadata to HAL classes"

parents 500507c5 18d48cb0
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -1324,6 +1324,36 @@ V2_4::Error Composer::setContentType(Display display, IComposerClient::ContentTy
    return mClient_2_4->setContentType(display, contentType);
}

V2_4::Error Composer::setLayerGenericMetadata(Display display, Layer layer, const std::string& key,
                                              bool mandatory, const std::vector<uint8_t>& value) {
    using Error = V2_4::Error;
    if (!mClient_2_4) {
        return Error::UNSUPPORTED;
    }
    mWriter.selectDisplay(display);
    mWriter.selectLayer(layer);
    mWriter.setLayerGenericMetadata(key, mandatory, value);
    return Error::NONE;
}

V2_4::Error Composer::getLayerGenericMetadataKeys(
        std::vector<IComposerClient::LayerGenericMetadataKey>* outKeys) {
    using Error = V2_4::Error;
    if (!mClient_2_4) {
        return Error::UNSUPPORTED;
    }
    Error error = kDefaultError_2_4;
    mClient_2_4->getLayerGenericMetadataKeys([&](const auto& tmpError, const auto& tmpKeys) {
        error = tmpError;
        if (error != Error::NONE) {
            return;
        }

        *outKeys = tmpKeys;
    });
    return error;
}

CommandReader::~CommandReader()
{
    resetData();
+9 −0
Original line number Diff line number Diff line
@@ -228,6 +228,11 @@ public:
            std::vector<IComposerClient::ContentType>* outSupportedContentTypes) = 0;
    virtual V2_4::Error setContentType(Display displayId,
                                       IComposerClient::ContentType contentType) = 0;
    virtual V2_4::Error setLayerGenericMetadata(Display display, Layer layer,
                                                const std::string& key, bool mandatory,
                                                const std::vector<uint8_t>& value) = 0;
    virtual V2_4::Error getLayerGenericMetadataKeys(
            std::vector<IComposerClient::LayerGenericMetadataKey>* outKeys) = 0;
};

namespace impl {
@@ -463,6 +468,10 @@ public:
            std::vector<IComposerClient::ContentType>* outSupportedContentTypes) override;
    V2_4::Error setContentType(Display displayId,
                               IComposerClient::ContentType contentType) override;
    V2_4::Error setLayerGenericMetadata(Display display, Layer layer, const std::string& key,
                                        bool mandatory, const std::vector<uint8_t>& value) override;
    V2_4::Error getLayerGenericMetadataKeys(
            std::vector<IComposerClient::LayerGenericMetadataKey>* outKeys) override;

private:
#if defined(USE_VR_COMPOSER) && USE_VR_COMPOSER
+12 −0
Original line number Diff line number Diff line
@@ -789,6 +789,18 @@ V2_4::Error FakeComposerClient::validateDisplay_2_4(
    return V2_4::Error::NONE;
}

V2_4::Error FakeComposerClient::setLayerGenericMetadata(Display, Layer, const std::string&, bool,
                                                        const std::vector<uint8_t>&) {
    ALOGV("setLayerGenericMetadata");
    return V2_4::Error::UNSUPPORTED;
}

V2_4::Error FakeComposerClient::getLayerGenericMetadataKeys(
        std::vector<IComposerClient::LayerGenericMetadataKey>*) {
    ALOGV("getLayerGenericMetadataKeys");
    return V2_4::Error::UNSUPPORTED;
}

//////////////////////////////////////////////////////////////////

void FakeComposerClient::requestVSync(uint64_t vsyncTime) {
+4 −0
Original line number Diff line number Diff line
@@ -257,6 +257,10 @@ public:
            uint32_t* outDisplayRequestMask, std::vector<Layer>* outRequestedLayers,
            std::vector<uint32_t>* outRequestMasks,
            IComposerClient::ClientTargetProperty* outClientTargetProperty) override;
    V2_4::Error setLayerGenericMetadata(Display display, Layer layer, const std::string& key,
                                        bool mandatory, const std::vector<uint8_t>& value) override;
    V2_4::Error getLayerGenericMetadataKeys(
            std::vector<IComposerClient::LayerGenericMetadataKey>* outKeys) override;

    void setClient(ComposerClient* client);

+5 −0
Original line number Diff line number Diff line
@@ -134,6 +134,11 @@ public:
    MOCK_METHOD2(getSupportedContentTypes,
                 V2_4::Error(Display, std::vector<IComposerClient::ContentType>*));
    MOCK_METHOD2(setContentType, V2_4::Error(Display, IComposerClient::ContentType));
    MOCK_METHOD5(setLayerGenericMetadata,
                 V2_4::Error(Display, Layer, const std::string&, bool,
                             const std::vector<uint8_t>&));
    MOCK_METHOD1(getLayerGenericMetadataKeys,
                 V2_4::Error(std::vector<IComposerClient::LayerGenericMetadataKey>*));
};

} // namespace mock