Merge "check access before read" into jb-mr2-dev
diff --git a/suite/pts/deviceTests/opengl/jni/Android.mk b/suite/pts/deviceTests/opengl/jni/Android.mk
index 7ab7f89..be69522 100644
--- a/suite/pts/deviceTests/opengl/jni/Android.mk
+++ b/suite/pts/deviceTests/opengl/jni/Android.mk
@@ -26,6 +26,6 @@
 
 LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
 
-LOCAL_SHARED_LIBRARIES := libEGL libGLESv2 libandroid libutils
+LOCAL_SHARED_LIBRARIES := libEGL libGLESv2 libandroid libutils libcutils
 
 include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
diff --git a/suite/pts/deviceTests/opengl/jni/GLUtils.cpp b/suite/pts/deviceTests/opengl/jni/graphics/GLUtils.cpp
similarity index 79%
rename from suite/pts/deviceTests/opengl/jni/GLUtils.cpp
rename to suite/pts/deviceTests/opengl/jni/graphics/GLUtils.cpp
index 9e75f2c..439e451 100644
--- a/suite/pts/deviceTests/opengl/jni/GLUtils.cpp
+++ b/suite/pts/deviceTests/opengl/jni/graphics/GLUtils.cpp
@@ -12,12 +12,12 @@
  * the License.
  */
 
-#include <GLUtils.h>
+#include "GLUtils.h"
 #include <stdlib.h>
 
 #define LOG_TAG "PTS_OPENGL"
 #define LOG_NDEBUG 0
-#include "utils/Log.h"
+#include <utils/Log.h>
 
 // Loads the given source code as a shader of the given type.
 static GLuint loadShader(GLenum shaderType, const char** source) {
@@ -120,3 +120,28 @@
     delete[] m;
     return textureId;
 }
+
+bool GLUtils::createFBO(GLuint& fboId, GLuint& rboId, GLuint& cboId, int width, int height) {
+    glGenFramebuffers(1, &fboId);
+    glBindFramebuffer(GL_FRAMEBUFFER, fboId);
+
+    glGenRenderbuffers(1, &rboId);
+    glBindRenderbuffer(GL_RENDERBUFFER, rboId);
+    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height);
+    glBindRenderbuffer(GL_RENDERBUFFER, 0);
+    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboId);
+
+    glGenRenderbuffers(1, &cboId);
+    glBindRenderbuffer(GL_RENDERBUFFER, cboId);
+    glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB565, width, height);
+    glBindRenderbuffer(GL_RENDERBUFFER, 0);
+    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, cboId);
+
+    GLuint err = glGetError();
+    if (err != GL_NO_ERROR) {
+        ALOGV("GLError %d", err);
+        return false;
+    }
+
+    return glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE;
+}
diff --git a/suite/pts/deviceTests/opengl/jni/GLUtils.h b/suite/pts/deviceTests/opengl/jni/graphics/GLUtils.h
similarity index 92%
rename from suite/pts/deviceTests/opengl/jni/GLUtils.h
rename to suite/pts/deviceTests/opengl/jni/graphics/GLUtils.h
index a0525bc..8708103 100644
--- a/suite/pts/deviceTests/opengl/jni/GLUtils.h
+++ b/suite/pts/deviceTests/opengl/jni/graphics/GLUtils.h
@@ -27,6 +27,7 @@
     static int roundUpToSmallestPowerOf2(int x);
     // Generates a random texture of the given dimensions.
     static GLuint genRandTex(int texWidth, int texHeight);
+    static bool createFBO(GLuint& fboId, GLuint& rboId, GLuint& cboId, int width, int height);
 };
 
 #endif
diff --git a/suite/pts/deviceTests/opengl/jni/GLNative.cpp b/suite/pts/deviceTests/opengl/jni/primitive/GLPrimitive.cpp
similarity index 100%
rename from suite/pts/deviceTests/opengl/jni/GLNative.cpp
rename to suite/pts/deviceTests/opengl/jni/primitive/GLPrimitive.cpp
diff --git a/suite/pts/deviceTests/opengl/jni/Renderer.cpp b/suite/pts/deviceTests/opengl/jni/primitive/Renderer.cpp
similarity index 78%
rename from suite/pts/deviceTests/opengl/jni/Renderer.cpp
rename to suite/pts/deviceTests/opengl/jni/primitive/Renderer.cpp
index 0f5c3ba..4bc0cda 100644
--- a/suite/pts/deviceTests/opengl/jni/Renderer.cpp
+++ b/suite/pts/deviceTests/opengl/jni/primitive/Renderer.cpp
@@ -12,11 +12,14 @@
  * the License.
  */
 #include "Renderer.h"
