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

Commit 986b15a3 authored by Carlos Martinez Romero's avatar Carlos Martinez Romero
Browse files

Use SurfaceListener instead of IProducerListener

IProducerListener is being deprecated outside of libgui, we are limiting IGBP/IGBC usage outside of libgui to allow for future changes. See go/warren-buffers for more information.

Bug: 342199105
Test: atest CtsCameraTestCases:android.hardware.camera2.cts.ImageWriterTest
FLAG: EXEMPT no op refactor
Change-Id: I773a655c36c951adf3ef7e6bacf83032593c7438
parent f68c80b4
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@
#include <utils/String8.h>
#include <utils/Thread.h>

#include <gui/IProducerListener.h>
#include <gui/Surface.h>
#include <ui/PublicFormat.h>
#include <android_runtime/AndroidRuntime.h>
@@ -65,15 +64,18 @@ static struct {

// ----------------------------------------------------------------------------

class JNIImageWriterContext : public BnProducerListener {
class JNIImageWriterContext : public SurfaceListener {
public:
    JNIImageWriterContext(JNIEnv* env, jobject weakThiz, jclass clazz);

    virtual ~JNIImageWriterContext();

    // Implementation of IProducerListener, used to notify the ImageWriter that the consumer
    // Implementation of SurfaceListener, used to notify the ImageWriter that the consumer
    // has returned a buffer and it is ready for ImageWriter to dequeue.
    virtual void onBufferReleased();
    virtual bool needsReleaseNotify() override { return true; };
    virtual void onBuffersDiscarded(const std::vector<sp<GraphicBuffer>>& /*buffers*/) override {};
    virtual void onBufferDetached(int /*slot*/) override {};

    void setProducer(const sp<Surface>& producer) { mProducer = producer; }
    Surface* getProducer() { return mProducer.get(); }