DO NOT MERGE add annotations to for months 2016-11 --> 2017-07, also adding all of the stagefright tests

Bug: 37626186

Change-Id: I79c32d7f2289d564e41db282e8fad8b741d00886
diff --git a/tests/tests/content/src/android/content/cts/ContentProviderCursorWindowTest.java b/tests/tests/content/src/android/content/cts/ContentProviderCursorWindowTest.java
index 004b193..e6f0902 100644
--- a/tests/tests/content/src/android/content/cts/ContentProviderCursorWindowTest.java
+++ b/tests/tests/content/src/android/content/cts/ContentProviderCursorWindowTest.java
@@ -22,6 +22,8 @@
 import android.test.AndroidTestCase;
 import android.util.Log;
 
+import com.android.cts.util.SecurityTest;
+
 import java.io.IOException;
 
 /**
@@ -30,6 +32,7 @@
 public class ContentProviderCursorWindowTest extends AndroidTestCase {
     private static final String TAG = "ContentProviderCursorWindowTest";
 
+    @SecurityTest
     public void testQuery() throws IOException {
         Cursor cursor = getContext().getContentResolver().query(
                 Uri.parse("content://cursorwindow.provider/hello"),
diff --git a/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java b/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
index 74a3b67..dd57893 100644
--- a/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
@@ -25,6 +25,8 @@
 import android.os.ParcelFileDescriptor;
 import android.test.AndroidTestCase;
 
+import com.android.cts.util.SecurityTest;
+
 import java.io.File;
 import java.io.FileDescriptor;
 import java.io.FileOutputStream;
@@ -181,6 +183,7 @@
         return (file.getPath());
     }
 
+    @SecurityTest
     public void testBadFont() {
         Typeface typeface = Typeface.createFromAsset(getContext().getAssets(), "ft45987.ttf");
         assertNotNull(typeface);
diff --git a/tests/tests/location/src/android/location/cts/LocationManagerTest.java b/tests/tests/location/src/android/location/cts/LocationManagerTest.java
index b8b77f0..58a1cb0 100644
--- a/tests/tests/location/src/android/location/cts/LocationManagerTest.java
+++ b/tests/tests/location/src/android/location/cts/LocationManagerTest.java
@@ -38,6 +38,8 @@
 import android.provider.Settings;
 import android.test.InstrumentationTestCase;
 
+import com.android.cts.util.SecurityTest;
+
 import java.util.List;
 
 /**
@@ -601,6 +603,7 @@
      * Test case for bug 33091107, where a malicious app used to be able to fool a real provider
      * into providing a mock location that isn't marked as being mock.
      */
+    @SecurityTest
     public void testLocationShouldStillBeMarkedMockWhenProvidersDoNotMatch()
             throws InterruptedException {
         double latitude = 20;
diff --git a/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java b/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java
index 3e4ffb6..8418590 100644
--- a/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/StreamingMediaPlayerTest.java
@@ -18,6 +18,9 @@
 import android.media.MediaPlayer;
 import android.util.Log;
 import android.webkit.cts.CtsTestServer;
+
+import com.android.cts.util.SecurityTest;
+
 import java.io.IOException;
 
 
@@ -281,6 +284,7 @@
         }
     }
 