-#include <GLUtils.h>
+#include <graphics/GLUtils.h>
 
 #define LOG_TAG "PTS_OPENGL"
 #define LOG_NDEBUG 0
-#include "utils/Log.h"
+#include <utils/Log.h>
+
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+#include <utils/Trace.h>
 
 static const EGLint contextAttribs[] = {
         EGL_CONTEXT_CLIENT_VERSION, 2,
@@ -39,6 +42,7 @@
 }
 
 bool Renderer::setUp() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
     if (EGL_NO_DISPLAY == mEglDisplay || EGL_SUCCESS != eglGetError()) {
         return false;
@@ -85,7 +89,7 @@
     if (mOffscreen) {
         int w = GLUtils::roundUpToSmallestPowerOf2(width);
         int h = GLUtils::roundUpToSmallestPowerOf2(height);
-        if (!createFBO(mFboId, mRboId, mCboId, w, h)) {
+        if (!GLUtils::createFBO(mFboId, mRboId, mCboId, w, h)) {
             return false;
         }
     } else {
@@ -102,32 +106,8 @@
     return true;
 }
 
-bool Renderer::createFBO(GLuint& fboId, GLuint& rboId, GLuint& cboId, int width, int height) {
-    glGenFramebuffers(1, &fboId);
-    glBindFramebuffer(GL_FRAMEBUFFER, fboId);
-
-    glGenRenderbuffers(1, &rboId);
-    glBindRenderbuffer(GL_RENDERBUFFER, rboId);
-    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height);
-    glBindRenderbuffer(GL_RENDERBUFFER, 0);
-    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboId);
-
-    glGenRenderbuffers(1, &cboId);
-    glBindRenderbuffer(GL_RENDERBUFFER, cboId);
-    glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB565, width, height);
-    glBindRenderbuffer(GL_RENDERBUFFER, 0);
-    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, cboId);
-
-    GLuint err = glGetError();
-    if (err != GL_NO_ERROR) {
-        ALOGV("GLError %d", err);
-        return false;
-    }
-
-    return glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE;
-}
-
 bool Renderer::tearDown() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     if (mFboId != 0) {
         glDeleteFramebuffers(1, &mFboId);
         mFboId = 0;
diff --git a/suite/pts/deviceTests/opengl/jni/Renderer.h b/suite/pts/deviceTests/opengl/jni/primitive/Renderer.h
similarity index 93%
rename from suite/pts/deviceTests/opengl/jni/Renderer.h
rename to suite/pts/deviceTests/opengl/jni/primitive/Renderer.h
index a50d81c..49c7e98 100644
--- a/suite/pts/deviceTests/opengl/jni/Renderer.h
+++ b/suite/pts/deviceTests/opengl/jni/primitive/Renderer.h
@@ -28,7 +28,6 @@
     virtual bool draw() = 0;
     virtual ~Renderer() {};
 protected:
-    bool createFBO(GLuint& fboId, GLuint& rboId, GLuint& cboId, int width, int height);
     ANativeWindow* mWindow;
     EGLDisplay mEglDisplay;
     EGLSurface mEglSurface;
diff --git a/suite/pts/deviceTests/opengl/jni/contextswitch/ContextSwitchRenderer.cpp b/suite/pts/deviceTests/opengl/jni/primitive/contextswitch/ContextSwitchRenderer.cpp
similarity index 94%
rename from suite/pts/deviceTests/opengl/jni/contextswitch/ContextSwitchRenderer.cpp
rename to suite/pts/deviceTests/opengl/jni/primitive/contextswitch/ContextSwitchRenderer.cpp
index 0d85cae..cdfaaec 100644
--- a/suite/pts/deviceTests/opengl/jni/contextswitch/ContextSwitchRenderer.cpp
+++ b/suite/pts/deviceTests/opengl/jni/primitive/contextswitch/ContextSwitchRenderer.cpp
@@ -21,11 +21,14 @@
 #include <GLES2/gl2ext.h>
 
 #include "ContextSwitchRenderer.h"
-#include <GLUtils.h>
+#include <graphics/GLUtils.h>
 
 #define LOG_TAG "PTS_OPENGL"
 #define LOG_NDEBUG 0
-#include "utils/Log.h"
+#include <utils/Log.h>
+
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+#include <utils/Trace.h>
 
 static const EGLint contextAttribs[] =
         { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
@@ -70,6 +73,7 @@
 }
 
 bool ContextSwitchRenderer::setUp() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     if (!Renderer::setUp()) {
         return false;
     }
@@ -105,7 +109,7 @@
 
         if (mOffscreen) {
             // Setup FBOs.
-            if (!Renderer::createFBO(mFboIds[i], mRboIds[i], mCboIds[i], w, h)) {
+            if (!GLUtils::createFBO(mFboIds[i], mRboIds[i], mCboIds[i], w, h)) {
                 return false;
             }
         }
@@ -137,6 +141,7 @@
 }
 
 bool ContextSwitchRenderer::tearDown() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     if (mContexts) {
         for (int i = 0; i < mWorkload; i++) {
             eglDestroyContext(mEglDisplay, mContexts[i]);
@@ -168,6 +173,7 @@
 }
 
 bool ContextSwitchRenderer::draw() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     for (int i = 0; i < mWorkload; i++) {
         if (!eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mContexts[i])
                 || EGL_SUCCESS != eglGetError()) {
diff --git a/suite/pts/deviceTests/opengl/jni/contextswitch/ContextSwitchRenderer.h b/suite/pts/deviceTests/opengl/jni/primitive/contextswitch/ContextSwitchRenderer.h
similarity index 97%
rename from suite/pts/deviceTests/opengl/jni/contextswitch/ContextSwitchRenderer.h
rename to suite/pts/deviceTests/opengl/jni/primitive/contextswitch/ContextSwitchRenderer.h
index 3dfe9f3..24d8df1 100644
--- a/suite/pts/deviceTests/opengl/jni/contextswitch/ContextSwitchRenderer.h
+++ b/suite/pts/deviceTests/opengl/jni/primitive/contextswitch/ContextSwitchRenderer.h
@@ -14,7 +14,7 @@
 #ifndef CONTEXTSWITCHRENDERER_H
 #define CONTEXTSWITCHRENDERER_H
 
-#include <Renderer.h>
+#include <primitive/Renderer.h>
 
 class ContextSwitchRenderer: public Renderer {
 public:
diff --git a/suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineMesh.cpp b/suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineMesh.cpp
similarity index 100%
rename from suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineMesh.cpp
rename to suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineMesh.cpp
diff --git a/suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineMesh.h b/suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineMesh.h
similarity index 100%
rename from suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineMesh.h
rename to suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineMesh.h
diff --git a/suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineProgram.cpp b/suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineProgram.cpp
similarity index 97%
rename from suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineProgram.cpp
rename to suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineProgram.cpp
index e3abc2c..b06cdd2 100644
--- a/suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineProgram.cpp
+++ b/suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineProgram.cpp
@@ -23,7 +23,7 @@
     mLightPosInModelSpace[0] = 0.0f;
     mLightPosInModelSpace[1] = 2.0f;
     mLightPosInModelSpace[2] = 2.0f;
-    mLightPosInModelSpace[3] = 1.0f;
+    mLightPosInModelSpace[3] = 2.0f;
     mMVMatrixHandle = glGetUniformLocation(programId, "u_MVMatrix");
     mMVPMatrixHandle = glGetUniformLocation(programId, "u_MVPMatrix");
     mLightPosHandle = glGetUniformLocation(programId, "u_LightPos");
diff --git a/suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineProgram.h b/suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineProgram.h
similarity index 100%
rename from suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineProgram.h
rename to suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineProgram.h
diff --git a/suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineRenderer.cpp b/suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineRenderer.cpp
similarity index 96%
rename from suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineRenderer.cpp
rename to suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineRenderer.cpp
index 4cab669..3db5eea 100644
--- a/suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineRenderer.cpp
+++ b/suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineRenderer.cpp
@@ -21,11 +21,14 @@
 #include "FullPipelineRenderer.h"
 #include <graphics/Mesh.h>
 #include <graphics/TransformationNode.h>
-#include <GLUtils.h>
+#include <graphics/GLUtils.h>
 
 #define LOG_TAG "PTS_OPENGL"
 #define LOG_NDEBUG 0
-#include "utils/Log.h"
+#include <utils/Log.h>
+
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+#include <utils/Trace.h>
 
 static const int FP_NUM_VERTICES = 6;
 
@@ -101,6 +104,7 @@
 }
 
 bool FullPipelineRenderer::setUp() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     if (!Renderer::setUp()) {
         return false;
     }
@@ -169,6 +173,7 @@
 }
 
 bool FullPipelineRenderer::tearDown() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     if (mTextureId != 0) {
         glDeleteTextures(1, &mTextureId);
         mTextureId = 0;
@@ -192,6 +197,7 @@
 }
 
 bool FullPipelineRenderer::draw() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     if (mOffscreen) {
         glBindFramebuffer(GL_FRAMEBUFFER, mFboId);
     }
diff --git a/suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineRenderer.h b/suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineRenderer.h
similarity index 97%
rename from suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineRenderer.h
rename to suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineRenderer.h
index 0c5acae..14efcf6 100644
--- a/suite/pts/deviceTests/opengl/jni/fullpipeline/FullPipelineRenderer.h
+++ b/suite/pts/deviceTests/opengl/jni/primitive/fullpipeline/FullPipelineRenderer.h
@@ -16,7 +16,7 @@
 
 #include "FullPipelineProgram.h"
 
-#include <Renderer.h>
+#include <primitive/Renderer.h>
 #include <graphics/Matrix.h>
 #include <graphics/Mesh.h>
 #include <graphics/ProgramNode.h>
diff --git a/suite/pts/deviceTests/opengl/jni/pixeloutput/PixelOutputRenderer.cpp b/suite/pts/deviceTests/opengl/jni/primitive/pixeloutput/PixelOutputRenderer.cpp
similarity index 93%
rename from suite/pts/deviceTests/opengl/jni/pixeloutput/PixelOutputRenderer.cpp
rename to suite/pts/deviceTests/opengl/jni/primitive/pixeloutput/PixelOutputRenderer.cpp
index 95bf52b..d2fd762 100644
--- a/suite/pts/deviceTests/opengl/jni/pixeloutput/PixelOutputRenderer.cpp
+++ b/suite/pts/deviceTests/opengl/jni/primitive/pixeloutput/PixelOutputRenderer.cpp
@@ -12,11 +12,14 @@
  * the License.
  */
 #include "PixelOutputRenderer.h"
-#include <GLUtils.h>
+#include <graphics/GLUtils.h>
 
 #define LOG_TAG "PTS_OPENGL"
 #define LOG_NDEBUG 0
-#include "utils/Log.h"
+#include <utils/Log.h>
+
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+#include <utils/Trace.h>
 
 static const int PO_NUM_VERTICES = 6;
 
@@ -57,6 +60,7 @@
 }
 
 bool PixelOutputRenderer::setUp() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     if (!Renderer::setUp()) {
         return false;
     }
@@ -79,6 +83,7 @@
 }
 
 bool PixelOutputRenderer::tearDown() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     if (mTextureId != 0) {
         glDeleteTextures(1, &mTextureId);
         mTextureId = 0;
@@ -90,6 +95,7 @@
 }
 
 bool PixelOutputRenderer::draw() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     if (mOffscreen) {
         glBindFramebuffer(GL_FRAMEBUFFER, mFboId);
     }
