OSDN Git Service

Surface: Permit an IProducerListener on connect
authorDan Stoza <stoza@google.com>
Tue, 3 Mar 2015 06:12:37 +0000 (22:12 -0800)
committerZhijun He <zhijunhe@google.com>
Tue, 24 Mar 2015 02:59:56 +0000 (19:59 -0700)
This change allows clients of Surface to provide an IProducerListener
callback object to Surface::connect, which will be passed down to the
underlying IGraphicBufferProducer

Change-Id: I5ea5229bf3a329bf02c6bd20e7247039c75d136b

include/gui/Surface.h
libs/gui/Surface.cpp

index f2cf018..5e752b5 100644 (file)
@@ -157,6 +157,7 @@ protected:
 
     virtual int lockBuffer_DEPRECATED(ANativeWindowBuffer* buffer);
 
+    virtual int connect(int api, const sp<IProducerListener>& listener);
     virtual int connect(int api);
     virtual int disconnect(int api);
     virtual int setBufferCount(int bufferCount);
index 0e2baa2..9bd0d0d 100644 (file)
@@ -546,9 +546,13 @@ int Surface::dispatchSetSidebandStream(va_list args) {
 }
 
 int Surface::connect(int api) {
+    static sp<IProducerListener> listener = new DummyProducerListener();
+    return connect(api, listener);
+}
+
+int Surface::connect(int api, const sp<IProducerListener>& listener) {
     ATRACE_CALL();
     ALOGV("Surface::connect");
-    static sp<IProducerListener> listener = new DummyProducerListener();
     Mutex::Autolock lock(mMutex);
     IGraphicBufferProducer::QueueBufferOutput output;
     int err = mGraphicBufferProducer->connect(listener, api, mProducerControlledByApp, &output);