Rename ISurfaceTexture and SurfaceTexture

The C++ class names don't match what the classes do, so rename
ISurfaceTexture to IGraphicBufferProducer, and SurfaceTexture to
GLConsumer.

Bug 7736700

Change-Id: Ia03e468888025b5cae3c0ee1995434515dbea387
diff --git a/libs/gui/Android.mk b/libs/gui/Android.mk
index 04444e9..b1aeb32 100644
--- a/libs/gui/Android.mk
+++ b/libs/gui/Android.mk
@@ -9,23 +9,23 @@
 	CpuConsumer.cpp \
 	DisplayEventReceiver.cpp \
 	DummyConsumer.cpp \
+	GLConsumer.cpp \
 	GraphicBufferAlloc.cpp \
 	GuiConfig.cpp \
 	IDisplayEventConnection.cpp \
 	IGraphicBufferAlloc.cpp \
+	IGraphicBufferProducer.cpp \
 	ISensorEventConnection.cpp \
 	ISensorServer.cpp \
 	ISurface.cpp \
 	ISurfaceComposer.cpp \
 	ISurfaceComposerClient.cpp \
-	ISurfaceTexture.cpp \
 	LayerState.cpp \
 	Sensor.cpp \
 	SensorEventQueue.cpp \
 	SensorManager.cpp \
 	Surface.cpp \
 	SurfaceComposerClient.cpp \
-	SurfaceTexture.cpp \
 	SurfaceTextureClient.cpp \
 
 LOCAL_SHARED_LIBRARIES := \
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index 609e7d2..4be655b 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -146,7 +146,7 @@
         Mutex::Autolock lock(mMutex);
 
         if (mAbandoned) {
-            ST_LOGE("setBufferCount: SurfaceTexture has been abandoned!");
+            ST_LOGE("setBufferCount: BufferQueue has been abandoned!");
             return NO_INIT;
         }
         if (bufferCount > NUM_BUFFER_SLOTS) {
@@ -200,7 +200,7 @@
     Mutex::Autolock lock(mMutex);
 
     if (mAbandoned) {
-        ST_LOGE("query: SurfaceTexture has been abandoned!");
+        ST_LOGE("query: BufferQueue has been abandoned!");
         return NO_INIT;
     }
 
@@ -233,7 +233,7 @@
     ST_LOGV("requestBuffer: slot=%d", slot);
     Mutex::Autolock lock(mMutex);
     if (mAbandoned) {
-        ST_LOGE("requestBuffer: SurfaceTexture has been abandoned!");
+        ST_LOGE("requestBuffer: BufferQueue has been abandoned!");
         return NO_INIT;
     }
     int maxBufferCount = getMaxBufferCountLocked();
@@ -282,7 +282,7 @@
         bool tryAgain = true;
         while (tryAgain) {
             if (mAbandoned) {
-                ST_LOGE("dequeueBuffer: SurfaceTexture has been abandoned!");
+                ST_LOGE("dequeueBuffer: BufferQueue has been abandoned!");
                 return NO_INIT;
             }
 
@@ -294,7 +294,7 @@
                 assert(mSlots[i].mBufferState == BufferSlot::FREE);
                 if (mSlots[i].mGraphicBuffer != NULL) {
                     freeBufferLocked(i);
-                    returnFlags |= ISurfaceTexture::RELEASE_ALL_BUFFERS;
+                    returnFlags |= IGraphicBufferProducer::RELEASE_ALL_BUFFERS;
                 }
             }
 
@@ -390,7 +390,7 @@
             mSlots[buf].mFence.clear();
             mSlots[buf].mEglDisplay = EGL_NO_DISPLAY;
 
-            returnFlags |= ISurfaceTexture::BUFFER_NEEDS_REALLOCATION;
+            returnFlags |= IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION;
         }
 
         dpy = mSlots[buf].mEglDisplay;
@@ -400,7 +400,7 @@
         mSlots[buf].mFence.clear();
     }  // end lock scope
 
