SurfaceTexture: add name support

This change adds support for setting a string that can be used to
identify a SurfaceTexture object in log messages.

Change-Id: Ib4ee085f36c8830dc964c05ef1654f5a55dfcd60
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h
index 493993d..926eb9a 100644
--- a/include/gui/SurfaceTexture.h
+++ b/include/gui/SurfaceTexture.h
@@ -25,8 +25,9 @@
 
 #include <ui/GraphicBuffer.h>
 
-#include <utils/threads.h>
+#include <utils/String8.h>
 #include <utils/Vector.h>
+#include <utils/threads.h>
 
 #define ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID "mSurfaceTexture"
 
@@ -202,6 +203,10 @@
     // by OpenGL ES as a texture) then those buffer will remain allocated.
     void abandon();
 
+    // set the name of the SurfaceTexture that will be used to identify it in
+    // log messages.
+    void setName(const String8& name);
+
     // dump our state in a String
     void dump(String8& result) const;
     void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const;
@@ -444,6 +449,10 @@
     // all ISurfaceTexture methods capable of returning an error.
     bool mAbandoned;
 
+    // mName is a string used to identify the SurfaceTexture in log messages.
+    // It is set by the setName method.
+    String8 mName;
+
     // mMutex is the mutex used to prevent concurrent access to the member
     // variables of SurfaceTexture objects. It must be locked whenever the
     // member variables are accessed.