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

Commit 6c564cfd authored by Lloyd Pique's avatar Lloyd Pique
Browse files

CE: Introduce Output::GetDisplayId()

Allow anyone with an Output interface pointer to get the displayId (if
any) associated with the output.

As the return value is optional, an output that does not have a
displayId can return std::nullopt

Test: atest libsurfaceflinger_unittest libcompositionengine_test
Test: go/wm-smoke
Bug: 121291683
Change-Id: Ie34da86aa4b55d11a291156e85dae678d7df5ee2
parent 10502f5a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -155,6 +155,9 @@ public:
    // constructor.
    virtual bool isValid() const = 0;

    // Returns the DisplayId the output represents, if it has one
    virtual std::optional<DisplayId> getDisplayId() const = 0;

    // Enables (or disables) composition on this output
    virtual void setCompositionEnabled(bool) = 0;

+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ public:
    virtual ~Display();

    // compositionengine::Output overrides
    std::optional<DisplayId> getDisplayId() const override;
    void dump(std::string&) const override;
    using compositionengine::impl::Output::setReleasedLayers;
    void setReleasedLayers(const CompositionRefreshArgs&) override;
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ public:

    // compositionengine::Output overrides
    bool isValid() const override;
    std::optional<DisplayId> getDisplayId() const override;
    void setCompositionEnabled(bool) override;
    void setProjection(const ui::Transform&, int32_t orientation, const Rect& frame,
                       const Rect& viewport, const Rect& scissor, bool needsFiltering) override;
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ public:
    virtual ~Output();

    MOCK_CONST_METHOD0(isValid, bool());
    MOCK_CONST_METHOD0(getDisplayId, std::optional<DisplayId>());

    MOCK_METHOD1(setCompositionEnabled, void(bool));
    MOCK_METHOD6(setProjection,
+4 −0
Original line number Diff line number Diff line
@@ -55,6 +55,10 @@ bool Display::isVirtual() const {
    return mIsVirtual;
}

std::optional<DisplayId> Display::getDisplayId() const {
    return mId;
}

void Display::disconnect() {
    if (!mId) {
        return;
Loading