Split SELinux neverallow rules test.
automerge: 8e1f6e4

* commit '8e1f6e4a0868bb0bfce4341b068898ec615cd6b8':
  Split SELinux neverallow rules test.
diff --git a/apps/CtsVerifier/Android.mk b/apps/CtsVerifier/Android.mk
index e370c81..54fc4b1 100644
--- a/apps/CtsVerifier/Android.mk
+++ b/apps/CtsVerifier/Android.mk
@@ -27,6 +27,8 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := cts-sensors-tests ctstestrunner android-ex-camera2
 
+LOCAL_JAVA_LIBRARIES := android.test.runner
+
 LOCAL_PACKAGE_NAME := CtsVerifier
 
 LOCAL_JNI_SHARED_LIBRARIES := libctsverifier_jni \
diff --git a/apps/CtsVerifier/jni/cameraanalyzer/Android.mk b/apps/CtsVerifier/jni/cameraanalyzer/Android.mk
index ed66992..d595a20 100644
--- a/apps/CtsVerifier/jni/cameraanalyzer/Android.mk
+++ b/apps/CtsVerifier/jni/cameraanalyzer/Android.mk
@@ -16,7 +16,7 @@
 LOCAL_PATH := $(call my-dir)
 
 include $(CLEAR_VARS)
-include external/stlport/libstlport.mk
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_MODULE := libcameraanalyzer
 
@@ -31,10 +31,12 @@
 
 LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../include/colorchecker $(JNI_H_INCLUDE)
 
+LOCAL_CXX_STL := libc++
 LOCAL_STATIC_LIBRARIES := libcolorchecker
-LOCAL_SHARED_LIBRARIES := libjnigraphics \
-                          libstlport \
-                          libcutils \
-                          libutils liblog
+LOCAL_SHARED_LIBRARIES := \
+    libjnigraphics \
+    libcutils \
+    libutils \
+    liblog \
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/apps/CtsVerifier/lib/colorchecker/Android.mk b/apps/CtsVerifier/lib/colorchecker/Android.mk
index 38f595f..48f1356 100644
--- a/apps/CtsVerifier/lib/colorchecker/Android.mk
+++ b/apps/CtsVerifier/lib/colorchecker/Android.mk
@@ -19,7 +19,7 @@
 # Build image analysis library
 
 include $(CLEAR_VARS)
-include external/stlport/libstlport.mk
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE := libcolorchecker
@@ -35,8 +35,9 @@
                    whitebalancetest.cpp
 
 LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../include/colorchecker
-LOCAL_SHARED_LIBRARIES := libstlport \
-                          libcutils \
-                          libutils
+LOCAL_CXX_STL := libc++
+LOCAL_SHARED_LIBRARIES := \
+    libcutils \
+    libutils \
 
 include $(BUILD_STATIC_LIBRARY)
diff --git a/apps/CtsVerifier/lib/colorchecker/colorcheckertest.cpp b/apps/CtsVerifier/lib/colorchecker/colorcheckertest.cpp
index 46b8cc8..ef7d2c6 100644
--- a/apps/CtsVerifier/lib/colorchecker/colorcheckertest.cpp
+++ b/apps/CtsVerifier/lib/colorchecker/colorcheckertest.cpp
@@ -549,10 +549,10 @@
         (pointBottomRight.x() >= mImage->getHeight()) ||
         (pointBottomRight.y() < 0) ||
         (pointBottomRight.y() >= mImage->getWidth()) ||
