Merge "fix android.nativemedia.sl.SLObjectCreationTest#testAudioRecorderCreation test" into jb-mr1-dev
diff --git a/tests/tests/content/src/android/content/res/cts/ConfigTest.java b/tests/tests/content/src/android/content/res/cts/ConfigTest.java
index 60197b6..b49f156 100755
--- a/tests/tests/content/src/android/content/res/cts/ConfigTest.java
+++ b/tests/tests/content/src/android/content/res/cts/ConfigTest.java
@@ -123,6 +123,7 @@
                 case DENSITY:
                     // this is the ratio from the standard
                     mMetrics.density = (((float)value)/((float)DisplayMetrics.DENSITY_DEFAULT));
+                    mConfig.densityDpi = value;
                     break;
                 case SCREENLAYOUT:
                     mConfig.screenLayout = value;
@@ -182,6 +183,7 @@
         config.mConfig.smallestScreenWidthDp = 320;
         config.mConfig.screenWidthDp = 320;
         config.mConfig.screenHeightDp = 480;
+        config.mConfig.densityDpi = 160;
         config.mMetrics.widthPixels = 200;
         config.mMetrics.heightPixels = 320;
         config.mMetrics.density = 1;
diff --git a/tests/tests/opengl/src/android/opengl/cts/OpenGLES20ActivityTwo.java b/tests/tests/opengl/src/android/opengl/cts/OpenGLES20ActivityTwo.java
index 6bb34e4..8ed0b9c 100755
--- a/tests/tests/opengl/src/android/opengl/cts/OpenGLES20ActivityTwo.java
+++ b/tests/tests/opengl/src/android/opengl/cts/OpenGLES20ActivityTwo.java
@@ -69,8 +69,9 @@
     @Override
     protected void onPause() {
         super.onPause();
-        view.onPause();
-
+        if(view != null) {
+            view.onPause();
+        }
     }
 
     @Override
diff --git a/tests/tests/opengl/src/android/opengl/cts/RendererOneColorBufferTest.java b/tests/tests/opengl/src/android/opengl/cts/RendererOneColorBufferTest.java
index 50a4085..89e0c13 100755
--- a/tests/tests/opengl/src/android/opengl/cts/RendererOneColorBufferTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/RendererOneColorBufferTest.java
@@ -39,7 +39,7 @@
     private FloatBuffer mVertices;
     private ShortBuffer mIndexBuffer;
 
-    private static String TAG = "HelloTriangleRenderer";
+    private static String TAG = "RendererOneColorBufferTest";
 
     // Our vertices.
     private float mVerticesData[] = {
@@ -49,10 +49,12 @@
             0.5f,  0.5f, 0.0f,  // 3, Top Right
     };
 
-    private float[] mVertexColor = {1.0f,0.0f,0.0f,1.0f,
-            1.0f,0.0f,0.0f,1.0f,
-            1.0f,0.0f,0.0f,1.0f,
-            1.0f,0.0f,0.0f,1.0f};
+    private float[] mVertexColor = {
+            1.0f, 0.0f, 0.0f, 1.0f,
+            1.0f, 0.0f, 0.0f, 1.0f,
+            1.0f, 0.0f, 0.0f, 1.0f,
+            1.0f, 0.0f, 0.0f, 1.0f
+    };
 
     // The order we like to connect them.
     private short[] mIndices = { 0, 1, 2, 0, 2, 3 };