+    @SecurityTest
     public void testNoSSLv3Fallback() throws Exception {
         mServer = new CtsTestServer(mContext, true);
         try {
diff --git a/tests/tests/security/src/android/security/cts/AudioSecurityTest.java b/tests/tests/security/src/android/security/cts/AudioSecurityTest.java
index 0d453da..77a8847 100644
--- a/tests/tests/security/src/android/security/cts/AudioSecurityTest.java
+++ b/tests/tests/security/src/android/security/cts/AudioSecurityTest.java
@@ -22,6 +22,8 @@
 import android.media.audiofx.AudioEffect;
 import android.util.Log;
 
+import com.android.cts.util.SecurityTest;
+
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.Arrays;
@@ -84,6 +86,7 @@
     }
 
     // b/28173666
+    @SecurityTest
     public void testAllEffectsGetParameterAttemptOffload_CVE_2016_3745() throws Exception {
         testAllEffects("get parameter attempt offload",
                 new TestEffect() {
@@ -97,6 +100,7 @@
     // b/32438594
     // b/32624850
     // b/32635664
+    @SecurityTest
     public void testAllEffectsGetParameter2AttemptOffload_CVE_2017_0398() throws Exception {
         testAllEffects("get parameter2 attempt offload",
                 new TestEffect() {
@@ -108,6 +112,7 @@
     }
 
     // b/30204301
+    @SecurityTest
     public void testAllEffectsSetParameterAttemptOffload_CVE_2016_3924() throws Exception {
         testAllEffects("set parameter attempt offload",
                 new TestEffect() {
@@ -118,6 +123,7 @@
         });
     }
 
+    @SecurityTest
     private static void testAudioEffectGetParameter(
             AudioEffect audioEffect, boolean offload) throws Exception {
         if (audioEffect == null) {
@@ -303,6 +309,7 @@
     private static final int VISUALIZER_PARAM_CAPTURE_SIZE = 0;
 
     // b/31781965
+    @SecurityTest
     public void testVisualizerCapture_CVE_2017_0396() throws Exception {
         // Capture params
         final int CAPTURE_SIZE = 1 << 24; // 16MB seems to be large enough to cause a SEGV.
diff --git a/tests/tests/security/src/android/security/cts/BigRleTest.java b/tests/tests/security/src/android/security/cts/BigRleTest.java
index d957668..4014584 100644
--- a/tests/tests/security/src/android/security/cts/BigRleTest.java
+++ b/tests/tests/security/src/android/security/cts/BigRleTest.java
@@ -23,6 +23,7 @@
 import java.io.InputStream;
 
 import com.android.cts.security.R;
+import com.android.cts.util.SecurityTest;
 
 public class BigRleTest extends AndroidTestCase {
     /**
@@ -31,6 +32,7 @@
      * This image reports that its encoded length is over 4 gigs. Prior to fixing issue 33251605,
      * we attempted to allocate space for all the encoded data at once, resulting in OOM.
      */
+    @SecurityTest
     public void test_android_bug_33251605() {
         InputStream exploitImage = mContext.getResources().openRawResource(R.raw.bug_33251605);
         Bitmap bitmap = BitmapFactory.decodeStream(exploitImage);
diff --git a/tests/tests/security/src/android/security/cts/EffectBundleTest.java b/tests/tests/security/src/android/security/cts/EffectBundleTest.java
index c57f73f..1e3ea69 100644
--- a/tests/tests/security/src/android/security/cts/EffectBundleTest.java
+++ b/tests/tests/security/src/android/security/cts/EffectBundleTest.java
@@ -22,13 +22,14 @@
 import android.test.InstrumentationTestCase;
 import android.util.Log;
 
+import com.android.cts.security.R;
+import com.android.cts.util.SecurityTest;
+
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 
-import com.android.cts.security.R;
-
 public class EffectBundleTest extends InstrumentationTestCase {
     private static final String TAG = "EffectBundleTest";
     private static final int[] INVALID_BAND_ARRAY = {Integer.MIN_VALUE, -10000, -100, -2, -1};
@@ -40,44 +41,52 @@
     private static final int MEDIA_LONG = 1;
 
     //Testing security bug: 32436341
+    @SecurityTest
     public void testEqualizer_getParamCenterFreq() throws Exception {
         testGetParam(MEDIA_SHORT, Equalizer.PARAM_CENTER_FREQ, INVALID_BAND_ARRAY, mValue0,
                 mValue1);
     }
 
     //Testing security bug: 32588352
+    @SecurityTest
     public void testEqualizer_getParamCenterFreq_long() throws Exception {
         testGetParam(MEDIA_LONG, Equalizer.PARAM_CENTER_FREQ, INVALID_BAND_ARRAY, mValue0, mValue1);
     }
 
     //Testing security bug: 32438598
+    @SecurityTest
     public void testEqualizer_getParamBandLevel() throws Exception {
         testGetParam(MEDIA_SHORT, Equalizer.PARAM_BAND_LEVEL, INVALID_BAND_ARRAY, mValue0, mValue1);
     }
 
     //Testing security bug: 32584034
+    @SecurityTest
     public void testEqualizer_getParamBandLevel_long() throws Exception {
         testGetParam(MEDIA_LONG, Equalizer.PARAM_BAND_LEVEL, INVALID_BAND_ARRAY, mValue0, mValue1);
     }
 
     //Testing security bug: 32247948
+    @SecurityTest
     public void testEqualizer_getParamFreqRange() throws Exception {
         testGetParam(MEDIA_SHORT, Equalizer.PARAM_BAND_FREQ_RANGE, INVALID_BAND_ARRAY, mValue0,
                 mValue1);
     }
 
     //Testing security bug: 32588756
+    @SecurityTest
     public void testEqualizer_getParamFreqRange_long() throws Exception {
         testGetParam(MEDIA_LONG, Equalizer.PARAM_BAND_FREQ_RANGE, INVALID_BAND_ARRAY, mValue0,
                 mValue1);
     }
 
     //Testing security bug: 32448258
+    @SecurityTest
     public void testEqualizer_getParamPresetName() throws Exception {
         testParamPresetName(MEDIA_SHORT);
     }
 
     //Testing security bug: 32588016
+    @SecurityTest
     public void testEqualizer_getParamPresetName_long() throws Exception {
         testParamPresetName(MEDIA_LONG);
     }
@@ -115,6 +124,7 @@
     }
 
     //testing security bug: 32095626
+    @SecurityTest
     public void testEqualizer_setParamBandLevel() throws Exception {
         final int command = Equalizer.PARAM_BAND_LEVEL;
         short[] value = { 1000 };
@@ -127,6 +137,7 @@
     }
 
     //testing security bug: 32585400
+    @SecurityTest
     public void testEqualizer_setParamBandLevel_long() throws Exception {
         final int command = Equalizer.PARAM_BAND_LEVEL;
         short[] value = { 1000 };
@@ -139,12 +150,14 @@
     }
 
     //testing security bug: 32705438
+    @SecurityTest
     public void testEqualizer_getParamFreqRangeCommand_short() throws Exception {
         assertTrue("testEqualizer_getParamFreqRangeCommand_short did not complete successfully",
                 eqGetParamFreqRangeCommand(MEDIA_SHORT));
     }
 
     //testing security bug: 32703959
+    @SecurityTest
     public void testEqualizer_getParamFreqRangeCommand_long() throws Exception {
         assertTrue("testEqualizer_getParamFreqRangeCommand_long did not complete successfully",
                 eqGetParamFreqRangeCommand(MEDIA_LONG));
diff --git a/tests/tests/security/src/android/security/cts/IsolatedProcessTest.java b/tests/tests/security/src/android/security/cts/IsolatedProcessTest.java
index bd4f040..89d4f80 100644
--- a/tests/tests/security/src/android/security/cts/IsolatedProcessTest.java
+++ b/tests/tests/security/src/android/security/cts/IsolatedProcessTest.java
@@ -25,6 +25,9 @@
 import android.security.cts.IsolatedService;
 import android.test.AndroidTestCase;
 import android.util.Log;
+
+import com.android.cts.util.SecurityTest;
+
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import junit.framework.Assert;
@@ -71,6 +74,7 @@
                 mLatch.await(BIND_SERVICE_TIMEOUT, TimeUnit.MILLISECONDS));
     }
 
+    @SecurityTest
     public void testGetCachedServicesFromIsolatedService() throws RemoteException {
         String[] cachedServices = mService.getCachedSystemServices();
         for (String serviceName : cachedServices) {
@@ -79,6 +83,7 @@
         }
     }
 
+    @SecurityTest
     public void testGetServiceFromIsolatedService() throws RemoteException {
         for (String serviceName : RESTRICTED_SERVICES_TO_TEST) {
             IBinder service = mService.getSystemService(serviceName);
diff --git a/tests/tests/security/src/android/security/cts/Movie33897722.java b/tests/tests/security/src/android/security/cts/Movie33897722.java
index 0464a6a..c37b228 100644
--- a/tests/tests/security/src/android/security/cts/Movie33897722.java
+++ b/tests/tests/security/src/android/security/cts/Movie33897722.java
@@ -28,6 +28,7 @@
 import java.io.InputStream;
 
 import com.android.cts.security.R;
+import com.android.cts.util.SecurityTest;
 
 public class Movie33897722 extends AndroidTestCase {
     /**
@@ -37,6 +38,7 @@
      * larger than 2. Ensure that we do not attempt to read colors from beyond the end of the
      * color map, which would be reading memory that we do not control, and may be uninitialized.
      */
+    @SecurityTest
     public void test_android_bug_33897722() {
         InputStream exploitImage = mContext.getResources().openRawResource(R.raw.bug_33897722);
         Movie movie = Movie.decodeStream(exploitImage);
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index 919ea71..18269c6 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -76,86 +76,106 @@
         doStagefrightTest(R.raw.bug_22771132);
     }
 
+    @SecurityTest
     public void testStagefright_bug_21443020() throws Exception {
         doStagefrightTest(R.raw.bug_21443020_webm);
     }
 
+    @SecurityTest
     public void testStagefright_bug_34360591() throws Exception {
         doStagefrightTest(R.raw.bug_34360591);
     }
 
+    @SecurityTest
     public void testStagefright_bug_35763994() throws Exception {
         doStagefrightTest(R.raw.bug_35763994);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2016_2507() throws Exception {
         doStagefrightTest(R.raw.cve_2016_2507);
     }
 
+    @SecurityTest
     public void testStagefright_bug_31647370() throws Exception {
         doStagefrightTest(R.raw.bug_31647370);
     }
 
+    @SecurityTest
     public void testStagefright_bug_32577290() throws Exception {
         doStagefrightTest(R.raw.bug_32577290);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2015_1538_1() throws Exception {
         doStagefrightTest(R.raw.cve_2015_1538_1);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2015_1538_2() throws Exception {
         doStagefrightTest(R.raw.cve_2015_1538_2);
     }
-
+    @SecurityTest
     public void testStagefright_cve_2015_1538_3() throws Exception {
         doStagefrightTest(R.raw.cve_2015_1538_3);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2015_1538_4() throws Exception {
         doStagefrightTest(R.raw.cve_2015_1538_4);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2015_1539() throws Exception {
         doStagefrightTest(R.raw.cve_2015_1539);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2015_3824() throws Exception {
         doStagefrightTest(R.raw.cve_2015_3824);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2015_3826() throws Exception {
         doStagefrightTest(R.raw.cve_2015_3826);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2015_3827() throws Exception {
         doStagefrightTest(R.raw.cve_2015_3827);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2015_3828() throws Exception {
         doStagefrightTest(R.raw.cve_2015_3828);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2015_3829() throws Exception {
         doStagefrightTest(R.raw.cve_2015_3829);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2015_3864() throws Exception {
         doStagefrightTest(R.raw.cve_2015_3864);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2015_6598() throws Exception {
         doStagefrightTest(R.raw.cve_2015_6598);
     }
 
+    @SecurityTest
     public void testStagefright_bug_26366256() throws Exception {
         doStagefrightTest(R.raw.bug_26366256);
     }
 
+    @SecurityTest
     public void testStagefright_cve_2016_2429_b_27211885() throws Exception {
         doStagefrightTest(R.raw.cve_2016_2429_b_27211885);
     }
 
+    @SecurityTest
     public void testStagefright_bug_34031018() throws Exception {
         doStagefrightTest(R.raw.bug_34031018_32bit);
         doStagefrightTest(R.raw.bug_34031018_64bit);
diff --git a/tests/tests/security/src/android/security/cts/VisualizerEffectTest.java b/tests/tests/security/src/android/security/cts/VisualizerEffectTest.java
index 7067242..0ac20e3 100644
--- a/tests/tests/security/src/android/security/cts/VisualizerEffectTest.java
+++ b/tests/tests/security/src/android/security/cts/VisualizerEffectTest.java
@@ -25,7 +25,9 @@
 import android.test.AndroidTestCase;
 import android.test.InstrumentationTestCase;
 import android.util.Log;
+
 import com.android.cts.security.R;
+import com.android.cts.util.SecurityTest;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
@@ -39,6 +41,7 @@
     }
 
     //Testing security bug: 30229821
+    @SecurityTest
     public void testVisualizer_MalformedConstructor() throws Exception {
         final String VISUALIZER_TYPE = "e46b26a0-dddd-11db-8afd-0002a5d5c51b";
         final int VISUALIZER_CMD_MEASURE = 0x10001;