-        (abs(pointUpperLeft.x() - pointBottomRight.x()) <= 5) ||
-        (abs(pointUpperLeft.y() - pointBottomRight.y()) <= 5) ||
-        (abs(pointUpperLeft.x() - pointBottomRight.x()) >= 30) ||
-        (abs(pointUpperLeft.y() - pointBottomRight.y()) >= 30)) {
+        (std::abs(pointUpperLeft.x() - pointBottomRight.x()) <= 5) ||
+        (std::abs(pointUpperLeft.y() - pointBottomRight.y()) <= 5) ||
+        (std::abs(pointUpperLeft.x() - pointBottomRight.x()) >= 30) ||
+        (std::abs(pointUpperLeft.y() - pointBottomRight.y()) >= 30)) {
 
         // If any of the quadrilateral corners are out of the image or if
         // the distance between them are too large or too big, the quadrilateral
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/build/test_executable.mk b/build/test_executable.mk
index e0352ba..35bf199 100644
--- a/build/test_executable.mk
+++ b/build/test_executable.mk
@@ -23,6 +23,7 @@
 #    as needed by CTS.
 #
 
+LOCAL_CXX_STL := libc++
 include $(BUILD_EXECUTABLE)
 
 cts_executable_xml := $(CTS_TESTCASES_OUT)/$(LOCAL_MODULE).xml
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/suite/audio_quality/test/Android.mk b/suite/audio_quality/test/Android.mk
index 4582fe7..bd0033f 100644
--- a/suite/audio_quality/test/Android.mk
+++ b/suite/audio_quality/test/Android.mk
@@ -34,7 +34,7 @@
 # functions and linker error happens
 LOCAL_WHOLE_STATIC_LIBRARIES := libcts_audio_quality
 LOCAL_CFLAGS:= -g -fno-exceptions
-LOCAL_LDFLAGS:= -g -lrt -ldl -lstdc++ -lm -fno-exceptions -lpthread
+LOCAL_LDFLAGS:= -g -lrt -ldl -lm -fno-exceptions -lpthread
 LOCAL_MODULE:= cts_audio_quality_test
 include $(BUILD_HOST_EXECUTABLE)
 
diff --git a/suite/cts/deviceTests/opengl/jni/reference/scene/flocking/Boid.h b/suite/cts/deviceTests/opengl/jni/reference/scene/flocking/Boid.h
index e50acd0..3e4367a 100644
--- a/suite/cts/deviceTests/opengl/jni/reference/scene/flocking/Boid.h
+++ b/suite/cts/deviceTests/opengl/jni/reference/scene/flocking/Boid.h
@@ -16,6 +16,7 @@
 #define BOID_H
 
 #include <graphics/Vector2D.h>
+#include <utils/Compat.h>
 
 class Boid {
 public:
@@ -24,14 +25,14 @@
     void flock(const Boid* boids[], int numBoids, int index, float limitX, float limitY);
     // The following floats are the parameters for the flocking algorithm, changing these
     // modifies the boid's behaviour.
-    static const float MAX_SPEED = 2.0f;// Upper limit of boid velocity.
-    static const float MAX_FORCE = 0.05f;// Upper limit of the force used to push a boid.
-    static const float NEIGHBOUR_RADIUS = 70.0f;// Radius used to find neighbours, was 50.
-    static const float DESIRED_BOID_DIST = 35.0f;// Distance boids want to be from others, was 25.
+    static const CONSTEXPR float MAX_SPEED = 2.0f;// Upper limit of boid velocity.
+    static const CONSTEXPR float MAX_FORCE = 0.05f;// Upper limit of the force used to push a boid.
+    static const CONSTEXPR float NEIGHBOUR_RADIUS = 70.0f;// Radius used to find neighbours, was 50.
+    static const CONSTEXPR float DESIRED_BOID_DIST = 35.0f;// Distance boids want to be from others, was 25.
     // The weightings of the components.
-    static const float SEPARATION_WEIGHT = 2.0f;
-    static const float ALIGNMENT_WEIGHT = 1.0f;
-    static const float COHESION_WEIGHT = 1.0f;
+    static const CONSTEXPR float SEPARATION_WEIGHT = 2.0f;
+    static const CONSTEXPR float ALIGNMENT_WEIGHT = 1.0f;
+    static const CONSTEXPR float COHESION_WEIGHT = 1.0f;
     Vector2D mPosition;
     Vector2D mVelocity;
     Vector2D mAcceleration;
diff --git a/suite/cts/deviceTests/opengl/jni/reference/scene/flocking/FlockingScene.h b/suite/cts/deviceTests/opengl/jni/reference/scene/flocking/FlockingScene.h
index 97bd4cc..7cdcffe 100644
--- a/suite/cts/deviceTests/opengl/jni/reference/scene/flocking/FlockingScene.h
+++ b/suite/cts/deviceTests/opengl/jni/reference/scene/flocking/FlockingScene.h
@@ -15,6 +15,7 @@
 #define FLOCKINGSCENE_H
 
 #include <graphics/Program.h>
+#include <utils/Compat.h>
 
 #include "../Scene.h"
 #include "Boid.h"
@@ -41,6 +42,6 @@
     float mBoardHeight;
     Program* mMainProgram;
     Program* mWaterProgram;
-    static const float BOID_SCALE = 1.0f / 50.0f;
+    static const CONSTEXPR float BOID_SCALE = 1.0f / 50.0f;
 };
 #endif
diff --git a/suite/cts/deviceTests/opengl/test/Android.mk b/suite/cts/deviceTests/opengl/test/Android.mk
index a4abe4f..5270bac 100644
--- a/suite/cts/deviceTests/opengl/test/Android.mk
+++ b/suite/cts/deviceTests/opengl/test/Android.mk
@@ -18,6 +18,7 @@
 
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_MODULE_TAGS := optional
 LOCAL_SRC_FILES := $(patsubst ./%,%, $(shell cd $(LOCAL_PATH); \
@@ -26,8 +27,8 @@
 
 #$(info $(LOCAL_SRC_FILES))
 LOCAL_C_INCLUDES += external/gtest/include $(LOCAL_PATH)/../jni/graphics/
-LOCAL_STATIC_LIBRARIES := libutils libcutils libgtest_host libgtest_main_host liblog
-LOCAL_LDFLAGS:= -g -lrt -ldl -lstdc++ -lm -fno-exceptions -lpthread
+LOCAL_STATIC_LIBRARIES := libgtest_host libgtest_main_host liblog
+LOCAL_LDFLAGS:= -g -lpthread
 LOCAL_MODULE:= cts_device_opengl_test
 include $(BUILD_HOST_EXECUTABLE)
 
diff --git a/tests/tests/bionic/Android.mk b/tests/tests/bionic/Android.mk
index e1afd50..f81bcd9 100644
--- a/tests/tests/bionic/Android.mk
+++ b/tests/tests/bionic/Android.mk
@@ -4,6 +4,7 @@
 list_executable := $(test_executable)_list
 
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_MODULE := $(test_executable)
 LOCAL_MODULE_TAGS := optional
@@ -12,17 +13,15 @@
 LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
 LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
 
-LOCAL_ADDITION_DEPENDENCIES := \
-    $(LOCAL_PATH)/Android.mk \
-
 LOCAL_SHARED_LIBRARIES += \
-    libstlport \
     libdl \
 
 LOCAL_WHOLE_STATIC_LIBRARIES += \
     libBionicTests \
 
 LOCAL_STATIC_LIBRARIES += \
+    libtinyxml2 \
+    liblog \
     libgtest \
     libgtest_main \
 
@@ -31,6 +30,7 @@
 
 ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE := $(list_executable)
@@ -39,9 +39,6 @@
 LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)
 LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
 
-LOCAL_ADDITION_DEPENDENCIES := \
-    $(LOCAL_PATH)/Android.mk \
-
 # A main without the extra output from the gtest main.
 LOCAL_SRC_FILES := \
     main.cpp \
@@ -52,5 +49,7 @@
 LOCAL_WHOLE_STATIC_LIBRARIES += \
     libBionicTests \
 
+LOCAL_CXX_STL := libc++
+
 include $(BUILD_HOST_NATIVE_TEST)
 endif  # ifeq ($(HOST_OS)-$(HOST_ARCH),$(filter $(HOST_OS)-$(HOST_ARCH),linux-x86 linux-x86_64))
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/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 f95ea0b..6633903 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
@@ -25,6 +25,8 @@
 import android.hardware.cts.helpers.TestSensorEvent;
 import android.util.SparseIntArray;
 
+import com.android.cts.util.StatisticsUtils;
+
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
@@ -131,7 +133,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 9c99c2d..0129b44 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/nativemedia/sl/Android.mk b/tests/tests/nativemedia/sl/Android.mk
index 48b816c..28dfeff 100644
--- a/tests/tests/nativemedia/sl/Android.mk
+++ b/tests/tests/nativemedia/sl/Android.mk
@@ -6,6 +6,7 @@
 list_executable := $(test_executable)_list
 
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_MODULE := $(test_executable)
 LOCAL_MODULE_TAGS := optional
@@ -15,11 +16,8 @@
 LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
 
 LOCAL_C_INCLUDES := \
-    bionic \
-    bionic/libstdc++/include \
     external/gtest/include \
     $(call include-path-for, wilhelm) \
-    external/stlport/stlport \
     $(call include-path-for, wilhelm-ut)
 
 LOCAL_SRC_FILES := \
@@ -29,7 +27,6 @@
     libutils \
     liblog \
     libOpenSLES \
-    libstlport
 
 LOCAL_STATIC_LIBRARIES := \
     libOpenSLESUT \
@@ -39,6 +36,7 @@
 include $(BUILD_CTS_EXECUTABLE)
 
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_MODULE := $(list_executable)
 LOCAL_MODULE_TAGS := optional
diff --git a/tests/tests/nativemedia/xa/Android.mk b/tests/tests/nativemedia/xa/Android.mk
index ace315a..52126c3 100644
--- a/tests/tests/nativemedia/xa/Android.mk
+++ b/tests/tests/nativemedia/xa/Android.mk
@@ -6,6 +6,7 @@
 list_executable := $(test_executable)_list
 
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_MODULE:= $(test_executable)
 LOCAL_MODULE_TAGS := optional
@@ -15,11 +16,8 @@
 LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
 
 LOCAL_C_INCLUDES := \
-    bionic \
-    bionic/libstdc++/include \
     external/gtest/include \
     $(call include-path-for, wilhelm) \
-    external/stlport/stlport \
     $(call include-path-for, wilhelm-ut)
 
 LOCAL_SRC_FILES := \
@@ -29,15 +27,15 @@
   libutils \
   liblog \
   libOpenMAXAL \
-  libstlport
 
 LOCAL_STATIC_LIBRARIES := \
-    libgtest
+  libgtest \
 
 LOCAL_CTS_TEST_PACKAGE := android.nativemedia.xa
 include $(BUILD_CTS_EXECUTABLE)
 
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_MODULE := $(list_executable)
 LOCAL_MODULE_TAGS := optional
diff --git a/tests/tests/nativeopengl/libnativeopengltests/Android.mk b/tests/tests/nativeopengl/libnativeopengltests/Android.mk
index 5d7dd6e..62e28ec 100644
--- a/tests/tests/nativeopengl/libnativeopengltests/Android.mk
+++ b/tests/tests/nativeopengl/libnativeopengltests/Android.mk
@@ -16,9 +16,11 @@
 # This is the shared library included by the JNI test app.
 #
 
-LOCAL_PATH:= $(call my-dir)/../standalone/jni/
+LOCAL_PATH := $(call my-dir)/../standalone/jni/
+REAL_LOCAL_PATH := $(call my-dir)
 
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(REAL_LOCAL_PATH)/Android.mk
 
 LOCAL_MODULE := libnativeopengltests
 
@@ -26,10 +28,7 @@
 LOCAL_MODULE_TAGS := optional
 
 LOCAL_C_INCLUDES := $(JNI_H_INCLUDE) \
-    bionic \
-    bionic/libstdc++/include \
     external/gtest/include \
-    external/stlport/stlport
 
 LOCAL_SRC_FILES := \
         register.cpp \
@@ -38,11 +37,11 @@
         tests/EGLCleanup_test.cpp \
         tests/EGLCreateContext_test.cpp
 
+LOCAL_CXX_STL := libc++
 LOCAL_SHARED_LIBRARIES := libEGL \
                           libGLESv2 \
-                          libstlport \
                           libandroid \
-                          liblog
+                          liblog \
 
 LOCAL_STATIC_LIBRARIES := libgtest
 
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/net/src/android/net/cts/SSLCertificateSocketFactoryTest.java b/tests/tests/net/src/android/net/cts/SSLCertificateSocketFactoryTest.java
index 6175923..60ac226 100644
--- a/tests/tests/net/src/android/net/cts/SSLCertificateSocketFactoryTest.java
+++ b/tests/tests/net/src/android/net/cts/SSLCertificateSocketFactoryTest.java
@@ -26,7 +26,7 @@
 import android.net.SSLCertificateSocketFactory;
 import android.test.AndroidTestCase;
 
-import libcore.javax.net.ssl.SSLDefaultConfigurationAsserts;
+import libcore.javax.net.ssl.SSLConfigurationAsserts;
 
 public class SSLCertificateSocketFactoryTest extends AndroidTestCase {
     private SSLCertificateSocketFactory mFactory;
@@ -40,7 +40,7 @@
     }
 
     public void testDefaultConfiguration() throws Exception {
-        SSLDefaultConfigurationAsserts.assertSSLSocketFactory(mFactory);
+        SSLConfigurationAsserts.assertSSLSocketFactoryDefaultConfiguration(mFactory);
     }
 
     public void testAccessProperties() throws Exception {
diff --git a/tests/tests/renderscript/libcoremathtestcpp/Android.mk b/tests/tests/renderscript/libcoremathtestcpp/Android.mk
index 7ec8671..3b693e0 100644
--- a/tests/tests/renderscript/libcoremathtestcpp/Android.mk
+++ b/tests/tests/renderscript/libcoremathtestcpp/Android.mk
@@ -17,15 +17,17 @@
 #
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 LOCAL_MODULE := libcoremathtestcpp_jni
 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
-LOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include
 
-LOCAL_SHARED_LIBRARIES := libdl liblog libRScpp libstlport
+LOCAL_SHARED_LIBRARIES := libdl liblog libRScpp
 LOCAL_STATIC_LIBRARIES := libcutils
 include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicResize.java b/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicResize.java
index d593bff..9028c37 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicResize.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicResize.java
@@ -67,8 +67,24 @@
                 sr.forEach_bicubic_U1(mAllocDst);
                 break;
             }
+        } else {
+            switch(vecSize) {
+            case 4:
+                sr.forEach_bicubic_F4(mAllocDst);
+                break;
+            case 3:
+                sr.forEach_bicubic_F3(mAllocDst);
+                break;
+            case 2:
+                sr.forEach_bicubic_F2(mAllocDst);
+                break;
+            case 1:
+                sr.forEach_bicubic_F1(mAllocDst);
+                break;
+            }
         }
 
+
         mVerify.invoke_verify(mAllocRef, mAllocDst, mAllocSrc);
         if (outW == w && outH == h) {
             //when scale = 1, check with the original.
@@ -248,4 +264,176 @@
         testReszie(inX, inY, Element.DataType.UNSIGNED_8, 1, 0.5f, 0.5f);
         checkError();
     }
+
+
+    public void test_F32_4_SCALE10_10_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 1.f, 1.f);
+        checkError();
+    }
+    public void test_F32_3_SCALE10_10_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 1.f, 1.f);
+        checkError();
+    }
+    public void test_F32_2_SCALE10_10_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 1.f, 1.f);
+        checkError();
+    }
+    public void test_F32_1_SCALE10_10_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 1.f, 1.f);
+        checkError();
+    }
+
+    public void test_F32_4_SCALE20_20_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 2.f, 2.f);
+        checkError();
+    }
+    public void test_F32_3_SCALE20_20_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 2.f, 2.f);
+        checkError();
+    }
+    public void test_F32_2_SCALE20_20_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 2.f, 2.f);
+        checkError();
+    }
+    public void test_F32_1_SCALE20_20_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 2.f, 2.f);
+        checkError();
+    }
+
+    public void test_F32_4_SCALE05_20_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 0.5f, 2.f);
+        checkError();
+    }
+    public void test_F32_3_SCALE05_20_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 0.5f, 2.f);
+        checkError();
+    }
+    public void test_F32_2_SCALE05_20_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 0.5f, 2.f);
+        checkError();
+    }
+    public void test_F32_1_SCALE05_20_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 0.5f, 2.f);
+        checkError();
+    }
+
+    public void test_F32_4_SCALE20_05_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 2.f, 0.5f);
+        checkError();
+    }
+    public void test_F32_3_SCALE20_05_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 2.f, 0.5f);
+        checkError();
+    }
+    public void test_F32_2_SCALE20_05_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 2.f, 0.5f);
+        checkError();
+    }
+    public void test_F32_1_SCALE20_05_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 2.f, 0.5f);
+        checkError();
+    }
+
+    public void test_F32_4_SCALE05_05_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 0.5f, 0.5f);
+        checkError();
+    }
+    public void test_F32_3_SCALE05_05_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 0.5f, 0.5f);
+        checkError();
+    }
+    public void test_F32_2_SCALE05_05_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 0.5f, 0.5f);
+        checkError();
+    }
+    public void test_F32_1_SCALE05_05_inSqure() {
+        testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 0.5f, 0.5f);
+        checkError();
+    }
+
+    public void test_F32_4_SCALE10_10_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 1.f, 1.f);
+        checkError();
+    }
+    public void test_F32_3_SCALE10_10_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 1.f, 1.f);
+        checkError();
+    }
+    public void test_F32_2_SCALE10_10_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 1.f, 1.f);
+        checkError();
+    }
+    public void test_F32_1_SCALE10_10_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 1.f, 1.f);
+        checkError();
+    }
+
+    public void test_F32_4_SCALE20_20_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 2.f, 2.f);
+        checkError();
+    }
+    public void test_F32_3_SCALE20_20_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 2.f, 2.f);
+        checkError();
+    }
+    public void test_F32_2_SCALE20_20_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 2.f, 2.f);
+        checkError();
+    }
+    public void test_F32_1_SCALE20_20_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 2.f, 2.f);
+        checkError();
+    }
+
+    public void test_F32_4_SCALE05_20_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 0.5f, 2.f);
+        checkError();
+    }
+    public void test_F32_3_SCALE05_20_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 0.5f, 2.f);
+        checkError();
+    }
+    public void test_F32_2_SCALE05_20_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 0.5f, 2.f);
+        checkError();
+    }
+    public void test_F32_1_SCALE05_20_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 0.5f, 2.f);
+        checkError();
+    }
+
+    public void test_F32_4_SCALE20_05_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 2.f, 0.5f);
+        checkError();
+    }
+    public void test_F32_3_SCALE20_05_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 2.f, 0.5f);
+        checkError();
+    }
+    public void test_F32_2_SCALE20_05_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 2.f, 0.5f);
+        checkError();
+    }
+    public void test_F32_1_SCALE20_05_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 2.f, 0.5f);
+        checkError();
+    }
+
+    public void test_F32_4_SCALE05_05_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 0.5f, 0.5f);
+        checkError();
+    }
+    public void test_F32_3_SCALE05_05_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 0.5f, 0.5f);
+        checkError();
+    }
+    public void test_F32_2_SCALE05_05_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 0.5f, 0.5f);
+        checkError();
+    }
+    public void test_F32_1_SCALE05_05_inRectangle() {
+        testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 0.5f, 0.5f);
+        checkError();
+    }
+
 }
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/intrinsic_resize.rs b/tests/tests/renderscript/src/android/renderscript/cts/intrinsic_resize.rs
index fa8c8dd..ccdf42f 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/intrinsic_resize.rs
+++ b/tests/tests/renderscript/src/android/renderscript/cts/intrinsic_resize.rs
@@ -242,3 +242,203 @@
     return (uchar)p;
 }
 
