Merge "Add negative tests for KeyPairGeneratorSpecTest" into jb-mr2-dev
diff --git a/suite/pts/deviceTests/opengl/src/com/android/pts/opengl/reference/GLReferenceActivity.java b/suite/pts/deviceTests/opengl/src/com/android/pts/opengl/reference/GLReferenceActivity.java
index f49738a..c7fa7b9 100644
--- a/suite/pts/deviceTests/opengl/src/com/android/pts/opengl/reference/GLReferenceActivity.java
+++ b/suite/pts/deviceTests/opengl/src/com/android/pts/opengl/reference/GLReferenceActivity.java
@@ -14,7 +14,6 @@
 package com.android.pts.opengl.reference;
 
 import com.android.pts.opengl.GLActivityIntentKeys;
-import com.android.pts.opengl.R;
 
 import android.app.Activity;
 import android.content.Intent;
diff --git a/tests/jni/android_os_cts_OSFeatures.cpp b/tests/jni/android_os_cts_OSFeatures.cpp
index 2df6414..4ee8454 100644
--- a/tests/jni/android_os_cts_OSFeatures.cpp
+++ b/tests/jni/android_os_cts_OSFeatures.cpp
@@ -22,9 +22,16 @@
     return prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0);
 }
 
+jint android_os_cts_OSFeatures_prctlCapBsetRead(JNIEnv* env, jobject thiz, jint i)
+{
+    return prctl(PR_CAPBSET_READ, i, 0, 0, 0);
+}
+
 static JNINativeMethod gMethods[] = {
     {  "getNoNewPrivs", "()I",
             (void *) android_os_cts_OSFeatures_getNoNewPrivs  },
+    {  "prctlCapBsetRead", "(I)I",
+            (void *) android_os_cts_OSFeatures_prctlCapBsetRead },
 };
 
 int register_android_os_cts_OSFeatures(JNIEnv* env)
diff --git a/tests/src/android/os/cts/OSFeatures.java b/tests/src/android/os/cts/OSFeatures.java
index a8d08a6..fd30f58 100644
--- a/tests/src/android/os/cts/OSFeatures.java
+++ b/tests/src/android/os/cts/OSFeatures.java
@@ -22,4 +22,5 @@
     }
 
     public static native int getNoNewPrivs();
+    public static native int prctlCapBsetRead(int i);
 }
diff --git a/tests/tests/graphics2/src/android/graphics2/cts/TextureViewCameraActivity.java b/tests/tests/graphics2/src/android/graphics2/cts/TextureViewCameraActivity.java
index 88d529c..01776e5 100644
--- a/tests/tests/graphics2/src/android/graphics2/cts/TextureViewCameraActivity.java
+++ b/tests/tests/graphics2/src/android/graphics2/cts/TextureViewCameraActivity.java
@@ -92,9 +92,6 @@
     public void onSurfaceTextureUpdated(SurfaceTexture surface) {
         mUpdateCounter++;
         if (mUpdateCounter % CAPTURE_SCREEN_INTERVAL == 0) {
-            Canvas canvas = mTextureView.lockCanvas();
-            canvas.drawColor(0xffff0000);
-            mTextureView.unlockCanvasAndPost(canvas);
             Bitmap bitmap = mTextureView.getBitmap();
             Assert.assertEquals(mHeight, bitmap.getHeight());
             Assert.assertEquals(mWidth, bitmap.getWidth());
diff --git a/tests/tests/os/src/android/os/cts/SecurityFeaturesTest.java b/tests/tests/os/src/android/os/cts/SecurityFeaturesTest.java
index f1744a0..6a02974 100644
--- a/tests/tests/os/src/android/os/cts/SecurityFeaturesTest.java
+++ b/tests/tests/os/src/android/os/cts/SecurityFeaturesTest.java
@@ -27,4 +27,26 @@
         // if newPrivs == 1,  then new kernel with PR_SET_NO_NEW_PRIVS enabled (GOOD)
         assertTrue(newPrivs != 0);
     }
+
+    /**
+     * Iterate over all possible capabilities, testing to make sure each capability
+     * has been removed from the app's capability bounding set.
+     */
+    public void testPrCapbsetEmpty() {
+        int i = 0;
+        while (true) {
+            int result = OSFeatures.prctlCapBsetRead(i);
+            if (result == -1) {
+                // The kernel has told us that the capability we're inquiring about
+                // doesn't exist. Capabilities are assigned sequentially and
+                // and monotonically increase with each kernel release, so if we
+                // see -1, we know we've examined every capability the kernel
+                // knows about.
+                break;
+            }
+            assertEquals("capability " + i + " is still in the bounding set",
+                         0, result);
+            i++;
+        }
+    }
 }
diff --git a/tests/uiautomator/src/com/android/cts/uiautomatortest/CtsUiAutomatorTest.java b/tests/uiautomator/src/com/android/cts/uiautomatortest/CtsUiAutomatorTest.java
index 830ea60..80680c0 100644
--- a/tests/uiautomator/src/com/android/cts/uiautomatortest/CtsUiAutomatorTest.java
+++ b/tests/uiautomator/src/com/android/cts/uiautomatortest/CtsUiAutomatorTest.java
@@ -770,6 +770,20 @@
     }
 
     /**
+     * Verify the UiSelector property resourceIdMatches
+     *
+     * @throws UiObjectNotFoundException
+     * @since API Level 18
+     */
+    public void testSelectorResourceIdMatches() throws UiObjectNotFoundException {
+        openTest("Test 2");
+        new UiObject(new UiSelector().resourceIdMatches("(?i).*button.*").instance(2)).click();
+        verifyDialogActionResults("Button 3");
+        new UiObject(new UiSelector().resourceIdMatches("(?i).*button1.*")).click();
+        verifyDialogActionResults("Button 1");
+    }
+
+    /**
      * Performs a pinch out from the center of a view to its edges and listens to
      * the motion events to make sure the starting and ending points of both pointers
      * are correct.