am c857431f: Merge changes If2e86889,I5334d75b into lmp-dev

* commit 'c857431f346b27ebfc3228c369e422d8872afbef':
  Move from uri to name
  Clean up
diff --git a/apps/CtsVerifier/Android.mk b/apps/CtsVerifier/Android.mk
index bcfaf44..e6d7ff7 100644
--- a/apps/CtsVerifier/Android.mk
+++ b/apps/CtsVerifier/Android.mk
@@ -25,6 +25,8 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := cts-sensors-tests ctstestrunner
 
+LOCAL_JAVA_LIBRARIES := android.test.runner
+
 LOCAL_PACKAGE_NAME := CtsVerifier
 
 LOCAL_JNI_SHARED_LIBRARIES := libctsverifier_jni \
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleServerService.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleServerService.java
old mode 100644
new mode 100755
diff --git a/libs/commonutil/src/com/android/cts/util/StatisticsUtils.java b/libs/commonutil/src/com/android/cts/util/StatisticsUtils.java
new file mode 100644
index 0000000..d6589af
--- /dev/null
+++ b/libs/commonutil/src/com/android/cts/util/StatisticsUtils.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.cts.util;
+
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Set of static helper methods for CTS tests.
+ */
+public class StatisticsUtils {
+
+
+    /**
+     * Private constructor for static class.
+     */
+    private StatisticsUtils() {}
+
+    /**
+     * Get the value of the 95th percentile using nearest rank algorithm.
+     *
+     * @throws IllegalArgumentException if the collection is null or empty
+     */
+    public static <TValue extends Comparable<? super TValue>> TValue get95PercentileValue(
+            Collection<TValue> collection) {
+        validateCollection(collection);
+
+        List<TValue> arrayCopy = new ArrayList<TValue>(collection);
+        Collections.sort(arrayCopy);
+
+        // zero-based array index
+        int arrayIndex = (int) Math.round(arrayCopy.size() * 0.95 + .5) - 1;
+
+        return arrayCopy.get(arrayIndex);
+    }
+
+    /**
+     * Calculate the mean of a collection.
+     *
+     * @throws IllegalArgumentException if the collection is null or empty
+     */
+    public static <TValue extends Number> double getMean(Collection<TValue> collection) {
+        validateCollection(collection);
+
+        double sum = 0.0;
+        for(TValue value : collection) {
+            sum += value.doubleValue();
+        }
+        return sum / collection.size();
+    }
+
+    /**
+     * Calculate the bias-corrected sample variance of a collection.
+     *
+     * @throws IllegalArgumentException if the collection is null or empty
+     */
+    public static <TValue extends Number> double getVariance(Collection<TValue> collection) {
+        validateCollection(collection);
+
+        double mean = getMean(collection);
+        ArrayList<Double> squaredDiffs = new ArrayList<Double>();
+        for(TValue value : collection) {
+            double difference = mean - value.doubleValue();
+            squaredDiffs.add(Math.pow(difference, 2));
+        }
+
+        double sum = 0.0;
+        for (Double value : squaredDiffs) {
+            sum += value;
+        }
+        return sum / (squaredDiffs.size() - 1);
+    }
+
+    /**
+     * Calculate the bias-corrected standard deviation of a collection.
+     *
+     * @throws IllegalArgumentException if the collection is null or empty
+     */
+    public static <TValue extends Number> double getStandardDeviation(
+            Collection<TValue> collection) {
+        return Math.sqrt(getVariance(collection));
+    }
+
+    /**
+     * Validate that a collection is not null or empty.
+     *
+     * @throws IllegalStateException if collection is null or empty.
+     */
+    private static <T> void validateCollection(Collection<T> collection) {
+        if(collection == null || collection.size() == 0) {
+            throw new IllegalStateException("Collection cannot be null or empty");
+        }
+    }
+
+}
diff --git a/libs/commonutil/src/com/android/cts/util/StatisticsUtilsTest.java b/libs/commonutil/src/com/android/cts/util/StatisticsUtilsTest.java
new file mode 100644
index 0000000..d78ba99
--- /dev/null
+++ b/libs/commonutil/src/com/android/cts/util/StatisticsUtilsTest.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.cts.util;
+
+import junit.framework.TestCase;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Unit tests for the {@link StatisticsUtils} class.
+ */
+public class StatisticsUtilsTest extends TestCase {
+
+    /**
+     * Test {@link StatisticsUtils#get95PercentileValue(Collection)}.
+     */
+    public void testGet95PercentileValue() {
+        Collection<Integer> values = new HashSet<Integer>();
+        for (int i = 0; i < 100; i++) {
+            values.add(i);
+        }
+        assertEquals(95, (int) StatisticsUtils.get95PercentileValue(values));
+
+        values = new HashSet<Integer>();
+        for (int i = 0; i < 1000; i++) {
+            values.add(i);
+        }
+        assertEquals(950, (int) StatisticsUtils.get95PercentileValue(values));
+
+        values = new HashSet<Integer>();
+        for (int i = 0; i < 100; i++) {
+            values.add(i * i);
+        }
+        assertEquals(95 * 95, (int) StatisticsUtils.get95PercentileValue(values));
+    }
+
+    /**
+     * Test {@link StatisticsUtils#getMean(Collection)}.
+     */
+    public void testGetMean() {
+        List<Integer> values = Arrays.asList(0, 1, 2, 3, 4);
+        double mean = StatisticsUtils.getMean(values);
+        assertEquals(2.0, mean, 0.00001);
+
+        values = Arrays.asList(1, 2, 3, 4, 5);
+        mean = StatisticsUtils.getMean(values);
+        assertEquals(3.0, mean, 0.00001);
+
+        values = Arrays.asList(0, 1, 4, 9, 16);
+        mean = StatisticsUtils.getMean(values);
+        assertEquals(6.0, mean, 0.00001);
+    }
+
+    /**
+     * Test {@link StatisticsUtils#getVariance(Collection)}.
+     */
+    public void testGetVariance() {
+        List<Integer> values = Arrays.asList(0, 1, 2, 3, 4);
+        double variance = StatisticsUtils.getVariance(values);
+        assertEquals(2.5, variance, 0.00001);
+
+        values = Arrays.asList(1, 2, 3, 4, 5);
+        variance = StatisticsUtils.getVariance(values);
+        assertEquals(2.5, variance, 0.00001);
+
+        values = Arrays.asList(0, 2, 4, 6, 8);
+        variance = StatisticsUtils.getVariance(values);
+        assertEquals(10.0, variance, 0.00001);
+    }
+
+    /**
+     * Test {@link StatisticsUtils#getStandardDeviation(Collection)}.
+     */
+    public void testGetStandardDeviation() {
+        List<Integer> values = Arrays.asList(0, 1, 2, 3, 4);
+        double stddev = StatisticsUtils.getStandardDeviation(values);
+        assertEquals(Math.sqrt(2.5), stddev, 0.00001);
+
+        values = Arrays.asList(1, 2, 3, 4, 5);
+        stddev = StatisticsUtils.getStandardDeviation(values);
+        assertEquals(Math.sqrt(2.5), stddev, 0.00001);
+
+        values = Arrays.asList(0, 2, 4, 6, 8);
+        stddev = StatisticsUtils.getStandardDeviation(values);
+        assertEquals(Math.sqrt(10.0), stddev, 0.00001);
+    }
+
+
+}
diff --git a/tests/tests/bionic/Android.mk b/tests/tests/bionic/Android.mk
index 1a048c6..335e7cd 100644
--- a/tests/tests/bionic/Android.mk
+++ b/tests/tests/bionic/Android.mk
@@ -20,6 +20,8 @@
     libBionicTests \
 
 LOCAL_STATIC_LIBRARIES += \