+float4 __attribute__((kernel)) bicubic_F4(uint32_t x, uint32_t y) {
+    float xf = (x + 0.5f) * scaleX - 0.5f;
+    float yf = (y + 0.5f) * scaleY - 0.5f;
+
+    int startx = (int) floor(xf - 1);
+    int starty = (int) floor(yf - 1);
+    xf = xf - floor(xf);
+    yf = yf - floor(yf);
+    int maxx = gWidthIn - 1;
+    int maxy = gHeightIn - 1;
+
+    uint32_t xs0 = (uint32_t) max(0, startx + 0);
+    uint32_t xs1 = (uint32_t) max(0, startx + 1);
+    uint32_t xs2 = (uint32_t) min(maxx, startx + 2);
+    uint32_t xs3 = (uint32_t) min(maxx, startx + 3);
+
+    uint32_t ys0 = (uint32_t) max(0, starty + 0);
+    uint32_t ys1 = (uint32_t) max(0, starty + 1);
+    uint32_t ys2 = (uint32_t) min(maxy, starty + 2);
+    uint32_t ys3 = (uint32_t) min(maxy, starty + 3);
+
+    float4 p00 = rsGetElementAt_float4(gIn, xs0, ys0);
+    float4 p01 = rsGetElementAt_float4(gIn, xs1, ys0);
+    float4 p02 = rsGetElementAt_float4(gIn, xs2, ys0);
+    float4 p03 = rsGetElementAt_float4(gIn, xs3, ys0);
+    float4 p0  = cubicInterpolate_F4(p00, p01, p02, p03, xf);
+
+    float4 p10 = rsGetElementAt_float4(gIn, xs0, ys1);
+    float4 p11 = rsGetElementAt_float4(gIn, xs1, ys1);
+    float4 p12 = rsGetElementAt_float4(gIn, xs2, ys1);
+    float4 p13 = rsGetElementAt_float4(gIn, xs3, ys1);
+    float4 p1  = cubicInterpolate_F4(p10, p11, p12, p13, xf);
+
+    float4 p20 = rsGetElementAt_float4(gIn, xs0, ys2);
+    float4 p21 = rsGetElementAt_float4(gIn, xs1, ys2);
+    float4 p22 = rsGetElementAt_float4(gIn, xs2, ys2);
+    float4 p23 = rsGetElementAt_float4(gIn, xs3, ys2);
+    float4 p2  = cubicInterpolate_F4(p20, p21, p22, p23, xf);
+
+    float4 p30 = rsGetElementAt_float4(gIn, xs0, ys3);
+    float4 p31 = rsGetElementAt_float4(gIn, xs1, ys3);
+    float4 p32 = rsGetElementAt_float4(gIn, xs2, ys3);
+    float4 p33 = rsGetElementAt_float4(gIn, xs3, ys3);
+    float4 p3  = cubicInterpolate_F4(p30, p31, p32, p33, xf);
+
+    float4 p  = cubicInterpolate_F4(p0, p1, p2, p3, yf);
+
+    return p;
+}
+
+float3 __attribute__((kernel)) bicubic_F3(uint32_t x, uint32_t y) {
+    float xf = (x + 0.5f) * scaleX - 0.5f;
+    float yf = (y + 0.5f) * scaleY - 0.5f;
+
+    int startx = (int) floor(xf - 1);
+    int starty = (int) floor(yf - 1);
+    xf = xf - floor(xf);
+    yf = yf - floor(yf);
+    int maxx = gWidthIn - 1;
+    int maxy = gHeightIn - 1;
+
+    uint32_t xs0 = (uint32_t) max(0, startx + 0);
+    uint32_t xs1 = (uint32_t) max(0, startx + 1);
+    uint32_t xs2 = (uint32_t) min(maxx, startx + 2);
+    uint32_t xs3 = (uint32_t) min(maxx, startx + 3);
+
+    uint32_t ys0 = (uint32_t) max(0, starty + 0);
+    uint32_t ys1 = (uint32_t) max(0, starty + 1);
+    uint32_t ys2 = (uint32_t) min(maxy, starty + 2);
+    uint32_t ys3 = (uint32_t) min(maxy, starty + 3);
+
+    float3 p00 = rsGetElementAt_float3(gIn, xs0, ys0);
+    float3 p01 = rsGetElementAt_float3(gIn, xs1, ys0);
+    float3 p02 = rsGetElementAt_float3(gIn, xs2, ys0);
+    float3 p03 = rsGetElementAt_float3(gIn, xs3, ys0);
+    float3 p0  = cubicInterpolate_F3(p00, p01, p02, p03, xf);
+
+    float3 p10 = rsGetElementAt_float3(gIn, xs0, ys1);
+    float3 p11 = rsGetElementAt_float3(gIn, xs1, ys1);
+    float3 p12 = rsGetElementAt_float3(gIn, xs2, ys1);
+    float3 p13 = rsGetElementAt_float3(gIn, xs3, ys1);
+    float3 p1  = cubicInterpolate_F3(p10, p11, p12, p13, xf);
+
+    float3 p20 = rsGetElementAt_float3(gIn, xs0, ys2);
+    float3 p21 = rsGetElementAt_float3(gIn, xs1, ys2);
+    float3 p22 = rsGetElementAt_float3(gIn, xs2, ys2);
+    float3 p23 = rsGetElementAt_float3(gIn, xs3, ys2);
+    float3 p2  = cubicInterpolate_F3(p20, p21, p22, p23, xf);
+
+    float3 p30 = rsGetElementAt_float3(gIn, xs0, ys3);
+    float3 p31 = rsGetElementAt_float3(gIn, xs1, ys3);
+    float3 p32 = rsGetElementAt_float3(gIn, xs2, ys3);
+    float3 p33 = rsGetElementAt_float3(gIn, xs3, ys3);
+    float3 p3  = cubicInterpolate_F3(p30, p31, p32, p33, xf);
+
+    float3 p  = cubicInterpolate_F3(p0, p1, p2, p3, yf);
+
+    return p;
+}
+
+float2 __attribute__((kernel)) bicubic_F2(uint32_t x, uint32_t y) {
+    float xf = (x + 0.5f) * scaleX - 0.5f;
+    float yf = (y + 0.5f) * scaleY - 0.5f;
+
+    int startx = (int) floor(xf - 1);
+    int starty = (int) floor(yf - 1);
+    xf = xf - floor(xf);
+    yf = yf - floor(yf);
+    int maxx = gWidthIn - 1;
+    int maxy = gHeightIn - 1;
+
+    uint32_t xs0 = (uint32_t) max(0, startx + 0);
+    uint32_t xs1 = (uint32_t) max(0, startx + 1);
+    uint32_t xs2 = (uint32_t) min(maxx, startx + 2);
+    uint32_t xs3 = (uint32_t) min(maxx, startx + 3);
+
+    uint32_t ys0 = (uint32_t) max(0, starty + 0);
+    uint32_t ys1 = (uint32_t) max(0, starty + 1);
+    uint32_t ys2 = (uint32_t) min(maxy, starty + 2);
+    uint32_t ys3 = (uint32_t) min(maxy, starty + 3);
+
+    float2 p00 = rsGetElementAt_float2(gIn, xs0, ys0);
+    float2 p01 = rsGetElementAt_float2(gIn, xs1, ys0);
+    float2 p02 = rsGetElementAt_float2(gIn, xs2, ys0);
+    float2 p03 = rsGetElementAt_float2(gIn, xs3, ys0);
+    float2 p0  = cubicInterpolate_F2(p00, p01, p02, p03, xf);
+
+    float2 p10 = rsGetElementAt_float2(gIn, xs0, ys1);
+    float2 p11 = rsGetElementAt_float2(gIn, xs1, ys1);
+    float2 p12 = rsGetElementAt_float2(gIn, xs2, ys1);
+    float2 p13 = rsGetElementAt_float2(gIn, xs3, ys1);
+    float2 p1  = cubicInterpolate_F2(p10, p11, p12, p13, xf);
+
+    float2 p20 = rsGetElementAt_float2(gIn, xs0, ys2);
+    float2 p21 = rsGetElementAt_float2(gIn, xs1, ys2);
+    float2 p22 = rsGetElementAt_float2(gIn, xs2, ys2);
+    float2 p23 = rsGetElementAt_float2(gIn, xs3, ys2);
+    float2 p2  = cubicInterpolate_F2(p20, p21, p22, p23, xf);
+
+    float2 p30 = rsGetElementAt_float2(gIn, xs0, ys3);
+    float2 p31 = rsGetElementAt_float2(gIn, xs1, ys3);
+    float2 p32 = rsGetElementAt_float2(gIn, xs2, ys3);
+    float2 p33 = rsGetElementAt_float2(gIn, xs3, ys3);
+    float2 p3  = cubicInterpolate_F2(p30, p31, p32, p33, xf);
+
+    float2 p  = cubicInterpolate_F2(p0, p1, p2, p3, yf);
+
+    return p;
+}
+
+float __attribute__((kernel)) bicubic_F1(uint32_t x, uint32_t y) {
+    float xf = (x + 0.5f) * scaleX - 0.5f;
+    float yf = (y + 0.5f) * scaleY - 0.5f;
+
+    int startx = (int) floor(xf - 1);
+    int starty = (int) floor(yf - 1);
+    xf = xf - floor(xf);
+    yf = yf - floor(yf);
+    int maxx = gWidthIn - 1;
+    int maxy = gHeightIn - 1;
+
+    uint32_t xs0 = (uint32_t) max(0, startx + 0);
+    uint32_t xs1 = (uint32_t) max(0, startx + 1);
+    uint32_t xs2 = (uint32_t) min(maxx, startx + 2);
+    uint32_t xs3 = (uint32_t) min(maxx, startx + 3);
+
+    uint32_t ys0 = (uint32_t) max(0, starty + 0);
+    uint32_t ys1 = (uint32_t) max(0, starty + 1);
+    uint32_t ys2 = (uint32_t) min(maxy, starty + 2);
+    uint32_t ys3 = (uint32_t) min(maxy, starty + 3);
+
+    float p00 = rsGetElementAt_float(gIn, xs0, ys0);
+    float p01 = rsGetElementAt_float(gIn, xs1, ys0);
+    float p02 = rsGetElementAt_float(gIn, xs2, ys0);
+    float p03 = rsGetElementAt_float(gIn, xs3, ys0);
+    float p0  = cubicInterpolate_F1(p00, p01, p02, p03, xf);
+
+    float p10 = rsGetElementAt_float(gIn, xs0, ys1);
+    float p11 = rsGetElementAt_float(gIn, xs1, ys1);
+    float p12 = rsGetElementAt_float(gIn, xs2, ys1);
+    float p13 = rsGetElementAt_float(gIn, xs3, ys1);
+    float p1  = cubicInterpolate_F1(p10, p11, p12, p13, xf);
+
+    float p20 = rsGetElementAt_float(gIn, xs0, ys2);
+    float p21 = rsGetElementAt_float(gIn, xs1, ys2);
+    float p22 = rsGetElementAt_float(gIn, xs2, ys2);
+    float p23 = rsGetElementAt_float(gIn, xs3, ys2);
+    float p2  = cubicInterpolate_F1(p20, p21, p22, p23, xf);
+
+    float p30 = rsGetElementAt_float(gIn, xs0, ys3);
+    float p31 = rsGetElementAt_float(gIn, xs1, ys3);
+    float p32 = rsGetElementAt_float(gIn, xs2, ys3);
+    float p33 = rsGetElementAt_float(gIn, xs3, ys3);
+    float p3  = cubicInterpolate_F1(p30, p31, p32, p33, xf);
+
+    float p  = cubicInterpolate_F1(p0, p1, p2, p3, yf);
+
+    return p;
+}
+
diff --git a/tests/tests/rscpp/librscpptest/Android.mk b/tests/tests/rscpp/librscpptest/Android.mk
index 9813ba6..bc2f81e 100644
--- a/tests/tests/rscpp/librscpptest/Android.mk
+++ b/tests/tests/rscpp/librscpptest/Android.mk
@@ -17,6 +17,8 @@
 #
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+LOCAL_CLANG := true
 LOCAL_MODULE := librscpptest_jni
 LOCAL_MODULE_TAGS := optional
 LOCAL_SRC_FILES := rs_jni.cpp rs_jni_allocation.cpp
