CTS test for Android Security b/37093318

Cherry-picked from https://partner-android-review.googlesource.com/c/platform/cts/+/1018231

Bug: 37093318
Test: ran new testcase on android-7.1.2_r2 with/without patch
Change-Id: I160e0a81cfb0c2376bd1638f152edceaca2d7994
Merged-In: I160e0a81cfb0c2376bd1638f152edceaca2d7994
(cherry picked from commit 3f38fb0cec6139ffed48f6d185edfa76167fc699)
(cherry picked from commit 457e232d876d8989eb1d33ecf486f74abaa54f75)
diff --git a/tests/tests/security/res/raw/bug_37093318.xmf b/tests/tests/security/res/raw/bug_37093318.xmf
new file mode 100644
index 0000000..e42c863
--- /dev/null
+++ b/tests/tests/security/res/raw/bug_37093318.xmf
Binary files differ
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index 8f9d49e..6740d98 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -20,10 +20,9 @@
  * Simone "evilsocket" Margaritelli
  * Joshua "jduck" Drake
  */
+
 package android.security.cts;
 
-import android.test.AndroidTestCase;
-import android.util.Log;
 import android.content.Context;
 import android.content.res.AssetFileDescriptor;
 import android.content.res.Resources;
@@ -35,16 +34,17 @@
 import android.media.MediaFormat;
 import android.media.MediaMetadataRetriever;
 import android.media.MediaPlayer;
-import android.opengl.GLES20;
 import android.opengl.GLES11Ext;
+import android.opengl.GLES20;
 import android.os.Looper;
 import android.os.SystemClock;
 import android.platform.test.annotations.SecurityTest;
+import android.security.cts.R;
+import android.test.AndroidTestCase;
 import android.test.InstrumentationTestCase;
 import android.util.Log;
 import android.view.Surface;
 import android.webkit.cts.CtsTestServer;
-
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
@@ -53,8 +53,6 @@
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
 
-import android.security.cts.R;
-
 
 /**
  * Verify that the device is not vulnerable to any known Stagefright
@@ -451,6 +449,10 @@
         doStagefrightTest(R.raw.bug_67737022);
     }
 
+    @SecurityTest
+    public void testStagefright_bug_37093318() throws Exception {
+        doStagefrightTest(R.raw.bug_37093318, (4 * 60 * 1000));
+    }
 
     private void doStagefrightTest(final int rid) throws Exception {
         doStagefrightTestMediaPlayer(rid);
@@ -468,6 +470,19 @@
         server.shutdown();
     }
 
+    private void doStagefrightTest(final int rid, int timeout) throws Exception {
+        runWithTimeout(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    doStagefrightTest(rid);
+                } catch (Exception e) {
+                    fail(e.toString());
+                }
+            }
+        }, timeout);
+    }
+
     private void doStagefrightTestANR(final int rid) throws Exception {
         doStagefrightTestMediaPlayerANR(rid, null);
     }