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 |
设备的默认连接表示,假定为设备的标准 adb 连接。
概括
常量 | |
---|---|
long | DEFAULT_SHORT_CMD_TIMEOUT |
int | MAX_RETRIES |
long | RETRY_INTERVAL_MS |
long | WAIT_FOR_ADB_CONNECT
|
公共构造函数 | |
---|---|
AdbTcpConnection ( DefaultConnection.ConnectionBuilder builder) |
公共方法 | |
---|---|
boolean | adbTcpConnect (String host, String port) adb 连接到给定 tcp ip Android 设备的辅助方法 |
boolean | adbTcpDisconnect (String host, String port) adb 与给定 tcp ip Android 设备断开连接的辅助方法 |
String | getHostName (String serial) 返回与设备关联的主机名。 |
String | getPortNum (String serial) 返回与设备关联的端口号。 |
void | reconnect (String serial) 重新连接到设备。 |
void | tearDownConnection () 清理连接。 |
受保护的方法 | |
---|---|
void | waitForAdbConnect (String serial, long waitTime) 检查是否启用了 adb 连接。 |
常量
默认_SHORT_CMD_TIMEOUT
protected static final long DEFAULT_SHORT_CMD_TIMEOUT
常数值:20000 (0x0000000000004e20)
MAX_RETRIES 次
protected static final int MAX_RETRIES
常量值:5 (0x00000005)
RETRY_INTERVAL_MS
protected static final long RETRY_INTERVAL_MS
常量值:5000 (0x0000000000001388)
WAIT_FOR_ADB_CONNECT
protected static final long WAIT_FOR_ADB_CONNECT
常数值:120000 (0x000000000001d4c0)
公共构造函数
AdbTcpConnection
public AdbTcpConnection (DefaultConnection.ConnectionBuilder builder)
参数 | |
---|---|
builder | DefaultConnection.ConnectionBuilder |
公共方法
adbTcpConnect
public boolean adbTcpConnect (String host, String port)
adb 连接到给定 tcp ip Android 设备的辅助方法
参数 | |
---|---|
host | String : tcp/ip Android 设备的主机名/ip |
port | String : tcp/ip 设备的端口号 |
退货 | |
---|---|
boolean | 如果我们成功连接到设备,则为 true,否则为 false。 |
adbTcpDisconnect
public boolean adbTcpDisconnect (String host, String port)
adb 与给定 tcp ip Android 设备断开连接的辅助方法
参数 | |
---|---|
host | String : tcp/ip Android 设备的主机名/ip |
port | String : tcp/ip 设备的端口号 |
退货 | |
---|---|
boolean | 如果我们成功断开与设备的连接,则为 true,否则为 false。 |
获取主机名
public String getHostName (String serial)
返回与设备关联的主机名。从连续剧中提取。
参数 | |
---|---|
serial | String |
退货 | |
---|---|
String |
获取端口号
public String getPortNum (String serial)
返回与设备关联的端口号。从连续剧中提取。
参数 | |
---|---|
serial | String |
退货 | |
---|---|
String |
重新连接
public void reconnect (String serial)
重新连接到设备。
参数 | |
---|---|
serial | String :设备序列号。 |
投掷 | |
---|---|
DeviceNotAvailableException |
拆卸连接
public void tearDownConnection ()
清理连接。
受保护的方法
等待 AdbConnect
protected void waitForAdbConnect (String serial, long waitTime)
检查是否启用了 adb 连接。
参数 | |
---|---|
serial | String |
waitTime | long |
投掷 | |
---|---|
DeviceNotAvailableException |