[RESTRICT AUTOMERGE] Updated CTS test for Android Security b/172655291

Bug: 172655291
Bug: 177454666
Test: Ran the new testcase on android-9.0.0_r39 with/without patch

Change-Id: Icf4354e65f2893b4865ec93aabafbdc6c020279b
(cherry picked from commit 5df716bd7a2603b86c4d85bdc780fdede32ae1b6)
diff --git a/tests/tests/security/src/android/security/cts/CVE_2021_0394.java b/tests/tests/security/src/android/security/cts/CVE_2021_0394.java
index 325e7af..513c962 100644
--- a/tests/tests/security/src/android/security/cts/CVE_2021_0394.java
+++ b/tests/tests/security/src/android/security/cts/CVE_2021_0394.java
@@ -16,11 +16,15 @@
 
 package android.security.cts;
 
+import android.platform.test.annotations.RequiresDevice;
 import android.platform.test.annotations.SecurityTest;
+import android.support.test.runner.AndroidJUnit4;
+import org.junit.runner.RunWith;
 import org.junit.Test;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
 
-public class CVE_2021_0394 extends TestCase {
+@RunWith(AndroidJUnit4.class)
+public class CVE_2021_0394 {
     static {
         System.loadLibrary("ctssecurity_jni");
     }
@@ -30,6 +34,9 @@
      */
     @SecurityTest(minPatchLevel = "2021-03")
     @Test
+    @RequiresDevice
+    // emulators always have checkJNI enabled which causes the test
+    // to abort the VM while passing invalid input to NewStringUTF
     public void testPocCVE_2021_0394() throws Exception {
         assertFalse(poc());
     }