diff --git a/suite/pts/deviceTests/opengl/jni/pixeloutput/PixelOutputRenderer.h b/suite/pts/deviceTests/opengl/jni/primitive/pixeloutput/PixelOutputRenderer.h
similarity index 96%
rename from suite/pts/deviceTests/opengl/jni/pixeloutput/PixelOutputRenderer.h
rename to suite/pts/deviceTests/opengl/jni/primitive/pixeloutput/PixelOutputRenderer.h
index 6422517..90b3f2a 100644
--- a/suite/pts/deviceTests/opengl/jni/pixeloutput/PixelOutputRenderer.h
+++ b/suite/pts/deviceTests/opengl/jni/primitive/pixeloutput/PixelOutputRenderer.h
@@ -14,7 +14,7 @@
 #ifndef PIXELOUTPUTRENDERER_H
 #define PIXELOUTPUTRENDERER_H
 
-#include <Renderer.h>
+#include <primitive/Renderer.h>
 
 class PixelOutputRenderer: public Renderer {
 public:
diff --git a/suite/pts/deviceTests/opengl/jni/shaderperf/ShaderPerfRenderer.cpp b/suite/pts/deviceTests/opengl/jni/primitive/shaderperf/ShaderPerfRenderer.cpp
similarity index 96%
rename from suite/pts/deviceTests/opengl/jni/shaderperf/ShaderPerfRenderer.cpp
rename to suite/pts/deviceTests/opengl/jni/primitive/shaderperf/ShaderPerfRenderer.cpp
index 6d98c9a..62fe1ac 100644
--- a/suite/pts/deviceTests/opengl/jni/shaderperf/ShaderPerfRenderer.cpp
+++ b/suite/pts/deviceTests/opengl/jni/primitive/shaderperf/ShaderPerfRenderer.cpp
@@ -12,13 +12,16 @@
  * the License.
  */
 #include "ShaderPerfRenderer.h"
-#include <GLUtils.h>
+#include <graphics/GLUtils.h>
 
 #include <math.h>
 
 #define LOG_TAG "PTS_OPENGL"
 #define LOG_NDEBUG 0
-#include "utils/Log.h"
+#include <utils/Log.h>
+
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+#include <utils/Trace.h>
 
 static const float GOLDEN_RATIO = (1.0 + sqrt(5.0)) / 2.0;
 
@@ -98,6 +101,7 @@
 }
 
 bool ShaderPerfRenderer::setUp() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     if (!Renderer::setUp()) {
         return false;
     }