+    libtinyxml2 \
+    liblog \
     libgtest \
     libgtest_main \
 
diff --git a/tests/tests/hardware/Android.mk b/tests/tests/hardware/Android.mk
index e5203e5..153445d 100644
--- a/tests/tests/hardware/Android.mk
+++ b/tests/tests/hardware/Android.mk
@@ -19,8 +19,11 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := cts-sensors-tests
+
 LOCAL_MODULE_TAGS := tests
 
+LOCAL_STATIC_JAVA_LIBRARIES := ctsdeviceutil
+
 LOCAL_SDK_VERSION := current
 
 # TODO: sensors need to be refactored out into their own namespace: android.hardware.sensors.cts
@@ -49,11 +52,8 @@
 
 LOCAL_PACKAGE_NAME := CtsHardwareTestCases
 
-# uncomment when b/13281332 is fixed
-# please also uncomment the equivalent code in
-# cts/apps/CtsVerifiers/Android.mk
-#
-# LOCAL_SDK_VERSION := current
+LOCAL_SDK_VERSION := current
+
 LOCAL_JAVA_LIBRARIES := android.test.runner
 
 include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/hardware/src/android/hardware/cts/helpers/SensorCtsHelper.java b/tests/tests/hardware/src/android/hardware/cts/helpers/SensorCtsHelper.java