-    if (returnFlags & ISurfaceTexture::BUFFER_NEEDS_REALLOCATION) {
+    if (returnFlags & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) {
         status_t error;
         sp<GraphicBuffer> graphicBuffer(
                 mGraphicBufferAlloc->createGraphicBuffer(
@@ -415,7 +415,7 @@
             Mutex::Autolock lock(mMutex);
 
             if (mAbandoned) {
-                ST_LOGE("dequeueBuffer: SurfaceTexture has been abandoned!");
+                ST_LOGE("dequeueBuffer: BufferQueue has been abandoned!");
                 return NO_INIT;
             }
 
@@ -449,7 +449,7 @@
     Mutex::Autolock lock(mMutex);
 
     if (mAbandoned) {
-        ST_LOGE("setSynchronousMode: SurfaceTexture has been abandoned!");
+        ST_LOGE("setSynchronousMode: BufferQueue has been abandoned!");
         return NO_INIT;
     }
 
@@ -498,7 +498,7 @@
     { // scope for the lock
         Mutex::Autolock lock(mMutex);
         if (mAbandoned) {
-            ST_LOGE("queueBuffer: SurfaceTexture has been abandoned!");
+            ST_LOGE("queueBuffer: BufferQueue has been abandoned!");
             return NO_INIT;
         }
         int maxBufferCount = getMaxBufferCountLocked();
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index 2e7c424..8f391aa 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -69,7 +69,7 @@
 
     status_t err = mBufferQueue->consumerConnect(proxy);
     if (err != NO_ERROR) {
-        CB_LOGE("SurfaceTexture: error connecting to BufferQueue: %s (%d)",
+        CB_LOGE("ConsumerBase: error connecting to BufferQueue: %s (%d)",
                 strerror(-err), err);
     } else {
         mBufferQueue->setConsumerName(mName);
@@ -233,4 +233,4 @@
     return err;
 }
 
-} // namespace android
\ No newline at end of file
+} // namespace android
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/GLConsumer.cpp
similarity index 88%
rename from libs/gui/SurfaceTexture.cpp
rename to libs/gui/GLConsumer.cpp
index ee3079e..ba23f9e 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/GLConsumer.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "SurfaceTexture"
+#define LOG_TAG "GLConsumer"
 #define ATRACE_TAG ATRACE_TAG_GRAPHICS
 //#define LOG_NDEBUG 0
 
@@ -31,7 +31,7 @@
 #include <gui/IGraphicBufferAlloc.h>
 #include <gui/ISurfaceComposer.h>
 #include <gui/SurfaceComposerClient.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
 
 #include <private/gui/ComposerService.h>
 
@@ -41,7 +41,7 @@
 
 namespace android {
 
-// This compile option makes SurfaceTexture use the
+// This compile option makes GLConsumer use the
 // EGL_ANDROID_native_fence_sync extension to create Android native fences to
 // signal when all GLES reads for a given buffer have completed.  It is not
 // compatible with using the EGL_KHR_fence_sync extension for the same
@@ -50,12 +50,12 @@
 #ifdef USE_FENCE_SYNC
 #error "USE_NATIVE_FENCE_SYNC and USE_FENCE_SYNC are incompatible"
 #endif
-const bool SurfaceTexture::sUseNativeFenceSync = true;
+const bool GLConsumer::sUseNativeFenceSync = true;
 #else
-const bool SurfaceTexture::sUseNativeFenceSync = false;
+const bool GLConsumer::sUseNativeFenceSync = false;
 #endif
 
-// This compile option makes SurfaceTexture use the EGL_ANDROID_sync_wait
+// This compile option makes GLConsumer use the EGL_ANDROID_sync_wait
 // extension to insert server-side waits into the GLES command stream.  This
 // feature requires the EGL_ANDROID_native_fence_sync and
 // EGL_ANDROID_wait_sync extensions.
@@ -65,7 +65,7 @@
 static const bool useWaitSync = false;
 #endif
 
-// Macros for including the SurfaceTexture name in log messages
+// Macros for including the GLConsumer name in log messages
 #define ST_LOGV(x, ...) ALOGV("[%s] "x, mName.string(), ##__VA_ARGS__)
 #define ST_LOGD(x, ...) ALOGD("[%s] "x, mName.string(), ##__VA_ARGS__)
 #define ST_LOGI(x, ...) ALOGI("[%s] "x, mName.string(), ##__VA_ARGS__)
@@ -113,7 +113,7 @@
 static void mtxMul(float out[16], const float a[16], const float b[16]);
 
 
-SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode,
+GLConsumer::GLConsumer(GLuint tex, bool allowSynchronousMode,
         GLenum texTarget, bool useFenceSync, const sp<BufferQueue> &bufferQueue) :
     ConsumerBase(bufferQueue == 0 ? new BufferQueue(allowSynchronousMode) : bufferQueue),
     mCurrentTransform(0),
@@ -131,7 +131,7 @@
     mCurrentTexture(BufferQueue::INVALID_BUFFER_SLOT),
     mAttached(true)
 {
-    ST_LOGV("SurfaceTexture");
+    ST_LOGV("GLConsumer");
 
     memcpy(mCurrentTransformMatrix, mtxIdentity,
             sizeof(mCurrentTransformMatrix));
@@ -139,13 +139,13 @@
     mBufferQueue->setConsumerUsageBits(DEFAULT_USAGE_FLAGS);
 }
 
-status_t SurfaceTexture::setDefaultMaxBufferCount(int bufferCount) {
+status_t GLConsumer::setDefaultMaxBufferCount(int bufferCount) {
     Mutex::Autolock lock(mMutex);
     return mBufferQueue->setDefaultMaxBufferCount(bufferCount);
 }
 
 
-status_t SurfaceTexture::setDefaultBufferSize(uint32_t w, uint32_t h)
+status_t GLConsumer::setDefaultBufferSize(uint32_t w, uint32_t h)
 {
     Mutex::Autolock lock(mMutex);
     mDefaultWidth = w;
@@ -153,13 +153,13 @@
     return mBufferQueue->setDefaultBufferSize(w, h);
 }
 
-status_t SurfaceTexture::updateTexImage() {
+status_t GLConsumer::updateTexImage() {
     ATRACE_CALL();
     ST_LOGV("updateTexImage");
     Mutex::Autolock lock(mMutex);
 
     if (mAbandoned) {
-        ST_LOGE("updateTexImage: SurfaceTexture is abandoned!");
+        ST_LOGE("updateTexImage: GLConsumer is abandoned!");
         return NO_INIT;
     }
 
@@ -200,7 +200,7 @@
     return bindTextureImageLocked();
 }
 
-status_t SurfaceTexture::acquireBufferLocked(BufferQueue::BufferItem *item) {
+status_t GLConsumer::acquireBufferLocked(BufferQueue::BufferItem *item) {
     status_t err = ConsumerBase::acquireBufferLocked(item);
     if (err != NO_ERROR) {
         return err;
@@ -223,7 +223,7 @@
     return NO_ERROR;
 }
 
-status_t SurfaceTexture::releaseBufferLocked(int buf, EGLDisplay display,
+status_t GLConsumer::releaseBufferLocked(int buf, EGLDisplay display,
        EGLSyncKHR eglFence) {
     status_t err = ConsumerBase::releaseBufferLocked(buf, display, eglFence);
 
@@ -232,12 +232,12 @@
     return err;
 }
 
-status_t SurfaceTexture::releaseAndUpdateLocked(const BufferQueue::BufferItem& item)
+status_t GLConsumer::releaseAndUpdateLocked(const BufferQueue::BufferItem& item)
 {
     status_t err = NO_ERROR;
 
     if (!mAttached) {
-        ST_LOGE("releaseAndUpdate: SurfaceTexture is not attached to an OpenGL "
+        ST_LOGE("releaseAndUpdate: GLConsumer is not attached to an OpenGL "
                 "ES context");
         return INVALID_OPERATION;
     }
@@ -293,7 +293,7 @@
         }
     }
 
-    // Update the SurfaceTexture state.
+    // Update the GLConsumer state.
     mCurrentTexture = buf;
     mCurrentTextureBuf = mSlots[buf].mGraphicBuffer;
     mCurrentCrop = item.mCrop;
@@ -307,7 +307,7 @@
     return err;
 }
 
-status_t SurfaceTexture::bindTextureImageLocked() {
+status_t GLConsumer::bindTextureImageLocked() {
     if (mEglDisplay == EGL_NO_DISPLAY) {
         ALOGE("bindTextureImage: invalid display");
         return INVALID_OPERATION;
@@ -345,7 +345,7 @@
 
 }
 
-status_t SurfaceTexture::checkAndUpdateEglStateLocked() {
+status_t GLConsumer::checkAndUpdateEglStateLocked() {
     EGLDisplay dpy = eglGetCurrentDisplay();
     EGLContext ctx = eglGetCurrentContext();
 
@@ -366,7 +366,7 @@
     return NO_ERROR;
 }
 
-void SurfaceTexture::setReleaseFence(int fenceFd) {
+void GLConsumer::setReleaseFence(int fenceFd) {
     sp<Fence> fence(new Fence(fenceFd));
     if (fenceFd == -1 || mCurrentTexture == BufferQueue::INVALID_BUFFER_SLOT)
         return;
@@ -377,18 +377,18 @@
     }
 }
 
-status_t SurfaceTexture::detachFromContext() {
+status_t GLConsumer::detachFromContext() {
     ATRACE_CALL();
     ST_LOGV("detachFromContext");
     Mutex::Autolock lock(mMutex);
 
     if (mAbandoned) {
-        ST_LOGE("detachFromContext: abandoned SurfaceTexture");
+        ST_LOGE("detachFromContext: abandoned GLConsumer");
         return NO_INIT;
     }
 
     if (!mAttached) {
-        ST_LOGE("detachFromContext: SurfaceTexture is not attached to a "
+        ST_LOGE("detachFromContext: GLConsumer is not attached to a "
                 "context");
         return INVALID_OPERATION;
     }
@@ -417,7 +417,7 @@
 
     // Because we're giving up the EGLDisplay we need to free all the EGLImages
     // that are associated with it.  They'll be recreated when the
-    // SurfaceTexture gets attached to a new OpenGL ES context (and thus gets a
+    // GLConsumer gets attached to a new OpenGL ES context (and thus gets a
     // new EGLDisplay).
     for (int i =0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) {
         EGLImageKHR img = mEglSlots[i].mEglImage;
@@ -434,18 +434,18 @@
     return OK;
 }
 
-status_t SurfaceTexture::attachToContext(GLuint tex) {
+status_t GLConsumer::attachToContext(GLuint tex) {
     ATRACE_CALL();
     ST_LOGV("attachToContext");
     Mutex::Autolock lock(mMutex);
 
     if (mAbandoned) {
-        ST_LOGE("attachToContext: abandoned SurfaceTexture");
+        ST_LOGE("attachToContext: abandoned GLConsumer");
         return NO_INIT;
     }
 
     if (mAttached) {
-        ST_LOGE("attachToContext: SurfaceTexture is already attached to a "
+        ST_LOGE("attachToContext: GLConsumer is already attached to a "
                 "context");
         return INVALID_OPERATION;
     }
@@ -469,7 +469,7 @@
 
     if (mCurrentTextureBuf != NULL) {
         // The EGLImageKHR that was associated with the slot was destroyed when
-        // the SurfaceTexture was detached from the old context, so we need to
+        // the GLConsumer was detached from the old context, so we need to
         // recreate it here.
         status_t err = bindUnslottedBufferLocked(dpy);
         if (err != NO_ERROR) {
@@ -485,7 +485,7 @@
     return OK;
 }
 
-status_t SurfaceTexture::bindUnslottedBufferLocked(EGLDisplay dpy) {
+status_t GLConsumer::bindUnslottedBufferLocked(EGLDisplay dpy) {
     ST_LOGV("bindUnslottedBuffer ct=%d ctb=%p",
             mCurrentTexture, mCurrentTextureBuf.get());
 
@@ -517,7 +517,7 @@
 }
 
 
-status_t SurfaceTexture::syncForReleaseLocked(EGLDisplay dpy) {
+status_t GLConsumer::syncForReleaseLocked(EGLDisplay dpy) {
     ST_LOGV("syncForReleaseLocked");
 
     if (mCurrentTexture != BufferQueue::INVALID_BUFFER_SLOT) {
@@ -580,7 +580,7 @@
     return OK;
 }
 
-bool SurfaceTexture::isExternalFormat(uint32_t format)
+bool GLConsumer::isExternalFormat(uint32_t format)
 {
     switch (format) {
     // supported YUV formats
@@ -599,19 +599,19 @@
     return false;
 }
 
-GLenum SurfaceTexture::getCurrentTextureTarget() const {
+GLenum GLConsumer::getCurrentTextureTarget() const {
     return mTexTarget;
 }
 
-void SurfaceTexture::getTransformMatrix(float mtx[16]) {
+void GLConsumer::getTransformMatrix(float mtx[16]) {
     Mutex::Autolock lock(mMutex);
     memcpy(mtx, mCurrentTransformMatrix, sizeof(mCurrentTransformMatrix));
 }
 
-void SurfaceTexture::setFilteringEnabled(bool enabled) {
+void GLConsumer::setFilteringEnabled(bool enabled) {
     Mutex::Autolock lock(mMutex);
     if (mAbandoned) {
-        ST_LOGE("setFilteringEnabled: SurfaceTexture is abandoned!");
+        ST_LOGE("setFilteringEnabled: GLConsumer is abandoned!");
         return;
     }
     bool needsRecompute = mFilteringEnabled != enabled;
@@ -626,7 +626,7 @@
     }
 }
 
-void SurfaceTexture::computeCurrentTransformMatrixLocked() {
+void GLConsumer::computeCurrentTransformMatrixLocked() {
     ST_LOGV("computeCurrentTransformMatrixLocked");
 
     float xform[16];
@@ -719,19 +719,19 @@
     mtxMul(mtxBeforeFlipV, crop, xform);
 
     // SurfaceFlinger expects the top of its window textures to be at a Y
-    // coordinate of 0, so SurfaceTexture must behave the same way.  We don't
+    // coordinate of 0, so GLConsumer must behave the same way.  We don't
     // want to expose this to applications, however, so we must add an
     // additional vertical flip to the transform after all the other transforms.
     mtxMul(mCurrentTransformMatrix, mtxFlipV, mtxBeforeFlipV);
 }
 
-nsecs_t SurfaceTexture::getTimestamp() {
+nsecs_t GLConsumer::getTimestamp() {
     ST_LOGV("getTimestamp");
     Mutex::Autolock lock(mMutex);
     return mCurrentTimestamp;
 }
 
-EGLImageKHR SurfaceTexture::createImage(EGLDisplay dpy,
+EGLImageKHR GLConsumer::createImage(EGLDisplay dpy,
         const sp<GraphicBuffer>& graphicBuffer) {
     EGLClientBuffer cbuf = (EGLClientBuffer)graphicBuffer->getNativeBuffer();
     EGLint attrs[] = {
@@ -747,12 +747,12 @@
     return image;
 }
 
-sp<GraphicBuffer> SurfaceTexture::getCurrentBuffer() const {
+sp<GraphicBuffer> GLConsumer::getCurrentBuffer() const {
     Mutex::Autolock lock(mMutex);
     return mCurrentTextureBuf;
 }
 
-Rect SurfaceTexture::getCurrentCrop() const {
+Rect GLConsumer::getCurrentCrop() const {
     Mutex::Autolock lock(mMutex);
 
     Rect outCrop = mCurrentCrop;
@@ -788,27 +788,27 @@
     return outCrop;
 }
 
-uint32_t SurfaceTexture::getCurrentTransform() const {
+uint32_t GLConsumer::getCurrentTransform() const {
     Mutex::Autolock lock(mMutex);
     return mCurrentTransform;
 }
 
-uint32_t SurfaceTexture::getCurrentScalingMode() const {
+uint32_t GLConsumer::getCurrentScalingMode() const {
     Mutex::Autolock lock(mMutex);
     return mCurrentScalingMode;
 }
 
-sp<Fence> SurfaceTexture::getCurrentFence() const {
+sp<Fence> GLConsumer::getCurrentFence() const {
     Mutex::Autolock lock(mMutex);
     return mCurrentFence;
 }
 
-status_t SurfaceTexture::doGLFenceWait() const {
+status_t GLConsumer::doGLFenceWait() const {
     Mutex::Autolock lock(mMutex);
     return doGLFenceWaitLocked();
 }
 
-status_t SurfaceTexture::doGLFenceWaitLocked() const {
+status_t GLConsumer::doGLFenceWaitLocked() const {
 
     EGLDisplay dpy = eglGetCurrentDisplay();
     EGLContext ctx = eglGetCurrentContext();
@@ -857,7 +857,7 @@
             }
         } else {
             status_t err = mCurrentFence->waitForever(1000,
-                    "SurfaceTexture::doGLFenceWaitLocked");
+                    "GLConsumer::doGLFenceWaitLocked");
             if (err != NO_ERROR) {
                 ST_LOGE("doGLFenceWait: error waiting for fence: %d", err);
                 return err;
@@ -868,12 +868,12 @@
     return NO_ERROR;
 }
 
-bool SurfaceTexture::isSynchronousMode() const {
+bool GLConsumer::isSynchronousMode() const {
     Mutex::Autolock lock(mMutex);
     return mBufferQueue->isSynchronousMode();
 }
 
-void SurfaceTexture::freeBufferLocked(int slotIndex) {
+void GLConsumer::freeBufferLocked(int slotIndex) {
     ST_LOGV("freeBufferLocked: slotIndex=%d", slotIndex);
     if (slotIndex == mCurrentTexture) {
         mCurrentTexture = BufferQueue::INVALID_BUFFER_SLOT;
@@ -887,42 +887,42 @@
     ConsumerBase::freeBufferLocked(slotIndex);
 }
 
-void SurfaceTexture::abandonLocked() {
+void GLConsumer::abandonLocked() {
     ST_LOGV("abandonLocked");
     mCurrentTextureBuf.clear();
     ConsumerBase::abandonLocked();
 }
 
-void SurfaceTexture::setName(const String8& name) {
+void GLConsumer::setName(const String8& name) {
     Mutex::Autolock _l(mMutex);
     mName = name;
     mBufferQueue->setConsumerName(name);
 }
 
-status_t SurfaceTexture::setDefaultBufferFormat(uint32_t defaultFormat) {
+status_t GLConsumer::setDefaultBufferFormat(uint32_t defaultFormat) {
     Mutex::Autolock lock(mMutex);
     return mBufferQueue->setDefaultBufferFormat(defaultFormat);
 }
 
-status_t SurfaceTexture::setConsumerUsageBits(uint32_t usage) {
+status_t GLConsumer::setConsumerUsageBits(uint32_t usage) {
     Mutex::Autolock lock(mMutex);
     usage |= DEFAULT_USAGE_FLAGS;
     return mBufferQueue->setConsumerUsageBits(usage);
 }
 
-status_t SurfaceTexture::setTransformHint(uint32_t hint) {
+status_t GLConsumer::setTransformHint(uint32_t hint) {
     Mutex::Autolock lock(mMutex);
     return mBufferQueue->setTransformHint(hint);
 }
 
-// Used for refactoring BufferQueue from SurfaceTexture
-// Should not be in final interface once users of SurfaceTexture are clean up.
-status_t SurfaceTexture::setSynchronousMode(bool enabled) {
+// Used for refactoring BufferQueue from GLConsumer
+// Should not be in final interface once users of GLConsumer are clean up.
+status_t GLConsumer::setSynchronousMode(bool enabled) {
     Mutex::Autolock lock(mMutex);
     return mBufferQueue->setSynchronousMode(enabled);
 }
 
-void SurfaceTexture::dumpLocked(String8& result, const char* prefix,
+void GLConsumer::dumpLocked(String8& result, const char* prefix,
         char* buffer, size_t size) const
 {
     snprintf(buffer, size,
diff --git a/libs/gui/ISurfaceTexture.cpp b/libs/gui/IGraphicBufferProducer.cpp
similarity index 82%
rename from libs/gui/ISurfaceTexture.cpp
rename to libs/gui/IGraphicBufferProducer.cpp
index a0b1e74..923e394 100644
--- a/libs/gui/ISurfaceTexture.cpp
+++ b/libs/gui/IGraphicBufferProducer.cpp
@@ -25,7 +25,7 @@
 #include <binder/Parcel.h>
 #include <binder/IInterface.h>
 
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
 
 namespace android {
 // ----------------------------------------------------------------------------
@@ -43,17 +43,17 @@
 };
 
 
-class BpSurfaceTexture : public BpInterface<ISurfaceTexture>
+class BpGraphicBufferProducer : public BpInterface<IGraphicBufferProducer>
 {
 public:
-    BpSurfaceTexture(const sp<IBinder>& impl)
-        : BpInterface<ISurfaceTexture>(impl)
+    BpGraphicBufferProducer(const sp<IBinder>& impl)
+        : BpInterface<IGraphicBufferProducer>(impl)
     {
     }
 
     virtual status_t requestBuffer(int bufferIdx, sp<GraphicBuffer>* buf) {
         Parcel data, reply;
-        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+        data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
         data.writeInt32(bufferIdx);
         status_t result =remote()->transact(REQUEST_BUFFER, data, &reply);
         if (result != NO_ERROR) {
@@ -71,7 +71,7 @@
     virtual status_t setBufferCount(int bufferCount)
     {
         Parcel data, reply;
-        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+        data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
         data.writeInt32(bufferCount);
         status_t result =remote()->transact(SET_BUFFER_COUNT, data, &reply);
         if (result != NO_ERROR) {
@@ -84,7 +84,7 @@
     virtual status_t dequeueBuffer(int *buf, sp<Fence>& fence,
             uint32_t w, uint32_t h, uint32_t format, uint32_t usage) {
         Parcel data, reply;
-        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+        data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
         data.writeInt32(w);
         data.writeInt32(h);
         data.writeInt32(format);
@@ -107,7 +107,7 @@
     virtual status_t queueBuffer(int buf,
             const QueueBufferInput& input, QueueBufferOutput* output) {
         Parcel data, reply;
-        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+        data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
         data.writeInt32(buf);
         data.write(input);
         status_t result = remote()->transact(QUEUE_BUFFER, data, &reply);
@@ -122,7 +122,7 @@
     virtual void cancelBuffer(int buf, sp<Fence> fence) {
         Parcel data, reply;
         bool hasFence = fence.get() && fence->isValid();
-        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+        data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
         data.writeInt32(buf);
         data.writeInt32(hasFence);
         if (hasFence) {
@@ -133,7 +133,7 @@
 
     virtual int query(int what, int* value) {
         Parcel data, reply;
-        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+        data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
         data.writeInt32(what);
         status_t result = remote()->transact(QUERY, data, &reply);
         if (result != NO_ERROR) {
@@ -146,7 +146,7 @@
 
     virtual status_t setSynchronousMode(bool enabled) {
         Parcel data, reply;
-        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+        data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
         data.writeInt32(enabled);
         status_t result = remote()->transact(SET_SYNCHRONOUS_MODE, data, &reply);
         if (result != NO_ERROR) {
@@ -158,7 +158,7 @@
 
     virtual status_t connect(int api, QueueBufferOutput* output) {
         Parcel data, reply;
-        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+        data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
         data.writeInt32(api);
         status_t result = remote()->transact(CONNECT, data, &reply);
         if (result != NO_ERROR) {
@@ -171,7 +171,7 @@
 
     virtual status_t disconnect(int api) {
         Parcel data, reply;
-        data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor());
+        data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor());
         data.writeInt32(api);
         status_t result =remote()->transact(DISCONNECT, data, &reply);
         if (result != NO_ERROR) {
@@ -182,16 +182,16 @@
     }
 };
 
-IMPLEMENT_META_INTERFACE(SurfaceTexture, "android.gui.SurfaceTexture");
+IMPLEMENT_META_INTERFACE(GraphicBufferProducer, "android.gui.SurfaceTexture");
 
 // ----------------------------------------------------------------------
 
-status_t BnSurfaceTexture::onTransact(
+status_t BnGraphicBufferProducer::onTransact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
 {
     switch(code) {
         case REQUEST_BUFFER: {
-            CHECK_INTERFACE(ISurfaceTexture, data, reply);
+            CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
             int bufferIdx   = data.readInt32();
             sp<GraphicBuffer> buffer;
             int result = requestBuffer(bufferIdx, &buffer);
@@ -203,14 +203,14 @@
             return NO_ERROR;
         } break;
         case SET_BUFFER_COUNT: {
-            CHECK_INTERFACE(ISurfaceTexture, data, reply);
+            CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
             int bufferCount = data.readInt32();
             int result = setBufferCount(bufferCount);
             reply->writeInt32(result);
             return NO_ERROR;
         } break;
         case DEQUEUE_BUFFER: {
-            CHECK_INTERFACE(ISurfaceTexture, data, reply);
+            CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
             uint32_t w      = data.readInt32();
             uint32_t h      = data.readInt32();
             uint32_t format = data.readInt32();
@@ -228,7 +228,7 @@
             return NO_ERROR;
         } break;
         case QUEUE_BUFFER: {
-            CHECK_INTERFACE(ISurfaceTexture, data, reply);
+            CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
             int buf = data.readInt32();
             QueueBufferInput input(data);
             QueueBufferOutput* const output =
@@ -239,7 +239,7 @@
             return NO_ERROR;
         } break;
         case CANCEL_BUFFER: {
-            CHECK_INTERFACE(ISurfaceTexture, data, reply);
+            CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
             int buf = data.readInt32();
             sp<Fence> fence;
             bool hasFence = data.readInt32();
@@ -251,7 +251,7 @@
             return NO_ERROR;
         } break;
         case QUERY: {
-            CHECK_INTERFACE(ISurfaceTexture, data, reply);
+            CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
             int value;
             int what = data.readInt32();
             int res = query(what, &value);
@@ -260,14 +260,14 @@
             return NO_ERROR;
         } break;
         case SET_SYNCHRONOUS_MODE: {
-            CHECK_INTERFACE(ISurfaceTexture, data, reply);
+            CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
             bool enabled = data.readInt32();
             status_t res = setSynchronousMode(enabled);
             reply->writeInt32(res);
             return NO_ERROR;
         } break;
         case CONNECT: {
-            CHECK_INTERFACE(ISurfaceTexture, data, reply);
+            CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
             int api = data.readInt32();
             QueueBufferOutput* const output =
                     reinterpret_cast<QueueBufferOutput *>(
@@ -277,7 +277,7 @@
             return NO_ERROR;
         } break;
         case DISCONNECT: {
-            CHECK_INTERFACE(ISurfaceTexture, data, reply);
+            CHECK_INTERFACE(IGraphicBufferProducer, data, reply);
             int api = data.readInt32();
             status_t res = disconnect(api);
             reply->writeInt32(res);
@@ -293,11 +293,11 @@
     return fence.get() && fence->isValid();
 }
 
-ISurfaceTexture::QueueBufferInput::QueueBufferInput(const Parcel& parcel) {
+IGraphicBufferProducer::QueueBufferInput::QueueBufferInput(const Parcel& parcel) {
     parcel.read(*this);
 }
 
-size_t ISurfaceTexture::QueueBufferInput::getFlattenedSize() const
+size_t IGraphicBufferProducer::QueueBufferInput::getFlattenedSize() const
 {
     return sizeof(timestamp)
          + sizeof(crop)
@@ -307,12 +307,12 @@
          + (isValid(fence) ? fence->getFlattenedSize() : 0);
 }
 
-size_t ISurfaceTexture::QueueBufferInput::getFdCount() const
+size_t IGraphicBufferProducer::QueueBufferInput::getFdCount() const
 {
     return isValid(fence) ? fence->getFdCount() : 0;
 }
 
-status_t ISurfaceTexture::QueueBufferInput::flatten(void* buffer, size_t size,
+status_t IGraphicBufferProducer::QueueBufferInput::flatten(void* buffer, size_t size,
         int fds[], size_t count) const
 {
     status_t err = NO_ERROR;
@@ -329,7 +329,7 @@
     return err;
 }
 
-status_t ISurfaceTexture::QueueBufferInput::unflatten(void const* buffer,
+status_t IGraphicBufferProducer::QueueBufferInput::unflatten(void const* buffer,
         size_t size, int fds[], size_t count)
 {
     status_t err = NO_ERROR;
diff --git a/libs/gui/ISurface.cpp b/libs/gui/ISurface.cpp
index c2ea183..8c25f45 100644
--- a/libs/gui/ISurface.cpp
+++ b/libs/gui/ISurface.cpp
@@ -23,7 +23,7 @@
 #include <binder/Parcel.h>
 
 #include <gui/ISurface.h>
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
 
 namespace android {
 
@@ -37,11 +37,11 @@
     {
     }
 
-    virtual sp<ISurfaceTexture> getSurfaceTexture() const {
+    virtual sp<IGraphicBufferProducer> getSurfaceTexture() const {
         Parcel data, reply;
         data.writeInterfaceToken(ISurface::getInterfaceDescriptor());
         remote()->transact(GET_SURFACE_TEXTURE, data, &reply);
-        return interface_cast<ISurfaceTexture>(reply.readStrongBinder());
+        return interface_cast<IGraphicBufferProducer>(reply.readStrongBinder());
     }
 };
 
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 85a9488..72b6277 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -28,7 +28,7 @@
 #include <gui/BitTube.h>
 #include <gui/IDisplayEventConnection.h>
 #include <gui/ISurfaceComposer.h>
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
 
 #include <private/gui/LayerState.h>
 
@@ -124,7 +124,7 @@
     }
 
     virtual bool authenticateSurfaceTexture(
-            const sp<ISurfaceTexture>& surfaceTexture) const
+            const sp<IGraphicBufferProducer>& bufferProducer) const
     {
         Parcel data, reply;
         int err = NO_ERROR;
@@ -135,7 +135,7 @@
                     "interface descriptor: %s (%d)", strerror(-err), -err);
             return false;
         }
-        err = data.writeStrongBinder(surfaceTexture->asBinder());
+        err = data.writeStrongBinder(bufferProducer->asBinder());
         if (err != NO_ERROR) {
             ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing "
                     "strong binder to parcel: %s (%d)", strerror(-err), -err);
@@ -288,9 +288,9 @@
         } break;
         case AUTHENTICATE_SURFACE: {
             CHECK_INTERFACE(ISurfaceComposer, data, reply);
-            sp<ISurfaceTexture> surfaceTexture =
-                    interface_cast<ISurfaceTexture>(data.readStrongBinder());
-            int32_t result = authenticateSurfaceTexture(surfaceTexture) ? 1 : 0;
+            sp<IGraphicBufferProducer> bufferProducer =
+                    interface_cast<IGraphicBufferProducer>(data.readStrongBinder());
+            int32_t result = authenticateSurfaceTexture(bufferProducer) ? 1 : 0;
             reply->writeInt32(result);
         } break;
         case CREATE_DISPLAY_EVENT_CONNECTION: {
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index e2604f8..5e5edcd 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -17,7 +17,7 @@
 #include <utils/Errors.h>
 #include <binder/Parcel.h>
 #include <gui/ISurfaceComposerClient.h>
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
 #include <private/gui/LayerState.h>
 
 namespace android {
@@ -74,7 +74,7 @@
 
 status_t DisplayState::read(const Parcel& input) {
     token = input.readStrongBinder();
-    surface = interface_cast<ISurfaceTexture>(input.readStrongBinder());
+    surface = interface_cast<IGraphicBufferProducer>(input.readStrongBinder());
     what = input.readInt32();
     layerStack = input.readInt32();
     orientation = input.readInt32();
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 1745061..51d37b3 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -179,7 +179,7 @@
         identity = control->mIdentity;
     }
     parcel->writeStrongBinder(sur!=0 ? sur->asBinder() : NULL);
-    parcel->writeStrongBinder(NULL);  // NULL ISurfaceTexture in this case.
+    parcel->writeStrongBinder(NULL);  // NULL IGraphicBufferProducer in this case.
     parcel->writeInt32(identity);
     return NO_ERROR;
 }
@@ -205,7 +205,7 @@
       mSurface(surface->mSurface),
       mIdentity(surface->mIdentity)
 {
-    sp<ISurfaceTexture> st;
+    sp<IGraphicBufferProducer> st;
     if (mSurface != NULL) {
         st = mSurface->getSurfaceTexture();
     }
@@ -217,9 +217,9 @@
 {
     mSurface = interface_cast<ISurface>(ref);
     sp<IBinder> st_binder(parcel.readStrongBinder());
-    sp<ISurfaceTexture> st;
+    sp<IGraphicBufferProducer> st;
     if (st_binder != NULL) {
-        st = interface_cast<ISurfaceTexture>(st_binder);
+        st = interface_cast<IGraphicBufferProducer>(st_binder);
     } else if (mSurface != NULL) {
         st = mSurface->getSurfaceTexture();
     }
@@ -228,7 +228,7 @@
     init(st);
 }
 
-Surface::Surface(const sp<ISurfaceTexture>& st)
+Surface::Surface(const sp<IGraphicBufferProducer>& st)
     : SurfaceTextureClient(),
       mSurface(NULL),
       mIdentity(0)
@@ -240,7 +240,7 @@
         const sp<Surface>& surface, Parcel* parcel)
 {
     sp<ISurface> sur;
-    sp<ISurfaceTexture> st;
+    sp<IGraphicBufferProducer> st;
     uint32_t identity = 0;
     if (Surface::isValid(surface)) {
         sur      = surface->mSurface;
@@ -249,8 +249,8 @@
     } else if (surface != 0 &&
             (surface->mSurface != NULL ||
              surface->getISurfaceTexture() != NULL)) {
-        ALOGE("Parceling invalid surface with non-NULL ISurface/ISurfaceTexture as NULL: "
-             "mSurface = %p, surfaceTexture = %p, mIdentity = %d, ",
+        ALOGE("Parceling invalid surface with non-NULL ISurface/IGraphicBufferProducer "
+             "as NULL: mSurface = %p, bufferProducer = %p, mIdentity = %d, ",
              surface->mSurface.get(), surface->getISurfaceTexture().get(),
              surface->mIdentity);
     }
@@ -275,7 +275,7 @@
     } else {
         // The Surface was found in the cache, but we still should clear any
         // remaining data from the parcel.
-        data.readStrongBinder();  // ISurfaceTexture
+        data.readStrongBinder();  // IGraphicBufferProducer
         data.readInt32();         // identity
     }
     if (surface->mSurface == NULL && surface->getISurfaceTexture() == NULL) {
@@ -296,12 +296,12 @@
     }
 }
 
-void Surface::init(const sp<ISurfaceTexture>& surfaceTexture)
+void Surface::init(const sp<IGraphicBufferProducer>& bufferProducer)
 {
-    if (mSurface != NULL || surfaceTexture != NULL) {
-        ALOGE_IF(surfaceTexture==0, "got a NULL ISurfaceTexture from ISurface");
-        if (surfaceTexture != NULL) {
-            setISurfaceTexture(surfaceTexture);
+    if (mSurface != NULL || bufferProducer != NULL) {
+        ALOGE_IF(bufferProducer==0, "got a NULL IGraphicBufferProducer from ISurface");
+        if (bufferProducer != NULL) {
+            setISurfaceTexture(bufferProducer);
             setUsage(GraphicBuffer::USAGE_HW_RENDER);
         }
 
@@ -328,7 +328,7 @@
     return getISurfaceTexture() != NULL;
 }
 
-sp<ISurfaceTexture> Surface::getSurfaceTexture() {
+sp<IGraphicBufferProducer> Surface::getSurfaceTexture() {
     return getISurfaceTexture();
 }
 
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 746057b..0c6881a 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -157,7 +157,8 @@
     status_t setLayerStack(const sp<SurfaceComposerClient>& client,
             SurfaceID id, uint32_t layerStack);
 
-    void setDisplaySurface(const sp<IBinder>& token, const sp<ISurfaceTexture>& surface);
+    void setDisplaySurface(const sp<IBinder>& token,
+            const sp<IGraphicBufferProducer>& bufferProducer);
     void setDisplayLayerStack(const sp<IBinder>& token, uint32_t layerStack);
     void setDisplayProjection(const sp<IBinder>& token,
             uint32_t orientation,
@@ -386,10 +387,10 @@
 }
 
 void Composer::setDisplaySurface(const sp<IBinder>& token,
-        const sp<ISurfaceTexture>& surface) {
+        const sp<IGraphicBufferProducer>& bufferProducer) {
     Mutex::Autolock _l(mLock);
     DisplayState& s(getDisplayStateLocked(token));
-    s.surface = surface;
+    s.surface = bufferProducer;
     s.what |= DisplayState::eSurfaceChanged;
 }
 
@@ -571,8 +572,8 @@
 // ----------------------------------------------------------------------------
 
 void SurfaceComposerClient::setDisplaySurface(const sp<IBinder>& token,
-        const sp<ISurfaceTexture>& surface) {
-    Composer::getInstance().setDisplaySurface(token, surface);
+        const sp<IGraphicBufferProducer>& bufferProducer) {
+    Composer::getInstance().setDisplaySurface(token, bufferProducer);
 }
 
 void SurfaceComposerClient::setDisplayLayerStack(const sp<IBinder>& token,
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index 7588b9e..c015b81 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -27,7 +27,7 @@
 
 #include <gui/ISurfaceComposer.h>
 #include <gui/SurfaceComposerClient.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
 #include <gui/SurfaceTextureClient.h>
 
 #include <private/gui/ComposerService.h>
@@ -35,10 +35,10 @@
 namespace android {
 
 SurfaceTextureClient::SurfaceTextureClient(
-        const sp<ISurfaceTexture>& surfaceTexture)
+        const sp<IGraphicBufferProducer>& bufferProducer)
 {
     SurfaceTextureClient::init();
-    SurfaceTextureClient::setISurfaceTexture(surfaceTexture);
+    SurfaceTextureClient::setISurfaceTexture(bufferProducer);
 }
 
 SurfaceTextureClient::SurfaceTextureClient() {
@@ -86,12 +86,12 @@
 }
 
 void SurfaceTextureClient::setISurfaceTexture(
-        const sp<ISurfaceTexture>& surfaceTexture)
+        const sp<IGraphicBufferProducer>& bufferProducer)
 {
-    mSurfaceTexture = surfaceTexture;
+    mSurfaceTexture = bufferProducer;
 }
 
-sp<ISurfaceTexture> SurfaceTextureClient::getISurfaceTexture() const {
+sp<IGraphicBufferProducer> SurfaceTextureClient::getISurfaceTexture() const {
     return mSurfaceTexture;
 }
 
@@ -197,20 +197,20 @@
     status_t result = mSurfaceTexture->dequeueBuffer(&buf, fence, reqW, reqH,
             mReqFormat, mReqUsage);
     if (result < 0) {
-        ALOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)"
+        ALOGV("dequeueBuffer: IGraphicBufferProducer::dequeueBuffer(%d, %d, %d, %d)"
              "failed: %d", mReqWidth, mReqHeight, mReqFormat, mReqUsage,
              result);
         return result;
     }
     sp<GraphicBuffer>& gbuf(mSlots[buf].buffer);
-    if (result & ISurfaceTexture::RELEASE_ALL_BUFFERS) {
+    if (result & IGraphicBufferProducer::RELEASE_ALL_BUFFERS) {
         freeAllBuffers();
     }
 
-    if ((result & ISurfaceTexture::BUFFER_NEEDS_REALLOCATION) || gbuf == 0) {
+    if ((result & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) || gbuf == 0) {
         result = mSurfaceTexture->requestBuffer(buf, &gbuf);
         if (result != NO_ERROR) {
-            ALOGE("dequeueBuffer: ISurfaceTexture::requestBuffer failed: %d",
+            ALOGE("dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: %d",
                     result);
             return result;
         }
@@ -288,8 +288,8 @@
     mCrop.intersect(Rect(buffer->width, buffer->height), &crop);
 
     sp<Fence> fence(fenceFd >= 0 ? new Fence(fenceFd) : NULL);
-    ISurfaceTexture::QueueBufferOutput output;
-    ISurfaceTexture::QueueBufferInput input(timestamp, crop, mScalingMode,
+    IGraphicBufferProducer::QueueBufferOutput output;
+    IGraphicBufferProducer::QueueBufferInput input(timestamp, crop, mScalingMode,
             mTransform, fence);
     status_t err = mSurfaceTexture->queueBuffer(i, input, &output);
     if (err != OK)  {
@@ -497,7 +497,7 @@
     ATRACE_CALL();
     ALOGV("SurfaceTextureClient::connect");
     Mutex::Autolock lock(mMutex);
-    ISurfaceTexture::QueueBufferOutput output;
+    IGraphicBufferProducer::QueueBufferOutput output;
     int err = mSurfaceTexture->connect(api, &output);
     if (err == NO_ERROR) {
         uint32_t numPendingBuffers = 0;
@@ -566,7 +566,7 @@
     Mutex::Autolock lock(mMutex);
 
     status_t err = mSurfaceTexture->setBufferCount(bufferCount);
-    ALOGE_IF(err, "ISurfaceTexture::setBufferCount(%d) returned %s",
+    ALOGE_IF(err, "IGraphicBufferProducer::setBufferCount(%d) returned %s",
             bufferCount, strerror(-err));
 
     if (err == NO_ERROR) {
diff --git a/libs/gui/tests/BufferQueue_test.cpp b/libs/gui/tests/BufferQueue_test.cpp
index 817abb4..12cbfb0 100644
--- a/libs/gui/tests/BufferQueue_test.cpp
+++ b/libs/gui/tests/BufferQueue_test.cpp
@@ -63,19 +63,19 @@
 TEST_F(BufferQueueTest, AcquireBuffer_ExceedsMaxAcquireCount_Fails) {
     sp<DummyConsumer> dc(new DummyConsumer);
     mBQ->consumerConnect(dc);
-    ISurfaceTexture::QueueBufferOutput qbo;
+    IGraphicBufferProducer::QueueBufferOutput qbo;
     mBQ->connect(NATIVE_WINDOW_API_CPU, &qbo);
     mBQ->setBufferCount(4);
 
     int slot;
     sp<Fence> fence;
     sp<GraphicBuffer> buf;
-    ISurfaceTexture::QueueBufferInput qbi(0, Rect(0, 0, 1, 1),
+    IGraphicBufferProducer::QueueBufferInput qbi(0, Rect(0, 0, 1, 1),
             NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, fence);
     BufferQueue::BufferItem item;
 
     for (int i = 0; i < 2; i++) {
-        ASSERT_EQ(ISurfaceTexture::BUFFER_NEEDS_REALLOCATION,
+        ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION,
                 mBQ->dequeueBuffer(&slot, fence, 1, 1, 0,
                     GRALLOC_USAGE_SW_READ_OFTEN));
         ASSERT_EQ(OK, mBQ->requestBuffer(slot, &buf));
@@ -83,7 +83,7 @@
         ASSERT_EQ(OK, mBQ->acquireBuffer(&item));
     }
 
-    ASSERT_EQ(ISurfaceTexture::BUFFER_NEEDS_REALLOCATION,
+    ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION,
             mBQ->dequeueBuffer(&slot, fence, 1, 1, 0,
                 GRALLOC_USAGE_SW_READ_OFTEN));
     ASSERT_EQ(OK, mBQ->requestBuffer(slot, &buf));
diff --git a/libs/gui/tests/SurfaceTextureClient_test.cpp b/libs/gui/tests/SurfaceTextureClient_test.cpp
index baeca06..2df83a0 100644
--- a/libs/gui/tests/SurfaceTextureClient_test.cpp
+++ b/libs/gui/tests/SurfaceTextureClient_test.cpp
@@ -40,7 +40,7 @@
         ALOGV("Begin test: %s.%s", testInfo->test_case_name(),
                 testInfo->name());
 
-        mST = new SurfaceTexture(123);
+        mST = new GLConsumer(123);
         mSTC = new SurfaceTextureClient(mST->getBufferQueue());
         mANW = mSTC;
 
@@ -102,7 +102,7 @@
         return sDefaultConfigAttribs;
     }
 
-    sp<SurfaceTexture> mST;
+    sp<GLConsumer> mST;
     sp<SurfaceTextureClient> mSTC;
     sp<ANativeWindow> mANW;
 
@@ -112,7 +112,7 @@
 };
 
 TEST_F(SurfaceTextureClientTest, GetISurfaceTextureIsNotNull) {
-    sp<ISurfaceTexture> ist(mSTC->getISurfaceTexture());
+    sp<IGraphicBufferProducer> ist(mSTC->getISurfaceTexture());
     ASSERT_TRUE(ist != NULL);
 }
 
@@ -250,7 +250,7 @@
 }
 
 TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSize) {
-    sp<SurfaceTexture> st(mST);
+    sp<GLConsumer> st(mST);
     ANativeWindowBuffer* buf;
     EXPECT_EQ(OK, st->setDefaultBufferSize(16, 8));
     ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf));
@@ -464,7 +464,7 @@
 // from the SurfaceTexture class.
 TEST_F(SurfaceTextureClientTest, DISABLED_SurfaceTextureSyncModeWaitRetire) {
     class MyThread : public Thread {
-        sp<SurfaceTexture> mST;
+        sp<GLConsumer> mST;
         EGLContext ctx;
         EGLSurface sur;
         EGLDisplay dpy;
@@ -480,7 +480,7 @@
             return false;
         }
     public:
-        MyThread(const sp<SurfaceTexture>& mST)
+        MyThread(const sp<GLConsumer>& mST)
             : mST(mST), mBufferRetired(false) {
             ctx = eglGetCurrentContext();
             sur = eglGetCurrentSurface(EGL_DRAW);
@@ -685,7 +685,7 @@
         ASSERT_NE(EGL_NO_CONTEXT, mEglContext);
 
         for (int i = 0; i < NUM_SURFACE_TEXTURES; i++) {
-            sp<SurfaceTexture> st(new SurfaceTexture(i));
+            sp<GLConsumer> st(new GLConsumer(i));
             sp<SurfaceTextureClient> stc(new SurfaceTextureClient(st->getBufferQueue()));
             mEglSurfaces[i] = eglCreateWindowSurface(mEglDisplay, myConfig,
                     static_cast<ANativeWindow*>(stc.get()), NULL);
diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp
index 58976ad..b6020ca 100644
--- a/libs/gui/tests/SurfaceTexture_test.cpp
+++ b/libs/gui/tests/SurfaceTexture_test.cpp
@@ -18,7 +18,7 @@
 //#define LOG_NDEBUG 0
 
 #include <gtest/gtest.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
 #include <gui/SurfaceTextureClient.h>
 #include <ui/GraphicBuffer.h>
 #include <utils/String8.h>
@@ -384,7 +384,7 @@
 
     virtual void SetUp() {
         GLTest::SetUp();
-        mST = new SurfaceTexture(TEX_ID);
+        mST = new GLConsumer(TEX_ID);
         mSTC = new SurfaceTextureClient(mST->getBufferQueue());
         mANW = mSTC;
         mTextureRenderer = new TextureRenderer(TEX_ID, mST);
@@ -406,7 +406,7 @@
 
     class TextureRenderer: public RefBase {
     public:
-        TextureRenderer(GLuint texName, const sp<SurfaceTexture>& st):
+        TextureRenderer(GLuint texName, const sp<GLConsumer>& st):
                 mTexName(texName),
                 mST(st) {
         }
@@ -447,7 +447,7 @@
             ASSERT_NE(-1, mTexMatrixHandle);
         }
 
-        // drawTexture draws the SurfaceTexture over the entire GL viewport.
+        // drawTexture draws the GLConsumer over the entire GL viewport.
         void drawTexture() {
             static const GLfloat triangleVertices[] = {
                 -1.0f, 1.0f,
@@ -494,14 +494,14 @@
         }
 
         GLuint mTexName;
-        sp<SurfaceTexture> mST;
+        sp<GLConsumer> mST;
         GLuint mPgm;
         GLint mPositionHandle;
         GLint mTexSamplerHandle;
         GLint mTexMatrixHandle;
     };
 
-    class FrameWaiter : public SurfaceTexture::FrameAvailableListener {
+    class FrameWaiter : public GLConsumer::FrameAvailableListener {
     public:
         FrameWaiter():
                 mPendingFrames(0) {
@@ -526,7 +526,7 @@
         Condition mCondition;
     };
 
-    // Note that SurfaceTexture will lose the notifications
+    // Note that GLConsumer will lose the notifications
     // onBuffersReleased and onFrameAvailable as there is currently
     // no way to forward the events.  This DisconnectWaiter will not let the
     // disconnect finish until finishDisconnect() is called.  It will
@@ -575,7 +575,7 @@
         Condition mFrameCondition;
     };
 
-    sp<SurfaceTexture> mST;
+    sp<GLConsumer> mST;
     sp<SurfaceTextureClient> mSTC;
     sp<ANativeWindow> mANW;
     sp<TextureRenderer> mTextureRenderer;
@@ -1070,7 +1070,7 @@
     EXPECT_TRUE(checkPixel( 3, 52,  35, 231,  35,  35));
 }
 
-// Tests if SurfaceTexture and BufferQueue are robust enough
+// Tests if GLConsumer and BufferQueue are robust enough
 // to handle a special case where updateTexImage is called
 // in the middle of disconnect.  This ordering is enforced
 // by blocking in the disconnect callback.
@@ -1123,12 +1123,12 @@
     sp<Thread> pt(new ProducerThread(mANW));
     pt->run();
 
-    // eat a frame so SurfaceTexture will own an at least one slot
+    // eat a frame so GLConsumer will own an at least one slot
     dw->waitForFrame();
     EXPECT_EQ(OK,mST->updateTexImage());
 
     dw->waitForFrame();
-    // Could fail here as SurfaceTexture thinks it still owns the slot
+    // Could fail here as GLConsumer thinks it still owns the slot
     // but bufferQueue has released all slots
     EXPECT_EQ(OK,mST->updateTexImage());
 
@@ -1136,7 +1136,7 @@
 }
 
 
-// This test ensures that the SurfaceTexture clears the mCurrentTexture
+// This test ensures that the GLConsumer clears the mCurrentTexture
 // when it is disconnected and reconnected.  Otherwise it will
 // attempt to release a buffer that it does not owned
 TEST_F(SurfaceTextureGLTest, DisconnectClearsCurrentTexture) {
@@ -1581,7 +1581,7 @@
     // This test should have the only reference to buffer 0.
     EXPECT_EQ(1, buffers[0]->getStrongCount());
 
-    // The SurfaceTexture should hold a single reference to buffer 1 in its
+    // The GLConsumer should hold a single reference to buffer 1 in its
     // mCurrentBuffer member.  All of the references in the slots should have
     // been released.
     EXPECT_EQ(2, buffers[1]->getStrongCount());
@@ -1615,7 +1615,7 @@
         buffers[i] = mST->getCurrentBuffer();
     }
 
-    // Abandon the SurfaceTexture, releasing the ref that the SurfaceTexture has
+    // Abandon the GLConsumer, releasing the ref that the GLConsumer has
     // on buffers[2].
     mST->abandon();
 
@@ -1847,7 +1847,7 @@
  * This test fixture is for testing GL -> GL texture streaming from one thread
  * to another.  It contains functionality to create a producer thread that will
  * perform GL rendering to an ANativeWindow that feeds frames to a
- * SurfaceTexture.  Additionally it supports interlocking the producer and
+ * GLConsumer.  Additionally it supports interlocking the producer and
  * consumer threads so that a specific sequence of calls can be
  * deterministically created by the test.
  *
@@ -1914,13 +1914,13 @@
     // FrameCondition is a utility class for interlocking between the producer
     // and consumer threads.  The FrameCondition object should be created and
     // destroyed in the consumer thread only.  The consumer thread should set
-    // the FrameCondition as the FrameAvailableListener of the SurfaceTexture,
+    // the FrameCondition as the FrameAvailableListener of the GLConsumer,
     // and should call both waitForFrame and finishFrame once for each expected
     // frame.
     //
     // This interlocking relies on the fact that onFrameAvailable gets called
-    // synchronously from SurfaceTexture::queueBuffer.
-    class FrameCondition : public SurfaceTexture::FrameAvailableListener {
+    // synchronously from GLConsumer::queueBuffer.
+    class FrameCondition : public GLConsumer::FrameAvailableListener {
     public:
         FrameCondition():
                 mFrameAvailable(false),
@@ -1951,7 +1951,7 @@
             ALOGV("-finishFrame");
         }
 
-        // This should be called by SurfaceTexture on the producer thread.
+        // This should be called by GLConsumer on the producer thread.
         virtual void onFrameAvailable() {
             Mutex::Autolock lock(mMutex);
             ALOGV("+onFrameAvailable");