Merge "- Add instrumentation utility to automate rs performance tests:   The RsBench test activity can be launched within instrumentation"
diff --git a/include/utils/Vector.h b/include/utils/Vector.h
index 6fd307f..f1e87e6 100644
--- a/include/utils/Vector.h
+++ b/include/utils/Vector.h
@@ -165,6 +165,26 @@
      // for debugging only
      inline size_t getItemSize() const { return itemSize(); }
 
+
+     /*
+      * these inlines add some level of compatibility with STL. eventually
+      * we should probably turn things around.
+      */
+     typedef TYPE* iterator;
+     typedef TYPE const* const_iterator;
+
+     inline iterator begin() { return editArray(); }
+     inline iterator end()   { return editArray() + size(); }
+     inline const_iterator begin() const { return array(); }
+     inline const_iterator end() const   { return array() + size(); }
+     inline void reserve(size_t n) { setCapacity(n); }
+     inline bool empty() const{ return isEmpty(); }
+     inline void push_back(const TYPE& item)  { insertAt(item, size()); }
+     inline void push_front(const TYPE& item) { insertAt(item, 0); }
+     inline iterator erase(iterator pos) {
+         return begin() + removeItemsAt(pos-array());
+     }
+
 protected:
     virtual void    do_construct(void* storage, size_t num) const;
     virtual void    do_destroy(void* storage, size_t num) const;
diff --git a/libs/gui/tests/SurfaceTextureClient_test.cpp b/libs/gui/tests/SurfaceTextureClient_test.cpp
index 348171d..db781de 100644
--- a/libs/gui/tests/SurfaceTextureClient_test.cpp
+++ b/libs/gui/tests/SurfaceTextureClient_test.cpp
@@ -64,7 +64,7 @@
     ASSERT_EQ(BAD_VALUE, ANativeWindow_lock(anw.get(), &buf, NULL));
 }
 
-TEST_F(SurfaceTextureClientTest, EglCreateWindowSurfaceFails) {
+TEST_F(SurfaceTextureClientTest, EglCreateWindowSurfaceSucceeds) {
     sp<ANativeWindow> anw(mSTC);
 
     EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
@@ -94,8 +94,8 @@
 
     EGLSurface eglSurface = eglCreateWindowSurface(dpy, myConfig, anw.get(),
             NULL);
-    ASSERT_EQ(EGL_NO_SURFACE, eglSurface);
-    ASSERT_EQ(EGL_BAD_NATIVE_WINDOW, eglGetError());
+    ASSERT_NE(EGL_NO_SURFACE, eglSurface);
+    ASSERT_EQ(EGL_SUCCESS, eglGetError());
 
     eglTerminate(dpy);
 }
diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp
index 4184463..6c71343 100644
--- a/libs/gui/tests/SurfaceTexture_test.cpp
+++ b/libs/gui/tests/SurfaceTexture_test.cpp
@@ -76,7 +76,7 @@
             mComposerClient = new SurfaceComposerClient;
             ASSERT_EQ(NO_ERROR, mComposerClient->initCheck());
 
-            mSurfaceControl = mComposerClient->createSurface(getpid(),
+            mSurfaceControl = mComposerClient->createSurface(
                     String8("Test Surface"), 0,
                     getSurfaceWidth(), getSurfaceHeight(),
                     PIXEL_FORMAT_RGB_888, 0);
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp
index fd07479..440a48b 100644
--- a/libs/gui/tests/Surface_test.cpp
+++ b/libs/gui/tests/Surface_test.cpp
@@ -30,7 +30,7 @@
         mComposerClient = new SurfaceComposerClient;
         ASSERT_EQ(NO_ERROR, mComposerClient->initCheck());
 
-        mSurfaceControl = mComposerClient->createSurface(getpid(),
+        mSurfaceControl = mComposerClient->createSurface(
                 String8("Test Surface"), 0, 32, 32, PIXEL_FORMAT_RGB_888, 0);
 
         ASSERT_TRUE(mSurfaceControl != NULL);
diff --git a/libs/utils/RefBase.cpp b/libs/utils/RefBase.cpp
index bb6c125..2034486 100644
--- a/libs/utils/RefBase.cpp
+++ b/libs/utils/RefBase.cpp
@@ -524,7 +524,7 @@
 
 void RefBase::weakref_type::trackMe(bool enable, bool retain)
 {
-    static_cast<const weakref_impl*>(this)->trackMe(enable, retain);
+    static_cast<weakref_impl*>(this)->trackMe(enable, retain);
 }
 
 RefBase::weakref_type* RefBase::createWeak(const void* id) const
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 9cf7223..aabba28 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -1132,16 +1132,6 @@
         EGLConfig iConfig = dp->configs[intptr_t(config)].config;
         EGLint format;
 
-        // for now fail if the window is not a Surface.
-        int type = -1;
-        ANativeWindow* anw = reinterpret_cast<ANativeWindow*>(window);
-        if ((anw->query(window, NATIVE_WINDOW_CONCRETE_TYPE, &type) != 0) ||
-                (type == NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT)) {
-            LOGE("native window is a SurfaceTextureClient (currently "
-                    "unsupported)");
-            return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
-        }
-
         // set the native window's buffers format to match this config
         if (cnx->egl.eglGetConfigAttrib(iDpy,
                 iConfig, EGL_NATIVE_VISUAL_ID, &format)) {