[RESTRICT AUTOMERGE]: Give tests more control of crash parser behavior
Added a config object instead of a multitude of arguments.
Bug: 142482078
Test: cts-tradefed run compatibility-common-util-tests
Test: cts-tradefed run cts -m CtsSecurityTestCases -t android.security.cts.StagefrightTest
Change-Id: I6a351c376af5b127164a31a27579b65969920ec2
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java b/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java
index ed336ea..07fcbde 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java
@@ -385,9 +385,22 @@
*/
public static void runPocAssertNoCrashes(String pocName, ITestDevice device,
String... processPatternStrings) throws Exception {
+ runPocAssertNoCrashes(pocName, device,
+ new CrashUtils.Config().setProcessPatterns(processPatternStrings));
+ }
+
+ /**
+ * Runs the poc binary and asserts that there are no security crashes that match the expected
+ * process pattern.
+ * @param pocName a string path to poc from the /res folder
+ * @param device device to be ran on
+ * @param config a crash parser configuration
+ */
+ public static void runPocAssertNoCrashes(String pocName, ITestDevice device,
+ CrashUtils.Config config) throws Exception {
AdbUtils.runCommandLine("logcat -c", device);
AdbUtils.runPocNoOutput(pocName, device, SecurityTestCase.TIMEOUT_NONDETERMINISTIC);
- assertNoCrashes(device, processPatternStrings);
+ assertNoCrashes(device, config);
}
/**
@@ -492,27 +505,21 @@
*/
public static void assertNoCrashes(ITestDevice device, String... processPatternStrings)
throws Exception {
- assertNoCrashes(device, true, processPatternStrings);
+ assertNoCrashes(device, new CrashUtils.Config().setProcessPatterns(processPatternStrings));
}
/**
* Dumps logcat and asserts that there are no security crashes that match the expected process
* pattern. Ensure that adb logcat -c is called beforehand.
* @param device device to be ran on
- * @param checkMinAddress if the minimum fault address should be respected
- * @param processPatternStrings a Pattern string to match the crash tombstone process
+ * @param config a crash parser configuration
*/
- public static void assertNoCrashes(ITestDevice device, boolean checkMinAddress,
- String... processPatternStrings) throws Exception {
+ public static void assertNoCrashes(ITestDevice device,
+ CrashUtils.Config config) throws Exception {
String logcat = AdbUtils.runCommandLine("logcat -d *:S DEBUG:V", device);
- Pattern[] processPatterns = new Pattern[processPatternStrings.length];
- for (int i = 0; i < processPatternStrings.length; i++) {
- processPatterns[i] = Pattern.compile(processPatternStrings[i]);
- }
JSONArray crashes = CrashUtils.addAllCrashes(logcat, new JSONArray());
- JSONArray securityCrashes =
- CrashUtils.matchSecurityCrashes(crashes, checkMinAddress, processPatterns);
+ JSONArray securityCrashes = CrashUtils.matchSecurityCrashes(crashes, config);
if (securityCrashes.length() == 0) {
return; // no security crashes detected
@@ -521,8 +528,8 @@
StringBuilder error = new StringBuilder();
error.append("Security crash detected:\n");
error.append("Process patterns:");
- for (String pattern : processPatternStrings) {
- error.append(String.format(" '%s'", pattern));
+ for (Pattern pattern : config.getProcessPatterns()) {
+ error.append(String.format(" '%s'", pattern.toString()));
}
error.append("\nCrashes:\n");
for (int i = 0; i < crashes.length(); i++) {
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index 24b464a..5dc0905 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -103,17 +103,17 @@
@SecurityTest(minPatchLevel = "2016-08")
public void testStagefright_cve_2016_3829() throws Exception {
- doStagefrightTest(R.raw.cve_2016_3829, false);
+ doStagefrightTest(R.raw.cve_2016_3829, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-06")
public void testStagefright_cve_2017_0643() throws Exception {
- doStagefrightTest(R.raw.cve_2017_0643, false);
+ doStagefrightTest(R.raw.cve_2017_0643, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-08")
public void testStagefright_cve_2017_0728() throws Exception {
- doStagefrightTest(R.raw.cve_2017_0728, false);
+ doStagefrightTest(R.raw.cve_2017_0728, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-10")
@@ -153,7 +153,7 @@
@SecurityTest(minPatchLevel = "2017-06")
public void testStagefright_bug_35763994() throws Exception {
- doStagefrightTest(R.raw.bug_35763994, false);
+ doStagefrightTest(R.raw.bug_35763994, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-03")
@@ -163,7 +163,7 @@
@SecurityTest(minPatchLevel = "2017-07")
public void testStagefright_cve_2016_2507() throws Exception {
- doStagefrightTest(R.raw.cve_2016_2507, false);
+ doStagefrightTest(R.raw.cve_2016_2507, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-03")
@@ -258,13 +258,14 @@
@SecurityTest(minPatchLevel = "2017-02")
public void testStagefright_cve_2016_2429_b_27211885() throws Exception {
- doStagefrightTest(R.raw.cve_2016_2429_b_27211885, false);
+ doStagefrightTest(R.raw.cve_2016_2429_b_27211885,
+ new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-08")
public void testStagefright_bug_34031018() throws Exception {
- doStagefrightTest(R.raw.bug_34031018_32bit, false);
- doStagefrightTest(R.raw.bug_34031018_64bit, false);
+ doStagefrightTest(R.raw.bug_34031018_32bit, new CrashUtils.Config().checkMinAddress(false));
+ doStagefrightTest(R.raw.bug_34031018_64bit, new CrashUtils.Config().checkMinAddress(false));
}
/***********************************************************
@@ -289,7 +290,8 @@
@SecurityTest(minPatchLevel = "2018-01")
public void testStagefright_cve_2017_0852_b_62815506() throws Exception {
- doStagefrightTest(R.raw.cve_2017_0852_b_62815506, false);
+ doStagefrightTest(R.raw.cve_2017_0852_b_62815506,
+ new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2018-02")
@@ -315,7 +317,7 @@
@SecurityTest(minPatchLevel = "2016-10")
public void testStagefright_cve_2016_3920() throws Exception {
- doStagefrightTest(R.raw.cve_2016_3920, false);
+ doStagefrightTest(R.raw.cve_2016_3920, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2018-06")
@@ -330,7 +332,7 @@
@SecurityTest(minPatchLevel = "2016-08")
public void testStagefright_cve_2016_3821() throws Exception {
- doStagefrightTest(R.raw.cve_2016_3821, false);
+ doStagefrightTest(R.raw.cve_2016_3821, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2018-04")
@@ -350,12 +352,12 @@
@SecurityTest(minPatchLevel = "2017-09")
public void testStagefright_bug_38115076() throws Exception {
- doStagefrightTest(R.raw.bug_38115076, false);
+ doStagefrightTest(R.raw.bug_38115076, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-05")
public void testStagefright_bug_34618607() throws Exception {
- doStagefrightTest(R.raw.bug_34618607, false);
+ doStagefrightTest(R.raw.bug_34618607, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2018-02")
@@ -380,13 +382,14 @@
@SecurityTest(minPatchLevel = "2017-05")
public void testStagefright_cve_2017_0600() throws Exception {
- doStagefrightTest(R.raw.cve_2017_0600, false);
+ doStagefrightTest(R.raw.cve_2017_0600, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-08")
public void testBug_38014992() throws Exception {
int[] frameSizes = getFrameSizes(R.raw.bug_38014992_framelen);
- doStagefrightTestRawBlob(R.raw.bug_38014992_avc, "video/avc", 640, 480, frameSizes, false);
+ doStagefrightTestRawBlob(R.raw.bug_38014992_avc, "video/avc", 640, 480, frameSizes,
+ new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-07")
@@ -416,7 +419,8 @@
@SecurityTest(minPatchLevel = "2017-03")
public void testBug_33387820() throws Exception {
int[] frameSizes = {45, 3202, 430, 2526};
- doStagefrightTestRawBlob(R.raw.bug_33387820_avc, "video/avc", 320, 240, frameSizes, false);
+ doStagefrightTestRawBlob(R.raw.bug_33387820_avc, "video/avc", 320, 240, frameSizes,
+ new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-07")
@@ -453,13 +457,15 @@
public void testBug_28816956() throws Exception {
int[] frameSizes = getFrameSizes(R.raw.bug_28816956_framelen);
doStagefrightTestRawBlob(
- R.raw.bug_28816956_hevc, "video/hevc", 352, 288, frameSizes, false);
+ R.raw.bug_28816956_hevc, "video/hevc", 352, 288, frameSizes,
+ new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-03")
public void testBug_33818500() throws Exception {
int[] frameSizes = getFrameSizes(R.raw.bug_33818500_framelen);
- doStagefrightTestRawBlob(R.raw.bug_33818500_avc, "video/avc", 64, 32, frameSizes, false);
+ doStagefrightTestRawBlob(R.raw.bug_33818500_avc, "video/avc", 64, 32, frameSizes,
+ new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2018-01")
@@ -488,7 +494,7 @@
@SecurityTest(minPatchLevel = "2017-05")
public void testStagefright_cve_2017_0599() throws Exception {
- doStagefrightTest(R.raw.cve_2017_0599, false);
+ doStagefrightTest(R.raw.cve_2017_0599, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-09")
@@ -518,7 +524,7 @@
@SecurityTest(minPatchLevel = "2017-09")
public void testStagefright_cve_2016_6712() throws Exception {
- doStagefrightTest(R.raw.cve_2016_6712, false);
+ doStagefrightTest(R.raw.cve_2016_6712, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-04")
@@ -544,12 +550,12 @@
@SecurityTest(minPatchLevel = "2017-06")
public void testStagefright_bug_33818508() throws Exception {
- doStagefrightTest(R.raw.bug_33818508, false);
+ doStagefrightTest(R.raw.bug_33818508, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-08")
public void testStagefright_bug_32873375() throws Exception {
- doStagefrightTest(R.raw.bug_32873375, false);
+ doStagefrightTest(R.raw.bug_32873375, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2018-02")
@@ -612,7 +618,7 @@
@SecurityTest(minPatchLevel = "2016-06")
public void testStagefright_cve_2016_2428() throws Exception {
- doStagefrightTest(R.raw.cve_2016_2428, false);
+ doStagefrightTest(R.raw.cve_2016_2428, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2016-07")
@@ -650,7 +656,8 @@
@Override
public void run() {
try {
- doStagefrightTestMediaCodec(tempFile.getAbsolutePath(), false);
+ doStagefrightTestMediaCodec(tempFile.getAbsolutePath(),
+ new CrashUtils.Config().checkMinAddress(false));
} catch (Exception | AssertionError e) {
if (!tempFile.delete()) {
Log.e(TAG, "Failed to delete temporary PoC file");
@@ -675,7 +682,7 @@
@SecurityTest(minPatchLevel = "2017-06")
public void testStagefright_bug_32322258() throws Exception {
- doStagefrightTest(R.raw.bug_32322258, false);
+ doStagefrightTest(R.raw.bug_32322258, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2015-10")
@@ -705,7 +712,8 @@
@SecurityTest(minPatchLevel = "2015-10")
public void testStagefright_cve_2015_3862_b_22954006() throws Exception {
- doStagefrightTest(R.raw.cve_2015_3862_b_22954006, false);
+ doStagefrightTest(R.raw.cve_2015_3862_b_22954006,
+ new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2015-10")
@@ -770,12 +778,13 @@
@SecurityTest(minPatchLevel = "2016-07")
public void testStagefright_cve_2016_3755() throws Exception {
- doStagefrightTest(R.raw.cve_2016_3755, false);
+ doStagefrightTest(R.raw.cve_2016_3755, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2016-09")
public void testStagefright_cve_2016_3878_b_29493002() throws Exception {
- doStagefrightTest(R.raw.cve_2016_3878_b_29493002, false);
+ doStagefrightTest(R.raw.cve_2016_3878_b_29493002,
+ new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-08")
@@ -795,12 +804,12 @@
@SecurityTest(minPatchLevel = "2016-06")
public void testStagefright_bug_27855419_CVE_2016_2463() throws Exception {
- doStagefrightTest(R.raw.bug_27855419, false);
+ doStagefrightTest(R.raw.bug_27855419, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2015-11")
public void testStagefright_bug_19779574() throws Exception {
- doStagefrightTest(R.raw.bug_19779574, false);
+ doStagefrightTest(R.raw.bug_19779574, new CrashUtils.Config().checkMinAddress(false));
}
/***********************************************************
@@ -815,7 +824,7 @@
@SecurityTest(minPatchLevel = "2017-07")
public void testStagefright_bug_36279112() throws Exception {
- doStagefrightTest(R.raw.bug_36279112, false);
+ doStagefrightTest(R.raw.bug_36279112, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-06")
@@ -895,7 +904,8 @@
};
server.start();
String uri = "http://127.0.0.1:8080/bug_68342866.m3u8";
- final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(false);
+ final MediaPlayerCrashListener mpcl =
+ new MediaPlayerCrashListener(new CrashUtils.Config().checkMinAddress(false));
LooperThread t = new LooperThread(new Runnable() {
@Override
public void run() {
@@ -1057,7 +1067,7 @@
@SecurityTest(minPatchLevel = "2016-12")
public void testStagefright_cve_2016_6764() throws Exception {
- doStagefrightTest(R.raw.cve_2016_6764, false);
+ doStagefrightTest(R.raw.cve_2016_6764, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2018-01")
@@ -1067,7 +1077,7 @@
@SecurityTest(minPatchLevel = "2017-06")
public void testStagefright_bug_35467107() throws Exception {
- doStagefrightTest(R.raw.bug_35467107, false);
+ doStagefrightTest(R.raw.bug_35467107, new CrashUtils.Config().checkMinAddress(false));
}
/***********************************************************
@@ -1207,12 +1217,12 @@
@SecurityTest(minPatchLevel = "2016-12")
public void testStagefright_cve_2016_6765() throws Exception {
- doStagefrightTest(R.raw.cve_2016_6765, false);
+ doStagefrightTest(R.raw.cve_2016_6765, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2016-07")
public void testStagefright_cve_2016_2508() throws Exception {
- doStagefrightTest(R.raw.cve_2016_2508, false);
+ doStagefrightTest(R.raw.cve_2016_2508, new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2016-11")
@@ -1232,40 +1242,41 @@
@SecurityTest(minPatchLevel = "2016-09")
public void testStagefright_cve_2016_3879() throws Exception {
- doStagefrightTest(R.raw.cve_2016_3879, false);
+ doStagefrightTest(R.raw.cve_2016_3879, new CrashUtils.Config().checkMinAddress(false));
}
private void doStagefrightTest(final int rid) throws Exception {
- doStagefrightTest(rid, true); // check addresss by default
+ doStagefrightTest(rid, null);
}
- private void doStagefrightTest(final int rid, boolean checkMinCrashAddress) throws Exception {
- doStagefrightTestMediaPlayer(rid, checkMinCrashAddress);
- doStagefrightTestMediaCodec(rid, checkMinCrashAddress);
- doStagefrightTestMediaMetadataRetriever(rid, checkMinCrashAddress);
+ private void doStagefrightTest(final int rid, CrashUtils.Config config) throws Exception {
+ doStagefrightTestMediaPlayer(rid, config);
+ doStagefrightTestMediaCodec(rid, config);
+ doStagefrightTestMediaMetadataRetriever(rid, config);
Context context = getInstrumentation().getContext();
Resources resources = context.getResources();
CtsTestServer server = new CtsTestServer(context);
String rname = resources.getResourceEntryName(rid);
String url = server.getAssetUrl("raw/" + rname);
- doStagefrightTestMediaPlayer(url, checkMinCrashAddress);
- doStagefrightTestMediaCodec(url, checkMinCrashAddress);
- doStagefrightTestMediaMetadataRetriever(url, checkMinCrashAddress);
+
+ doStagefrightTestMediaPlayer(url, config);
+ doStagefrightTestMediaCodec(url, config);
+ doStagefrightTestMediaMetadataRetriever(url, config);
server.shutdown();
}
private void doStagefrightTest(final int rid, int timeout) throws Exception {
- doStagefrightTest(rid, true, timeout); // check crash address by default
+ doStagefrightTest(rid, null, timeout);
}
private void doStagefrightTest(
- final int rid, boolean checkMinCrashAddress, int timeout) throws Exception {
+ final int rid, CrashUtils.Config config, int timeout) throws Exception {
runWithTimeout(new Runnable() {
@Override
public void run() {
try {
- doStagefrightTest(rid, checkMinCrashAddress);
+ doStagefrightTest(rid, config);
} catch (Exception e) {
fail(e.toString());
}
@@ -1274,12 +1285,12 @@
}
private void doStagefrightTestANR(final int rid) throws Exception {
- doStagefrightTestANR(rid, true); // check crash address by default
+ doStagefrightTestANR(rid, null);
}
private void doStagefrightTestANR(
- final int rid, boolean checkMinCrashAddress) throws Exception {
- doStagefrightTestMediaPlayerANR(rid, null);
+ final int rid, CrashUtils.Config config) throws Exception {
+ doStagefrightTestMediaPlayerANR(rid, null, config);
}
private Surface getDummySurface() {
@@ -1339,7 +1350,7 @@
MediaPlayer.OnPreparedListener,
MediaPlayer.OnCompletionListener {
- boolean checkMinAddress = true;
+ CrashUtils.Config config;
private final Pattern[] validProcessPatterns = {
Pattern.compile("adsprpcd"),
@@ -1363,10 +1374,16 @@
};
MediaPlayerCrashListener() {
+ this(null);
}
- MediaPlayerCrashListener(boolean checkMinAddress) {
- this.checkMinAddress = checkMinAddress;
+ MediaPlayerCrashListener(CrashUtils.Config config) {
+ if (config == null) {
+ config = new CrashUtils.Config();
+ }
+ // if a different process is needed for a test, it should be added to the main list.
+ config.setProcessPatterns(validProcessPatterns);
+ this.config = config;
}
@Override
@@ -1414,8 +1431,7 @@
if (crashes == null) {
Log.e(TAG, "Crash results not found for test " + getName());
return what;
- } else if (CrashUtils.securityCrashDetected(
- crashes, checkMinAddress, validProcessPatterns)) {
+ } else if (CrashUtils.securityCrashDetected(crashes, config)) {
return what;
} else {
Log.i(TAG, "Crash ignored due to no security crash found for test " +
@@ -1463,21 +1479,21 @@
}
private void doStagefrightTestMediaPlayer(final int rid) throws Exception {
- doStagefrightTestMediaPlayer(rid, true); // check crash address by default
+ doStagefrightTestMediaPlayer(rid, null, null);
}
private void doStagefrightTestMediaPlayer(
- final int rid, boolean checkMinCrashAddress) throws Exception {
- doStagefrightTestMediaPlayer(rid, null, checkMinCrashAddress);
+ final int rid, CrashUtils.Config config) throws Exception {
+ doStagefrightTestMediaPlayer(rid, null, config);
}
private void doStagefrightTestMediaPlayer(final String url) throws Exception {
- doStagefrightTestMediaPlayer(url, true); // check crash address by default
+ doStagefrightTestMediaPlayer(url, null);
}
private void doStagefrightTestMediaPlayer(
- final String url, boolean checkMinCrashAddress) throws Exception {
- doStagefrightTestMediaPlayer(-1, url, checkMinCrashAddress);
+ final String url, CrashUtils.Config config) throws Exception {
+ doStagefrightTestMediaPlayer(-1, url, config);
}
private void closeQuietly(AutoCloseable closeable) {
@@ -1492,17 +1508,17 @@
}
private void doStagefrightTestMediaPlayer(final int rid, final String uri) throws Exception {
- doStagefrightTestMediaPlayer(rid, uri, true); // check crash address by default
+ doStagefrightTestMediaPlayer(rid, uri, null);
}
private void doStagefrightTestMediaPlayer(final int rid, final String uri,
- boolean checkMinCrashAddress) throws Exception {
+ CrashUtils.Config config) throws Exception {
String name = uri != null ? uri :
getInstrumentation().getContext().getResources().getResourceEntryName(rid);
Log.i(TAG, "start mediaplayer test for: " + name);
- final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(checkMinCrashAddress);
+ final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(config);
LooperThread t = new LooperThread(new Runnable() {
@Override
@@ -1619,31 +1635,31 @@
}
private void doStagefrightTestMediaCodec(final int rid) throws Exception {
- doStagefrightTestMediaCodec(rid, true); // check crash address by default
+ doStagefrightTestMediaCodec(rid, null, null);
}
private void doStagefrightTestMediaCodec(
- final int rid, boolean checkMinCrashAddress) throws Exception {
- doStagefrightTestMediaCodec(rid, null, checkMinCrashAddress);
+ final int rid, CrashUtils.Config config) throws Exception {
+ doStagefrightTestMediaCodec(rid, null, config);
}
private void doStagefrightTestMediaCodec(final String url) throws Exception {
- doStagefrightTestMediaCodec(url, true); // check crash address by default
+ doStagefrightTestMediaCodec(url, null);
}
private void doStagefrightTestMediaCodec(
- final String url, boolean checkMinCrashAddress) throws Exception {
- doStagefrightTestMediaCodec(-1, url, checkMinCrashAddress);
+ final String url, CrashUtils.Config config) throws Exception {
+ doStagefrightTestMediaCodec(-1, url, config);
}
private void doStagefrightTestMediaCodec(final int rid, final String url) throws Exception {
- doStagefrightTestMediaCodec(rid, url, true); // check crash address by default
+ doStagefrightTestMediaCodec(rid, url, null);
}
private void doStagefrightTestMediaCodec(
- final int rid, final String url, boolean checkMinCrashAddress) throws Exception {
+ final int rid, final String url, CrashUtils.Config config) throws Exception {
- final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(checkMinCrashAddress);
+ final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(config);
LooperThread thr = new LooperThread(new Runnable() {
@Override
@@ -1799,31 +1815,31 @@
}
private void doStagefrightTestMediaMetadataRetriever(final int rid) throws Exception {
- doStagefrightTestMediaMetadataRetriever(rid, true); // check crash address by default
+ doStagefrightTestMediaMetadataRetriever(rid, null, null);
}
private void doStagefrightTestMediaMetadataRetriever(
- final int rid, boolean checkMinCrashAddress) throws Exception {
- doStagefrightTestMediaMetadataRetriever(rid, null, checkMinCrashAddress);
+ final int rid, CrashUtils.Config config) throws Exception {
+ doStagefrightTestMediaMetadataRetriever(rid, null, config);
}
private void doStagefrightTestMediaMetadataRetriever(final String url) throws Exception {
- doStagefrightTestMediaMetadataRetriever(url, true); // check crash address by default
+ doStagefrightTestMediaMetadataRetriever(url, null);
}
private void doStagefrightTestMediaMetadataRetriever(
- final String url, boolean checkMinCrashAddress) throws Exception {
- doStagefrightTestMediaMetadataRetriever(-1, url, checkMinCrashAddress);
+ final String url, CrashUtils.Config config) throws Exception {
+ doStagefrightTestMediaMetadataRetriever(-1, url, config);
}
private void doStagefrightTestMediaMetadataRetriever(
final int rid, final String url) throws Exception {
- doStagefrightTestMediaMetadataRetriever(rid, url, true); // check crash address by default
+ doStagefrightTestMediaMetadataRetriever(rid, url, null);
}
private void doStagefrightTestMediaMetadataRetriever(
- final int rid, final String url, boolean checkMinCrashAddress) throws Exception {
+ final int rid, final String url, CrashUtils.Config config) throws Exception {
- final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(checkMinCrashAddress);
+ final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(config);
LooperThread thr = new LooperThread(new Runnable() {
@Override
@@ -1898,12 +1914,14 @@
@SecurityTest(minPatchLevel = "2017-08")
public void testBug36816007() throws Exception {
- doStagefrightTestRawBlob(R.raw.bug_36816007, "video/avc", 320, 240, false);
+ doStagefrightTestRawBlob(R.raw.bug_36816007, "video/avc", 320, 240,
+ new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-05")
public void testBug36895511() throws Exception {
- doStagefrightTestRawBlob(R.raw.bug_36895511, "video/hevc", 320, 240, false);
+ doStagefrightTestRawBlob(R.raw.bug_36895511, "video/hevc", 320, 240,
+ new CrashUtils.Config().checkMinAddress(false));
}
@SecurityTest(minPatchLevel = "2017-11")
@@ -1933,7 +1951,8 @@
@SecurityTest(minPatchLevel = "2018-04")
public void testBug_70897394() throws Exception {
- doStagefrightTestRawBlob(R.raw.bug_70897394_avc, "video/avc", 320, 240, false);
+ doStagefrightTestRawBlob(R.raw.bug_70897394_avc, "video/avc", 320, 240,
+ new CrashUtils.Config().checkMinAddress(false));
}
private int[] getFrameSizes(int rid) throws IOException {
@@ -1975,14 +1994,13 @@
private void doStagefrightTestRawBlob(
int rid, String mime, int initWidth, int initHeight) throws Exception {
- // check crash address by default
- doStagefrightTestRawBlob(rid, mime, initWidth, initHeight, true);
+ doStagefrightTestRawBlob(rid, mime, initWidth, initHeight, new CrashUtils.Config());
}
private void doStagefrightTestRawBlob(int rid, String mime, int initWidth, int initHeight,
- boolean checkMinCrashAddress) throws Exception {
+ CrashUtils.Config config) throws Exception {
- final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(checkMinCrashAddress);
+ final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(config);
final Context context = getInstrumentation().getContext();
final Resources resources = context.getResources();
@@ -2097,13 +2115,13 @@
private void doStagefrightTestRawBlob(int rid, String mime, int initWidth, int initHeight,
int frameSizes[]) throws Exception {
// check crash address by default
- doStagefrightTestRawBlob(rid, mime, initWidth, initHeight, frameSizes, true);
+ doStagefrightTestRawBlob(rid, mime, initWidth, initHeight, frameSizes, new CrashUtils.Config());
}
private void doStagefrightTestRawBlob(int rid, String mime, int initWidth, int initHeight,
- int frameSizes[], boolean checkMinCrashAddress) throws Exception {
+ int frameSizes[], CrashUtils.Config config) throws Exception {
- final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(checkMinCrashAddress);
+ final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(config);
final Context context = getInstrumentation().getContext();
final Resources resources = context.getResources();
@@ -2237,16 +2255,16 @@
}
private void doStagefrightTestMediaPlayerANR(final int rid, final String uri) throws Exception {
- doStagefrightTestMediaPlayerANR(rid, uri, true); // check crash address by default
+ doStagefrightTestMediaPlayerANR(rid, uri, null);
}
private void doStagefrightTestMediaPlayerANR(final int rid, final String uri,
- boolean checkMinCrashAddress) throws Exception {
+ CrashUtils.Config config) throws Exception {
String name = uri != null ? uri :
getInstrumentation().getContext().getResources().getResourceEntryName(rid);
Log.i(TAG, "start mediaplayerANR test for: " + name);
- final MediaPlayerCrashListener mpl = new MediaPlayerCrashListener(checkMinCrashAddress);
+ final MediaPlayerCrashListener mpl = new MediaPlayerCrashListener(config);
LooperThread t = new LooperThread(new Runnable() {
@Override
@@ -2288,12 +2306,12 @@
}
private void doStagefrightTestExtractorSeek(final int rid, final long offset) throws Exception {
- doStagefrightTestExtractorSeek(rid, offset, true); // check crash address by default
+ doStagefrightTestExtractorSeek(rid, offset, new CrashUtils.Config()); // check crash address by default
}
private void doStagefrightTestExtractorSeek(final int rid, final long offset,
- boolean checkMinCrashAddress) throws Exception {
- final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(checkMinCrashAddress);
+ CrashUtils.Config config) throws Exception {
+ final MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(config);
LooperThread thr = new LooperThread(new Runnable() {
@Override
public void run() {