@@ -62,7 +64,7 @@
     public RendererOneColorBufferTest(Context context, CountDownLatch latch) {
         super(latch);
         mVertices = ByteBuffer.allocateDirect(mVerticesData.length * 4)
-        .order(ByteOrder.nativeOrder()).asFloatBuffer();
+                .order(ByteOrder.nativeOrder()).asFloatBuffer();
         mVertices.put(mVerticesData).position(0);
 
         ByteBuffer ibb = ByteBuffer.allocateDirect(mIndices.length * 2);
@@ -80,7 +82,7 @@
         super(latch);
         mVertexColor = colors;
         mVertices = ByteBuffer.allocateDirect(mVerticesData.length * 4)
-        .order(ByteOrder.nativeOrder()).asFloatBuffer();
+                .order(ByteOrder.nativeOrder()).asFloatBuffer();
         mVertices.put(mVerticesData).position(0);
 
         ByteBuffer ibb = ByteBuffer.allocateDirect(mIndices.length * 2);
@@ -185,9 +187,6 @@
 
     public void doOnDrawFrame(GL10 glUnused)
     {
-        // Set the viewport
-        GLES20.glViewport(0, 0, mWidth, mHeight);
-
         // Clear the color buffer
         GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
 
@@ -195,11 +194,11 @@
         GLES20.glUseProgram(mProgramObject);
 
         // Load the vertex data
-        GLES20.glVertexAttribPointer(0,3, GLES20.GL_FLOAT, false, 0, mVertices);
+        GLES20.glVertexAttribPointer(0, 3, GLES20.GL_FLOAT, false, 0, mVertices);
         GLES20.glEnableVertexAttribArray(0);
 
         int mColorHandle = GLES20.glGetAttribLocation(mProgramObject, "vColor");
-        GLES20.glVertexAttribPointer(mColorHandle,4, GLES20.GL_FLOAT, false, 0, mColor);
+        GLES20.glVertexAttribPointer(mColorHandle, 4, GLES20.GL_FLOAT, false, 0, mColor);
         GLES20.glEnableVertexAttribArray(1);
 
         GLES20.glDrawElements(GLES20.GL_TRIANGLES, mIndices.length, 
@@ -208,19 +207,16 @@
         int x = 1;
         int y =1;
         IntBuffer   pinbuffer   = IntBuffer.allocate(1*1*4);
-        IntBuffer   poutbuffer  = IntBuffer.allocate(x*y*4);
-           int         i,j,z;
-           int []      pin         = pinbuffer.array();
-           int []      pout        = poutbuffer.array();
 
-        GLES20.glReadPixels(mWidth/2, mWidth/2, 1, 1, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE,
+        GLES20.glReadPixels(mWidth/2, mHeight/2, 1, 1, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE,
                 pinbuffer);
+        int []      pin         = pinbuffer.array();
         int pixel = pin[0];
         float a = (pixel >> 24) & 0xFF;
         float b = (pixel >> 16) & 0xFF;
         float g = (pixel >> 8) & 0xFF;
         float r = pixel & 0xFF;
-        Log.i(TAG,"rgba" + r + " " + g + " " + b + " " + a);
+        Log.i(TAG, "w " + mWidth + " h " + mHeight + " rgba" + r + " " + g + " " + b + " " + a);
         mColorOne[0] = r;
         mColorOne[1] = g;
         mColorOne[2] = b;
@@ -232,7 +228,10 @@
     }
 
     public void onSurfaceChanged(GL10 glUnused, int width, int height) {
+        Log.i(TAG, "onSurfaceChanged " + width + " " + height);
         mWidth = width;
         mHeight = height;
+        // Set the viewport
+        GLES20.glViewport(0, 0, mWidth, mHeight);
     }
 }
diff --git a/tests/tests/os/src/android/os/cts/BuildVersionTest.java b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
index 8b33359..9876694 100644
--- a/tests/tests/os/src/android/os/cts/BuildVersionTest.java
+++ b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
@@ -29,8 +29,8 @@
 
     private static final String LOG_TAG = "BuildVersionTest";
     private static final Set<String> EXPECTED_RELEASES =
-	    new HashSet<String>(Arrays.asList("4.1.1", "4.1.2"));
-    private static final int EXPECTED_SDK = 16;
+            new HashSet<String>(Arrays.asList("4.2"));
+    private static final int EXPECTED_SDK = 17;
 
     @SuppressWarnings("deprecation")
     public void testReleaseVersion() {