From d64ff85d05cc362e20bb88b8507a247ce0c881d1 Mon Sep 17 00:00:00 2001 From: Marco Nelissen Date: Wed, 21 Dec 2016 16:24:41 -0800 Subject: Wait for MediaPlayer.release before continuing to avoid creating another instance of a codec while the previous one has not been released yet. Bug: 32915871 Bug: 33809349 Change-Id: I26876d976f568c495febdb033df9a9c37cdb161e (cherry picked from commit b0c4c78889033bf10a80919329f51ec831dd0ac6) --- tests/tests/security/src/android/security/cts/StagefrightTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java index a4b7b2266a6..9ca409d3035 100644 --- a/tests/tests/security/src/android/security/cts/StagefrightTest.java +++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java @@ -335,6 +335,7 @@ public class StagefrightTest extends InstrumentationTestCase { assertFalse("Device *IS* vulnerable to " + cve, mpcl.waitForError() == MediaPlayer.MEDIA_ERROR_SERVER_DIED); t.stopLooper(); + t.join(); // wait for thread to exit so we're sure the player was released } private void doStagefrightTestMediaCodec(final int rid) throws Exception { -- cgit v1.2.3 From bf7eb9b26c09d538aef9345f7fe5b0f6b410aa2d Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Tue, 10 Jan 2017 10:30:48 -0800 Subject: Log output of adb shell am output in CrossAppDragAndDropTests Adding more logging to help track down test failures when running on test bots. Bug: 32905009 Test: run cts -m CtsDragAndDropHostTestCases Change-Id: Ie206b93c00d3420c45b84bc233686b0b14a3de86 (cherry picked from commit 96264562812fc3d0e4c5c833c33fef5975757d20) --- .../windowmanager/src/android/wm/cts/CrossAppDragAndDropTests.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hostsidetests/services/windowmanager/src/android/wm/cts/CrossAppDragAndDropTests.java b/hostsidetests/services/windowmanager/src/android/wm/cts/CrossAppDragAndDropTests.java index fa1ae69b0ae..26aa7ad501a 100644 --- a/hostsidetests/services/windowmanager/src/android/wm/cts/CrossAppDragAndDropTests.java +++ b/hostsidetests/services/windowmanager/src/android/wm/cts/CrossAppDragAndDropTests.java @@ -19,6 +19,7 @@ package android.wm.cts; import com.android.tradefed.device.CollectingOutputReceiver; import com.android.tradefed.device.DeviceNotAvailableException; import com.android.tradefed.device.ITestDevice; +import com.android.tradefed.log.LogUtil.CLog; import com.android.tradefed.testtype.DeviceTestCase; import java.util.HashMap; @@ -218,6 +219,12 @@ public class CrossAppDragAndDropTests extends DeviceTestCase { CollectingOutputReceiver outputReceiver = new CollectingOutputReceiver(); mDevice.executeShellCommand(AM_STACK_LIST, outputReceiver); final String output = outputReceiver.getOutput(); + final StringBuilder builder = new StringBuilder(); + builder.append("Finding task info for task: "); + builder.append(name); + builder.append("\nParsing adb shell am output: " ); + builder.append(output); + CLog.i(builder.toString()); for (String line : output.split("\\n")) { if (line.contains(name)) { return line; -- cgit v1.2.3 From 56361d2734d19184a724861ccb7f48b87e6564ef Mon Sep 17 00:00:00 2001 From: Erik Wolsheimer Date: Wed, 11 Jan 2017 11:35:24 -0800 Subject: Opt UI_MODE_TYPE_TELEVISION out of SearchManagerTest BUG: 33040372 Change-Id: Ica5a1fa3b18eaa2d2564e71c454e2e2e5eb096d9 (cherry picked from commit a8dc7d102944ccb96936715f5a7a08b904db9bb8) --- tests/app/src/android/app/cts/SearchManagerTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/app/src/android/app/cts/SearchManagerTest.java b/tests/app/src/android/app/cts/SearchManagerTest.java index b1b5623b644..bf7e2f92849 100644 --- a/tests/app/src/android/app/cts/SearchManagerTest.java +++ b/tests/app/src/android/app/cts/SearchManagerTest.java @@ -17,10 +17,12 @@ package android.app.cts; import android.app.SearchManager; +import android.app.UiModeManager; import android.app.stubs.CTSActivityTestCaseBase; import android.app.stubs.SearchManagerStubActivity; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; public class SearchManagerTest extends CTSActivityTestCaseBase { @@ -61,6 +63,10 @@ public class SearchManagerTest extends CTSActivityTestCaseBase { private boolean hasGlobalSearchActivity() { Context context = getInstrumentation().getTargetContext(); + UiModeManager uiModeManager = context.getSystemService(UiModeManager.class); + if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { + return false; + } SearchManager searchManager = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE); if (searchManager == null) { -- cgit v1.2.3 From ee5a122ba92794b0f7608dfcb28ea8c086e34eb4 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Wed, 11 Jan 2017 10:03:11 -0800 Subject: DO NOT MERGE Improve parsing of "am stack list" in CTS drag and drop tests Speculative fix for CTSCrossAppDragAndDropTests with the assumption that some unexpected adb shell am stack list output is causing the test to fail on CTS test bots. This fix uses a regular expression to correctly identify the intended task to reduce false positives. Test: Tests pass locally with instrumented build of nyc-mr2-dev with modified ActivityManager that outputs the same output as shown on CTS test bots host logs. Without the fix, the tests fail on the modified ActivityManager output. Bug: 32905009 Change-Id: I33297e239686ad9ddea8cace9353f4557dc65232 (cherry picked from commit 6bf9abd878755e8b4326eeca276f84f47c073b70) --- .../src/android/wm/cts/CrossAppDragAndDropTests.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hostsidetests/services/windowmanager/src/android/wm/cts/CrossAppDragAndDropTests.java b/hostsidetests/services/windowmanager/src/android/wm/cts/CrossAppDragAndDropTests.java index 26aa7ad501a..77119c00a18 100644 --- a/hostsidetests/services/windowmanager/src/android/wm/cts/CrossAppDragAndDropTests.java +++ b/hostsidetests/services/windowmanager/src/android/wm/cts/CrossAppDragAndDropTests.java @@ -24,6 +24,7 @@ import com.android.tradefed.testtype.DeviceTestCase; import java.util.HashMap; import java.util.Map; +import java.util.regex.Pattern; public class CrossAppDragAndDropTests extends DeviceTestCase { // Constants copied from ActivityManager.StackId. If they are changed there, these must be @@ -48,13 +49,17 @@ public class CrossAppDragAndDropTests extends DeviceTestCase { private static final String INPUT_MOUSE_SWIPE = "input mouse swipe "; private static final String TASK_ID_PREFIX = "taskId"; + // Regex pattern to match adb shell am stack list output of the form: + // taskId=: bounds=[LEFT,TOP][RIGHT,BOTTOM] + private static final String TASK_REGEX_PATTERN_STRING = + "taskId=[0-9]+: %s bounds=\\[[0-9]+,[0-9]+\\]\\[[0-9]+,[0-9]+\\]"; + private static final int SWIPE_DURATION_MS = 500; private static final String SOURCE_PACKAGE_NAME = "android.wm.cts.dndsourceapp"; private static final String TARGET_PACKAGE_NAME = "android.wm.cts.dndtargetapp"; private static final String TARGET_23_PACKAGE_NAME = "android.wm.cts.dndtargetappsdk23"; - private static final String SOURCE_ACTIVITY_NAME = "DragSource"; private static final String TARGET_ACTIVITY_NAME = "DropTarget"; @@ -225,8 +230,9 @@ public class CrossAppDragAndDropTests extends DeviceTestCase { builder.append("\nParsing adb shell am output: " ); builder.append(output); CLog.i(builder.toString()); + final Pattern pattern = Pattern.compile(String.format(TASK_REGEX_PATTERN_STRING, name)); for (String line : output.split("\\n")) { - if (line.contains(name)) { + if (pattern.matcher(line).find()) { return line; } } -- cgit v1.2.3