index 52f37e8..df69b37 100644
--- a/tests/tests/hardware/src/android/hardware/cts/helpers/SensorCtsHelper.java
+++ b/tests/tests/hardware/src/android/hardware/cts/helpers/SensorCtsHelper.java
@@ -34,70 +34,6 @@
      */
     private SensorCtsHelper() {}
 
-    /**
-     * Get the value of the 95th percentile using nearest rank algorithm.
-     *
-     * @throws IllegalArgumentException if the collection is null or empty
-     */
-    public static <TValue extends Comparable<? super TValue>> TValue get95PercentileValue(
-            Collection<TValue> collection) {
-        validateCollection(collection);
-
-        List<TValue> arrayCopy = new ArrayList<TValue>(collection);
-        Collections.sort(arrayCopy);
-
-        // zero-based array index
-        int arrayIndex = (int) Math.round(arrayCopy.size() * 0.95 + .5) - 1;
-
-        return arrayCopy.get(arrayIndex);
-    }
-
-    /**
-     * Calculate the mean of a collection.
-     *
-     * @throws IllegalArgumentException if the collection is null or empty
-     */
-    public static <TValue extends Number> double getMean(Collection<TValue> collection) {
-        validateCollection(collection);
-
-        double sum = 0.0;
-        for(TValue value : collection) {
-            sum += value.doubleValue();
-        }
-        return sum / collection.size();
-    }
-
-    /**
-     * Calculate the bias-corrected sample variance of a collection.
-     *
-     * @throws IllegalArgumentException if the collection is null or empty
-     */
-    public static <TValue extends Number> double getVariance(Collection<TValue> collection) {
-        validateCollection(collection);
-
-        double mean = getMean(collection);
-        ArrayList<Double> squaredDiffs = new ArrayList<Double>();
-        for(TValue value : collection) {
-            double difference = mean - value.doubleValue();
-            squaredDiffs.add(Math.pow(difference, 2));
-        }
-
-        double sum = 0.0;
-        for (Double value : squaredDiffs) {
-            sum += value;
-        }
-        return sum / (squaredDiffs.size() - 1);
-    }
-
-    /**
-     * Calculate the bias-corrected standard deviation of a collection.
-     *
-     * @throws IllegalArgumentException if the collection is null or empty
-     */
-    public static <TValue extends Number> double getStandardDeviation(
-            Collection<TValue> collection) {
-        return Math.sqrt(getVariance(collection));
-    }
 
     /**
      * Convert a period to frequency in Hz.
diff --git a/tests/tests/hardware/src/android/hardware/cts/helpers/SensorCtsHelperTest.java b/tests/tests/hardware/src/android/hardware/cts/helpers/SensorCtsHelperTest.java
index 6f99692..daac8d1 100644
--- a/tests/tests/hardware/src/android/hardware/cts/helpers/SensorCtsHelperTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/helpers/SensorCtsHelperTest.java
@@ -30,80 +30,6 @@
 public class SensorCtsHelperTest extends TestCase {
 
     /**
-     * Test {@link SensorCtsHelper#get95PercentileValue(Collection)}.
-     */
-    public void testGet95PercentileValue() {
-        Collection<Integer> values = new HashSet<Integer>();
-        for (int i = 0; i < 100; i++) {
-            values.add(i);
-        }
-        assertEquals(95, (int) SensorCtsHelper.get95PercentileValue(values));
-
-        values = new HashSet<Integer>();
-        for (int i = 0; i < 1000; i++) {
-            values.add(i);
-        }
-        assertEquals(950, (int) SensorCtsHelper.get95PercentileValue(values));
-
-        values = new HashSet<Integer>();
-        for (int i = 0; i < 100; i++) {
-            values.add(i * i);
-        }
-        assertEquals(95 * 95, (int) SensorCtsHelper.get95PercentileValue(values));
-    }
-
-    /**
-     * Test {@link SensorCtsHelper#getMean(Collection)}.
-     */
-    public void testGetMean() {
-        List<Integer> values = Arrays.asList(0, 1, 2, 3, 4);
-        double mean = SensorCtsHelper.getMean(values);
-        assertEquals(2.0, mean, 0.00001);
-
-        values = Arrays.asList(1, 2, 3, 4, 5);
-        mean = SensorCtsHelper.getMean(values);
-        assertEquals(3.0, mean, 0.00001);
-
-        values = Arrays.asList(0, 1, 4, 9, 16);
-        mean = SensorCtsHelper.getMean(values);
-        assertEquals(6.0, mean, 0.00001);
-    }
-
-    /**
-     * Test {@link SensorCtsHelper#getVariance(Collection)}.
-     */
-    public void testGetVariance() {
-        List<Integer> values = Arrays.asList(0, 1, 2, 3, 4);
-        double variance = SensorCtsHelper.getVariance(values);
-        assertEquals(2.5, variance, 0.00001);
-
-        values = Arrays.asList(1, 2, 3, 4, 5);
-        variance = SensorCtsHelper.getVariance(values);
-        assertEquals(2.5, variance, 0.00001);
-
-        values = Arrays.asList(0, 2, 4, 6, 8);
-        variance = SensorCtsHelper.getVariance(values);
-        assertEquals(10.0, variance, 0.00001);
-    }
-
-    /**
-     * Test {@link SensorCtsHelper#getStandardDeviation(Collection)}.
-     */
-    public void testGetStandardDeviation() {
-        List<Integer> values = Arrays.asList(0, 1, 2, 3, 4);
-        double stddev = SensorCtsHelper.getStandardDeviation(values);
-        assertEquals(Math.sqrt(2.5), stddev, 0.00001);
-
-        values = Arrays.asList(1, 2, 3, 4, 5);
-        stddev = SensorCtsHelper.getStandardDeviation(values);
-        assertEquals(Math.sqrt(2.5), stddev, 0.00001);
-
-        values = Arrays.asList(0, 2, 4, 6, 8);
-        stddev = SensorCtsHelper.getStandardDeviation(values);
-        assertEquals(Math.sqrt(10.0), stddev, 0.00001);
-    }
-
-    /**
      * Test {@link SensorCtsHelper#getFrequency(Number, TimeUnit)}.
      */
     public void testGetFrequency() {
diff --git a/tests/tests/hardware/src/android/hardware/cts/helpers/sensorverification/JitterVerification.java b/tests/tests/hardware/src/android/hardware/cts/helpers/sensorverification/JitterVerification.java
index 97d2f5b..b44eed7 100644
--- a/tests/tests/hardware/src/android/hardware/cts/helpers/sensorverification/JitterVerification.java
+++ b/tests/tests/hardware/src/android/hardware/cts/helpers/sensorverification/JitterVerification.java
@@ -24,6 +24,8 @@
 import android.hardware.cts.helpers.TestSensorEnvironment;
 import android.hardware.cts.helpers.TestSensorEvent;
 
+import com.android.cts.util.StatisticsUtils;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -93,7 +95,7 @@
         }
 
         List<Double> jitters = getJitterValues();
