AdbTcpConnection

public class AdbTcpConnection
extends DefaultConnection

java.lang.Object
   ↳ com.android.tradefed.device.connection.AbstractConnection
     ↳ com.android.tradefed.device.connection.DefaultConnection
       ↳ com.android.tradefed.device.connection.AdbTcpConnection


Default connection representation of a device, assumed to be a standard adb connection of the device.

Summary

Constants

long DEFAULT_SHORT_CMD_TIMEOUT

int MAX_RETRIES

long RETRY_INTERVAL_MS

long WAIT_FOR_ADB_CONNECT

Public constructors

AdbTcpConnection(DefaultConnection.ConnectionBuilder builder)

Public methods

boolean adbTcpConnect(String host, String port)

Helper method to adb connect to a given tcp ip Android device

boolean adbTcpDisconnect(String host, String port)

Helper method to adb disconnect from a given tcp ip Android device

String getHostName(String serial)

Return the hostname associated with the device.

String getPortNum(String serial)

Return the port number asociated with the device.

void reconnect(String serial)

Reconnect the connection to the device.

void tearDownConnection()

Clean up the connection.

Protected methods

void waitForAdbConnect(String serial, long waitTime)

Check if the adb connection is enabled.

Constants

DEFAULT_SHORT_CMD_TIMEOUT

protected static final long DEFAULT_SHORT_CMD_TIMEOUT

Constant Value: 20000 (0x0000000000004e20)

MAX_RETRIES

protected static final int MAX_RETRIES

Constant Value: 5 (0x00000005)

RETRY_INTERVAL_MS

protected static final long RETRY_INTERVAL_MS

Constant Value: 5000 (0x0000000000001388)

WAIT_FOR_ADB_CONNECT

protected static final long WAIT_FOR_ADB_CONNECT

Constant Value: 120000 (0x000000000001d4c0)

Public constructors

AdbTcpConnection

public AdbTcpConnection (DefaultConnection.ConnectionBuilder builder)

Parameters
builder DefaultConnection.ConnectionBuilder

Public methods

adbTcpConnect

public boolean adbTcpConnect (String host, 
                String port)

Helper method to adb connect to a given tcp ip Android device

Parameters
host String: the hostname/ip of a tcp/ip Android device

port String: the port number of a tcp/ip device

Returns
boolean true if we successfully connected to the device, false otherwise.

adbTcpDisconnect

public boolean adbTcpDisconnect (String host, 
                String port)

Helper method to adb disconnect from a given tcp ip Android device

Parameters
host String: the hostname/ip of a tcp/ip Android device

port String: the port number of a tcp/ip device

Returns
boolean true if we successfully disconnected to the device, false otherwise.

getHostName

public String getHostName (String serial)

Return the hostname associated with the device. Extracted from the serial.

Parameters
serial String

Returns
String

getPortNum

public String getPortNum (String serial)

Return the port number asociated with the device. Extracted from the serial.

Parameters
serial String

Returns
String

reconnect

public void reconnect (String serial)

Reconnect the connection to the device.

Parameters
serial String: The device serial number.

Throws
DeviceNotAvailableException

tearDownConnection

public void tearDownConnection ()

Clean up the connection.

Protected methods

waitForAdbConnect

protected void waitForAdbConnect (String serial, 
                long waitTime)

Check if the adb connection is enabled.

Parameters
serial String

waitTime long

Throws
DeviceNotAvailableException