@@ -148,6 +152,7 @@
 }
 
 bool ShaderPerfRenderer::draw() {
+    android::ScopedTrace st(ATRACE_TAG, __func__);
     if (mOffscreen) {
         glBindFramebuffer(GL_FRAMEBUFFER, mFboId);
     }
diff --git a/suite/pts/deviceTests/opengl/jni/shaderperf/ShaderPerfRenderer.h b/suite/pts/deviceTests/opengl/jni/primitive/shaderperf/ShaderPerfRenderer.h
similarity index 96%
rename from suite/pts/deviceTests/opengl/jni/shaderperf/ShaderPerfRenderer.h
rename to suite/pts/deviceTests/opengl/jni/primitive/shaderperf/ShaderPerfRenderer.h
index 4460174..3537eba 100644
--- a/suite/pts/deviceTests/opengl/jni/shaderperf/ShaderPerfRenderer.h
+++ b/suite/pts/deviceTests/opengl/jni/primitive/shaderperf/ShaderPerfRenderer.h
@@ -14,7 +14,7 @@
 #ifndef SHADERPERFRENDERER_H
 #define SHADERPERFRENDERER_H
 
-#include <Renderer.h>
+#include <primitive/Renderer.h>
 
 class ShaderPerfRenderer: public Renderer {
 public:
diff --git a/suite/pts/utils/grapher.py b/suite/pts/utils/grapher.py
index 42b5f11..94bf25e 100755
--- a/suite/pts/utils/grapher.py
+++ b/suite/pts/utils/grapher.py
@@ -41,7 +41,7 @@
       # Create a new figure
       fig = plt.figure()
       # Set the title of the graph
-      plt.title(benchmark)
+      plt.title(benchmark[benchmark.index('#') + 1:])
       # For each result in the data set
       for r in results:
         score = r['result']
@@ -60,6 +60,9 @@
           ax.plot(x, y, 'o-', label=r['device'] + ' (%s)'%score)
           # Add a legend
           ax.legend(loc='upper right').get_frame().set_fill(False)
+      (ymin, ymax) = plt.ylim()
+      if ymax < 90:# So that on screen tests are easier to compare
+        plt.ylim(0, 90)
       plt.xlabel('Iteration')
       plt.ylabel('FPS')
       fig.autofmt_xdate()
diff --git a/tests/core/ctscore.mk b/tests/core/ctscore.mk
index 0961c96..1e4e017 100644
--- a/tests/core/ctscore.mk
+++ b/tests/core/ctscore.mk
@@ -23,7 +23,6 @@
 # Don't delete META-INF from the core-tests jar
 LOCAL_DONT_DELETE_JAR_META_INF := true
 
-LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 LOCAL_JNI_SHARED_LIBRARIES := libjavacoretests
 
 include $(BUILD_PACKAGE)
diff --git a/tests/core/libcore/com/Android.mk b/tests/core/libcore/com/Android.mk
index 6c68f9d..02dc3de 100644
--- a/tests/core/libcore/com/Android.mk
+++ b/tests/core/libcore/com/Android.mk
@@ -20,4 +20,5 @@
 
 include $(CLEAR_VARS)
 LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.com
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/dalvik/Android.mk b/tests/core/libcore/dalvik/Android.mk
index 5744fac..7b77a75 100644
--- a/tests/core/libcore/dalvik/Android.mk
+++ b/tests/core/libcore/dalvik/Android.mk
@@ -20,4 +20,5 @@
 
 include $(CLEAR_VARS)
 LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.dalvik
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/libcore/Android.mk b/tests/core/libcore/libcore/Android.mk
index 160b996..382b386 100644
--- a/tests/core/libcore/libcore/Android.mk
+++ b/tests/core/libcore/libcore/Android.mk
@@ -20,4 +20,5 @@
 
 include $(CLEAR_VARS)
 LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.libcore
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/org/Android.mk b/tests/core/libcore/org/Android.mk
index adb26d5..d7a96b3 100644
--- a/tests/core/libcore/org/Android.mk
+++ b/tests/core/libcore/org/Android.mk
@@ -20,4 +20,5 @@
 
 include $(CLEAR_VARS)
 LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.org
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/sun/Android.mk b/tests/core/libcore/sun/Android.mk
index d2754eb..44d3d70 100644
--- a/tests/core/libcore/sun/Android.mk
+++ b/tests/core/libcore/sun/Android.mk
@@ -20,4 +20,5 @@
 
 include $(CLEAR_VARS)
 LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.sun
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/tests/Android.mk b/tests/core/libcore/tests/Android.mk
index 0c1024e..bfd235f 100644
--- a/tests/core/libcore/tests/Android.mk
+++ b/tests/core/libcore/tests/Android.mk
@@ -20,4 +20,5 @@
 
 include $(CLEAR_VARS)
 LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.tests
+LOCAL_STATIC_JAVA_LIBRARIES := core-tests
 include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/tests/media/src/android/media/cts/AudioManagerTest.java b/tests/tests/media/src/android/media/cts/AudioManagerTest.java
index 9500606..4a74b47 100644
--- a/tests/tests/media/src/android/media/cts/AudioManagerTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioManagerTest.java
@@ -54,6 +54,7 @@
     private final static long TIME_TO_PLAY = 2000;
     private AudioManager mAudioManager;
     private boolean mHasVibrator;
+    private boolean mUseFixedVolume;
 
     @Override
     protected void setUp() throws Exception {
@@ -61,6 +62,8 @@
         mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
         Vibrator vibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
         mHasVibrator = (vibrator != null) && vibrator.hasVibrator();
+        mUseFixedVolume = mContext.getResources().getBoolean(
+                                            com.android.internal.R.bool.config_useFixedVolume);
     }
 
     public void testMicrophoneMute() throws Exception {
@@ -168,6 +171,9 @@
     }
 
     public void testVibrateNotification() throws Exception {
+        if (mUseFixedVolume) {
+            return;
+        }
         // VIBRATE_SETTING_ON
         mAudioManager.setVibrateSetting(VIBRATE_TYPE_NOTIFICATION, VIBRATE_SETTING_ON);
         assertEquals(mHasVibrator ? VIBRATE_SETTING_ON : VIBRATE_SETTING_OFF,
@@ -226,6 +232,9 @@
     }
 
     public void testVibrateRinger() throws Exception {
+        if (mUseFixedVolume) {
+            return;
+        }
         // VIBRATE_TYPE_RINGER
         mAudioManager.setVibrateSetting(VIBRATE_TYPE_RINGER, VIBRATE_SETTING_ON);
         assertEquals(mHasVibrator ? VIBRATE_SETTING_ON : VIBRATE_SETTING_OFF,
@@ -289,11 +298,19 @@
         assertEquals(RINGER_MODE_NORMAL, mAudioManager.getRingerMode());
 
         mAudioManager.setRingerMode(RINGER_MODE_SILENT);
-        assertEquals(RINGER_MODE_SILENT, mAudioManager.getRingerMode());
+        if (mUseFixedVolume) {
+            assertEquals(RINGER_MODE_NORMAL, mAudioManager.getRingerMode());
+        } else {
+            assertEquals(RINGER_MODE_SILENT, mAudioManager.getRingerMode());
+        }
 
         mAudioManager.setRingerMode(RINGER_MODE_VIBRATE);
-        assertEquals(mHasVibrator ? RINGER_MODE_VIBRATE : RINGER_MODE_SILENT,
-                mAudioManager.getRingerMode());
+        if (mUseFixedVolume) {
+            assertEquals(RINGER_MODE_NORMAL, mAudioManager.getRingerMode());
+        } else {
+            assertEquals(mHasVibrator ? RINGER_MODE_VIBRATE : RINGER_MODE_SILENT,
+                    mAudioManager.getRingerMode());
+        }
     }
 
     public void testVolume() throws Exception {
@@ -314,6 +331,10 @@
             int maxVolume = mAudioManager.getStreamMaxVolume(streams[i]);
 
             mAudioManager.setStreamVolume(streams[i], 1, 0);
+            if (mUseFixedVolume) {
+                assertEquals(maxVolume, mAudioManager.getStreamVolume(streams[i]));
+                continue;
+            }
             assertEquals(1, mAudioManager.getStreamVolume(streams[i]));
 
             if (streams[i] == AudioManager.STREAM_MUSIC && mAudioManager.isWiredHeadsetOn()) {
@@ -363,6 +384,10 @@
             mAudioManager.setStreamVolume(streams[i], maxVolume, 0);
         }
 
+        if (mUseFixedVolume) {
+            return;
+        }
+
         // adjust volume
         mAudioManager.adjustVolume(ADJUST_RAISE, 0);
 
diff --git a/tests/tests/net/src/android/net/wifi/cts/WifiInfoTest.java b/tests/tests/net/src/android/net/wifi/cts/WifiInfoTest.java
index 16dc57d..8719b6b 100644
--- a/tests/tests/net/src/android/net/wifi/cts/WifiInfoTest.java
+++ b/tests/tests/net/src/android/net/wifi/cts/WifiInfoTest.java
@@ -122,7 +122,13 @@
         assertNotNull(wifiInfo.toString());
         SupplicantState.isValidState(wifiInfo.getSupplicantState());
         WifiInfo.getDetailedStateOf(SupplicantState.DISCONNECTED);
-        wifiInfo.getSSID();
+        String ssid = wifiInfo.getSSID();
+        if (ssid.startsWith("0x") == false) {
+            // Non-hex string should be quoted
+            assertTrue(ssid.charAt(0) == '"');
+            assertTrue(ssid.charAt(ssid.length() - 1) == '"');
+        }
+
         wifiInfo.getBSSID();
         wifiInfo.getIpAddress();
         wifiInfo.getLinkSpeed();
diff --git a/tools/device-setup/TestDeviceSetup/Android.mk b/tools/device-setup/TestDeviceSetup/Android.mk
index 5642736..f6c1079 100644
--- a/tools/device-setup/TestDeviceSetup/Android.mk
+++ b/tools/device-setup/TestDeviceSetup/Android.mk
@@ -26,7 +26,7 @@
 
 LOCAL_JAVA_LIBRARIES := android.test.runner
 
-LOCAL_SDK_VERSION := current
+LOCAL_SDK_VERSION := 16
 
 LOCAL_PACKAGE_NAME := TestDeviceSetup
 
diff --git a/tools/utils/buildCts.py b/tools/utils/buildCts.py
index 6c8959c..3cb986f 100755
--- a/tools/utils/buildCts.py
+++ b/tools/utils/buildCts.py
@@ -146,7 +146,8 @@
     plan.Include('android\.bluetooth')
     plan.Include('android\.graphics.*')
     plan.Include('android\.hardware')
-    plan.Include('android\.media.*')
+    plan.Include('android\.media')
+    plan.Exclude('android\.mediastress')
     plan.Include('android\.net')
     plan.Include('android\.opengl.*')
     plan.Include('android\.renderscript')
diff --git a/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java b/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java
index bd688fe..20429f0 100644
--- a/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java
+++ b/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java
@@ -576,14 +576,6 @@
         }
 
         // find the @title/@constraint in javadoc comment for this method
-        Scanner scanner2;
-        try {
-            // using platform's default charset
-            scanner2 = new Scanner(f);
-        } catch (FileNotFoundException e) {
-            throw new RuntimeException("error while reading to file: " + e.getClass().getName() +
-                    ", msg:" + e.getMessage());
-        }
         // using platform's default charset
         String all = new String(FileUtils.readFile(f));
         // System.out.println("grepping javadoc found for method " + method +
@@ -630,9 +622,6 @@
         if (scanner != null) {
             scanner.close();
         }
-        if (scanner2 != null) {
-            scanner2.close();
-        }
         return md;
     }