Merge "Snap for 5050447 from 875138500d9077bc99913bbc94314838388be1d1 to nougat-cts-release" into nougat-cts-release
diff --git a/apps/CameraITS/build/envsetup.sh b/apps/CameraITS/build/envsetup.sh
index de50ad8..753a90d 100644
--- a/apps/CameraITS/build/envsetup.sh
+++ b/apps/CameraITS/build/envsetup.sh
@@ -37,6 +37,17 @@
         echo ">> Require Python $M module" >&2
 done
 
+CV2_VER=$(python -c "\
+try:
+    import cv2
+    print cv2.__version__
+except:
+    print \"N/A\"
+")
+
+echo $CV2_VER | grep -q -e "^2.4" -e "^3.2" || \
+    echo ">> Require python opencv 2.4. or 3.2. Got $CV2_VER" >&2
+
 export PYTHONPATH="$PWD/pymodules:$PYTHONPATH"
 
 for M in device objects image caps dng target error
diff --git a/apps/CameraITS/pymodules/its/image.py b/apps/CameraITS/pymodules/its/image.py
index a5ac60b..259bcdb 100644
--- a/apps/CameraITS/pymodules/its/image.py
+++ b/apps/CameraITS/pymodules/its/image.py
@@ -587,10 +587,10 @@
     """
     hfull = img.shape[0]
     wfull = img.shape[1]
-    xtile = math.ceil(xnorm * wfull)
-    ytile = math.ceil(ynorm * hfull)
-    wtile = math.floor(wnorm * wfull)
-    htile = math.floor(hnorm * hfull)
+    xtile = int(math.ceil(xnorm * wfull))
+    ytile = int(math.ceil(ynorm * hfull))
+    wtile = int(math.floor(wnorm * wfull))
+    htile = int(math.floor(hnorm * hfull))
     return img[ytile:ytile+htile,xtile:xtile+wtile,:].copy()
 
 def compute_image_means(img):
diff --git a/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py b/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py
index 9642061..8bebfae 100644
--- a/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py
+++ b/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py
@@ -261,8 +261,13 @@
             cv2.THRESH_BINARY + cv2.THRESH_OTSU)
 
     # connected component
-    contours, hierarchy = cv2.findContours(255-img_bw, cv2.RETR_TREE,
-            cv2.CHAIN_APPROX_SIMPLE)
+    cv2_version = cv2.__version__
+    if cv2_version.startswith('2.4.'):
+        contours, hierarchy = cv2.findContours(255-img_bw, cv2.RETR_TREE,
+                cv2.CHAIN_APPROX_SIMPLE)
+    elif cv2_version.startswith('3.2.'):
+        _, contours, hierarchy = cv2.findContours(255-img_bw, cv2.RETR_TREE,
+                cv2.CHAIN_APPROX_SIMPLE)
 
     # Check each component and find the black circle
     min_cmpt = size[0] * size[1] * 0.005
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 1bf1200..d3638a8 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -18,7 +18,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="com.android.cts.verifier"
       android:versionCode="5"
-      android:versionName="7.0_r26">
+      android:versionName="7.0_r27">
 
     <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="24"/>
 
diff --git a/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java b/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java
index b74eba7..84d8eab 100644
--- a/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java
+++ b/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java
@@ -694,14 +694,6 @@
         assertDomainOne("u:r:system_server:s0", "system_server");
     }
 
-    /*
-     * Some OEMs do not use sdcardd so transient. Other OEMs have multiple sdcards
-     * so they run the daemon multiple times.
-     */
-    public void testSdcarddDomain() throws DeviceNotAvailableException {
-        assertDomainHasExecutable("u:r:sdcardd:s0", "/system/bin/sdcard");
-    }
-
     /* Watchdogd may or may not be there */
     public void testWatchdogdDomain() throws DeviceNotAvailableException {
         assertDomainZeroOrOne("u:r:watchdogd:s0", "/sbin/watchdogd");
diff --git a/tools/cts-tradefed/Android.mk b/tools/cts-tradefed/Android.mk
index bfd8b76..ba82f6b 100644
--- a/tools/cts-tradefed/Android.mk
+++ b/tools/cts-tradefed/Android.mk
@@ -25,7 +25,7 @@
 LOCAL_SUITE_TARGET_ARCH := $(TARGET_ARCH)
 LOCAL_SUITE_NAME := CTS
 LOCAL_SUITE_FULLNAME := "Compatibility Test Suite"
-LOCAL_SUITE_VERSION := 7.0_r26
+LOCAL_SUITE_VERSION := 7.0_r27
 
 LOCAL_MODULE := cts-tradefed