summaryrefslogtreecommitdiff
path: root/hostsidetests/jdwptunnel/src/android/jdwptunnel/cts/JdwpTunnelTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'hostsidetests/jdwptunnel/src/android/jdwptunnel/cts/JdwpTunnelTest.java')
-rw-r--r--hostsidetests/jdwptunnel/src/android/jdwptunnel/cts/JdwpTunnelTest.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/hostsidetests/jdwptunnel/src/android/jdwptunnel/cts/JdwpTunnelTest.java b/hostsidetests/jdwptunnel/src/android/jdwptunnel/cts/JdwpTunnelTest.java
index 54862a0ffb6..66e4953b03d 100644
--- a/hostsidetests/jdwptunnel/src/android/jdwptunnel/cts/JdwpTunnelTest.java
+++ b/hostsidetests/jdwptunnel/src/android/jdwptunnel/cts/JdwpTunnelTest.java
@@ -16,7 +16,6 @@
package android.jdwptunnel.cts;
-import com.android.tradefed.util.RunUtil;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -25,9 +24,11 @@ import static org.junit.Assert.fail;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
import com.android.tradefed.util.AbiUtils;
+import com.android.tradefed.util.RunUtil;
import com.sun.jdi.Bootstrap;
import com.sun.jdi.ReferenceType;
@@ -130,13 +131,20 @@ public class JdwpTunnelTest extends BaseHostJUnit4Test {
private String startupForwarding(String packageName, String shortClassName, boolean debug)
throws Exception {
moveToHomeScreen();
- mDevice.executeShellCommand(
- "cmd activity start-activity "
- + (debug ? "-D" : "")
- + " -W -n "
- + packageName
- + "/."
- + shortClassName);
+ new Thread(() -> {
+ try {
+ mDevice.executeShellCommand(
+ "cmd activity start-activity "
+ + (debug ? "-D" : "")
+ + " -W -n "
+ + packageName
+ + "/."
+ + shortClassName);
+ } catch (DeviceNotAvailableException e) {
+ CLog.i("Failed to start activity for package: " + packageName, e);
+ }
+ }).start();
+
// Don't keep trying after a minute.
final Instant deadline = Instant.now().plusSeconds(60);
String pid = "";