Fix MonkeyRunner to use the changed ddmlib API.

Change-Id: Ia56612bf700e360f77dd9e13c0bc74eac59e30ea
This commit is contained in:
Xavier Ducrohet
2010-07-15 17:44:56 -07:00
parent 38675e8073
commit b8f2aa9ff1

View File

@@ -20,6 +20,8 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.android.ddmlib.IDevice;
import com.android.ddmlib.TimeoutException;
import com.android.ddmlib.AdbCommandRejectedException;
import com.android.monkeyrunner.MonkeyDevice;
import com.android.monkeyrunner.MonkeyImage;
import com.android.monkeyrunner.MonkeyManager;
@@ -89,7 +91,19 @@ public class AdbMonkeyDevice extends MonkeyDevice {
}
private MonkeyManager createManager(String address, int port) {
try {
device.createForward(port, port);
} catch (TimeoutException e) {
LOG.log(Level.SEVERE, "Timeout creating adb port forwarding", e);
return null;
} catch (AdbCommandRejectedException e) {
LOG.log(Level.SEVERE, "Adb rejected adb port forwarding command: " + e.getMessage(), e);
return null;
} catch (IOException e) {
LOG.log(Level.SEVERE, "Unable to create adb port forwarding: " + e.getMessage(), e);
return null;
}
String command = "monkey --port " + port;
executeAsyncCommand(command, new LoggingOutputReceiver(LOG, Level.FINE));