@@ -25,10 +27,18 @@
 LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
 LOCAL_C_INCLUDES += frameworks/rs/cpp
 LOCAL_C_INCLUDES += frameworks/rs
-LOCAL_C_INCLUDES += external/stlport/stlport bionic/ bionic/libstdc++/include
 
 LOCAL_SHARED_LIBRARIES := libdl liblog
-LOCAL_STATIC_LIBRARIES := libRScpp_static libstlport_static libcutils
+LOCAL_STATIC_LIBRARIES := libRScpp_static libcutils
+
+ifeq ($(my_32_64_bit_suffix),32)
+    LOCAL_SDK_VERSION := 8
+else
+    LOCAL_SDK_VERSION := 21
+endif
+
+LOCAL_NDK_STL_VARIANT := stlport_static
+
 include $(BUILD_SHARED_LIBRARY)
 
 
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));
 }
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java b/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
index 62d7f47..e0cfee1 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
@@ -31,7 +31,7 @@
     @Option(name="cts-install-path", description="the path to the cts installation to use")
     private String mCtsRootDirPath = System.getProperty("CTS_ROOT");
 
-    public static final String CTS_BUILD_VERSION = "5.0_r1.9";
+    public static final String CTS_BUILD_VERSION = "5.0_r1";
 
     /**
      * {@inheritDoc}