-        double jitter95Percentile = SensorCtsHelper.get95PercentileValue(jitters);
+        double jitter95Percentile = StatisticsUtils.get95PercentileValue(jitters);
         boolean failed = (jitter95Percentile > mExpected * (mThreshold / 100.0));
 
         stats.addValue(PASSED_KEY, !failed);
@@ -129,7 +131,7 @@
         for (int i = 1; i < mTimestamps.size(); i++) {
             deltas.add(mTimestamps.get(i) - mTimestamps.get(i -1));
         }
-        double deltaMean = SensorCtsHelper.getMean(deltas);
+        double deltaMean = StatisticsUtils.getMean(deltas);
         List<Double> jitters = new ArrayList<Double>(deltas.size());
         for (long delta : deltas) {
             jitters.add(Math.abs(delta - deltaMean));
diff --git a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
index b2b6620..0b1836a 100644
--- a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
+++ b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
@@ -675,6 +675,7 @@
             } catch (InterruptedException e) {
                 // don't care
             }
+            cleanupGl();
             mCompositionThread = null;
             mSurface = null;
             mStartCompletionSemaphore = null;
@@ -984,6 +985,7 @@
 
             public void cleanup() {
                 mNumTextureUpdated.set(0);
+                mVerticesData.clear();
                 if (mTextureId != 0) {
                     int[] textures = new int[] {
                             mTextureId
diff --git a/tests/tests/media/src/android/media/cts/ExtractDecodeEditEncodeMuxTest.java b/tests/tests/media/src/android/media/cts/ExtractDecodeEditEncodeMuxTest.java
index 43b769a..fe8f71b 100644
--- a/tests/tests/media/src/android/media/cts/ExtractDecodeEditEncodeMuxTest.java
+++ b/tests/tests/media/src/android/media/cts/ExtractDecodeEditEncodeMuxTest.java
@@ -29,6 +29,10 @@
 import android.util.Log;
 import android.view.Surface;
 
+import android.media.MediaCodecInfo;
+import android.media.MediaCodecInfo.CodecCapabilities;
+import android.media.MediaCodecInfo.CodecProfileLevel;
+
 import com.android.cts.media.R;
 
 import java.io.File;
@@ -109,28 +113,28 @@
     private String mOutputFile;
 
     public void testExtractDecodeEditEncodeMuxQCIF() throws Throwable {
-        setSize(176, 144);
+        if(!setSize(176, 144)) return;
         setSource(R.raw.video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz);
         setCopyVideo();
         TestWrapper.runTest(this);
     }
 
     public void testExtractDecodeEditEncodeMuxQVGA() throws Throwable {
-        setSize(320, 240);
+        if(!setSize(320, 240)) return;
         setSource(R.raw.video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz);
         setCopyVideo();
         TestWrapper.runTest(this);
     }
 
     public void testExtractDecodeEditEncodeMux720p() throws Throwable {
-        setSize(1280, 720);
+        if(!setSize(1280, 720)) return;
         setSource(R.raw.video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz);
         setCopyVideo();
         TestWrapper.runTest(this);
     }
 
     public void testExtractDecodeEditEncodeMuxAudio() throws Throwable {
-        setSize(1280, 720);
+        if(!setSize(1280, 720)) return;
         setSource(R.raw.video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz);
         setCopyAudio();
         setVerifyAudioFormat();
@@ -138,7 +142,7 @@
     }
 
     public void testExtractDecodeEditEncodeMuxAudioVideo() throws Throwable {
-        setSize(1280, 720);
+        if(!setSize(1280, 720)) return;
         setSource(R.raw.video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz);
         setCopyAudio();
         setCopyVideo();
@@ -201,14 +205,20 @@
     }
 
     /**
-     * Sets the desired frame size.
+     * Sets the desired frame size and returns whether the given resolution is
+     * supported.
+     *
+     * <p>If decoding/encoding using AVC as the codec, checks that the resolution
+     * is supported. For other codecs, always return {@code true}.
      */
-    private void setSize(int width, int height) {
+    private boolean setSize(int width, int height) {
         if ((width % 16) != 0 || (height % 16) != 0) {
             Log.w(TAG, "WARNING: width or height not multiple of 16");
         }
         mWidth = width;
         mHeight = height;
+
+        return isAvcSupportedSize(width, height);
     }
 
     /**
@@ -1150,4 +1160,63 @@
         return null;
     }
 
+  /**
+   * Checks whether the given resolution is supported by the AVC codec.
+   */
+    private static boolean isAvcSupportedSize(int width, int height) {
+        MediaCodecInfo mediaCodecInfo = selectCodec(OUTPUT_VIDEO_MIME_TYPE);
+        CodecCapabilities cap = mediaCodecInfo.getCapabilitiesForType(OUTPUT_VIDEO_MIME_TYPE);
+        if (cap == null) { // not supported
+            return false;
+        }
+        int highestLevel = 0;
+        for (CodecProfileLevel lvl : cap.profileLevels) {
+            if (lvl.level > highestLevel) {
+                highestLevel = lvl.level;
+            }
+        }
+        int maxW = 0;
+        int maxH = 0;
+        int bitRate = 0;
+        int fps = 0; // frame rate for the max resolution
+        switch(highestLevel) {
+            // Do not support Level 1 to 2.
+            case CodecProfileLevel.AVCLevel1:
+            case CodecProfileLevel.AVCLevel11:
+            case CodecProfileLevel.AVCLevel12:
+            case CodecProfileLevel.AVCLevel13:
+            case CodecProfileLevel.AVCLevel1b:
+            case CodecProfileLevel.AVCLevel2:
+                return false;
+            case CodecProfileLevel.AVCLevel21:
+                maxW = 352;
+                maxH = 576;
+                break;
+            case CodecProfileLevel.AVCLevel22:
+                maxW = 720;
+                maxH = 480;
+                break;
+            case CodecProfileLevel.AVCLevel3:
+                maxW = 720;
+                maxH = 480;
+                break;
+            case CodecProfileLevel.AVCLevel31:
+                maxW = 1280;
+                maxH = 720;
+                break;
+            case CodecProfileLevel.AVCLevel32:
+                maxW = 1280;
+                maxH = 720;
+                break;
+            case CodecProfileLevel.AVCLevel4: // only try up to 1080p
+            default:
+                maxW = 1920;
+                maxH = 1080;
+                break;
+        }
+        if(maxW*maxH < width*height)
+            return false;
+        else
+            return true;
+    }
 }
diff --git a/tests/tests/net/src/android/net/cts/LocalSocketTest.java b/tests/tests/net/src/android/net/cts/LocalSocketTest.java
index 0a4bc0d..865ec21 100644
--- a/tests/tests/net/src/android/net/cts/LocalSocketTest.java
+++ b/tests/tests/net/src/android/net/cts/LocalSocketTest.java
@@ -126,8 +126,8 @@
         socket.setReceiveBufferSize(1999);
         assertEquals(1999 << 1, socket.getReceiveBufferSize());
 
-        socket.setSendBufferSize(1998);
-        assertEquals(1998 << 1, socket.getSendBufferSize());
+        socket.setSendBufferSize(3998);
+        assertEquals(3998 << 1, socket.getSendBufferSize());
 
         // Timeout is not support at present, so set is ignored
         socket.setSoTimeout(1996);
diff --git a/tests/tests/renderscript/libcoremathtestcpp/Android.mk b/tests/tests/renderscript/libcoremathtestcpp/Android.mk
index 7ec8671..813b27e 100644
--- a/tests/tests/renderscript/libcoremathtestcpp/Android.mk
+++ b/tests/tests/renderscript/libcoremathtestcpp/Android.mk
@@ -21,6 +21,8 @@
 LOCAL_MODULE_TAGS := optional
 LOCAL_SRC_FILES := CoreMathTestJni.cpp
 
+LOCAL_CFLAGS := -std=c++11
+
 LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
 LOCAL_C_INCLUDES += frameworks/rs/cpp
 LOCAL_C_INCLUDES += frameworks/rs
diff --git a/tests/tests/security/jni/android_security_cts_SELinuxTest.cpp b/tests/tests/security/jni/android_security_cts_SELinuxTest.cpp
index c6ce1ef..daac7d9 100644
--- a/tests/tests/security/jni/android_security_cts_SELinuxTest.cpp
+++ b/tests/tests/security/jni/android_security_cts_SELinuxTest.cpp
@@ -71,9 +71,19 @@
             (void *) android_security_cts_SELinuxTest_checkSELinuxContext },
 };
 
+static int log_callback(int type __attribute__((unused)), const char *fmt __attribute__((unused)), ...)
+{
+    /* do nothing - silence the avc denials */
+    return 0;
+}
+
 int register_android_security_cts_SELinuxTest(JNIEnv* env)
 {
     jclass clazz = env->FindClass("android/security/cts/SELinuxTest");
+    union selinux_callback cb;
+    cb.func_log = log_callback;
+    selinux_set_callback(SELINUX_CB_LOG, cb);
+
     return env->RegisterNatives(clazz, gMethods,
             sizeof(gMethods) / sizeof(JNINativeMethod));
 }