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

Commit ea52d3c5 authored by Sungtak Lee's avatar Sungtak Lee Committed by Android Build Cherrypicker Worker
Browse files

Add missing IProducerListener callbacks to BLASTBufferQueue

Add IProducerListener::onBufferDetached and
IProducerListener::onBufferAttached to BLASTBufferQueue.

Bug: 353202582
Flag: com.android.graphics.libgui.flags.bq_consumer_attach_callback
Test: build
(cherry picked from https://android-review.googlesource.com/q/commit:7c935090e839ec3391c6f94d46a2367e59a46056)
Merged-In: I53f25354804bd777ce20410edebe8e7d6a213061
Change-Id: I53f25354804bd777ce20410edebe8e7d6a213061
parent e03c39c8
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1096,6 +1096,17 @@ public:
        AsyncWorker::getInstance().post(
                [listener = mListener, slots = slots]() { listener->onBuffersDiscarded(slots); });
    }

    void onBufferDetached(int slot) override {
        AsyncWorker::getInstance().post(
                [listener = mListener, slot = slot]() { listener->onBufferDetached(slot); });
    }

#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_CONSUMER_ATTACH_CALLBACK)
    void onBufferAttached() override {
        AsyncWorker::getInstance().post([listener = mListener]() { listener->onBufferAttached(); });
    }
#endif
};

// Extends the BufferQueueProducer to create a wrapper around the listener so the listener calls
+6 −0
Original line number Diff line number Diff line
@@ -184,4 +184,10 @@ bool BnProducerListener::needsReleaseNotify() {
void BnProducerListener::onBuffersDiscarded(const std::vector<int32_t>& /*discardedSlots*/) {
}

#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_CONSUMER_ATTACH_CALLBACK)
bool BnProducerListener::needsAttachNotify() {
    return true;
}
#endif

} // namespace android
+6 −0
Original line number Diff line number Diff line
@@ -90,6 +90,9 @@ public:
            Parcel* reply, uint32_t flags = 0);
    virtual bool needsReleaseNotify();
    virtual void onBuffersDiscarded(const std::vector<int32_t>& slots);
#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_CONSUMER_ATTACH_CALLBACK)
    virtual bool needsAttachNotify();
#endif
};

#else
@@ -103,6 +106,9 @@ public:
    virtual ~StubProducerListener();
    virtual void onBufferReleased() {}
    virtual bool needsReleaseNotify() { return false; }
#if COM_ANDROID_GRAPHICS_LIBGUI_FLAGS(BQ_CONSUMER_ATTACH_CALLBACK)
    virtual bool needsAttachNotify() { return false; }
#endif
};

} // namespace android