DeviceMonitor
public
final
class
DeviceMonitor
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.device.server.DeviceMonitor |
DeviceMonitor 会监控附加到 adb 的设备。
在一个线程上,它运行 DeviceListMonitorTask。这会建立与 adb 主机的套接字连接,并发出 ERROR(DeviceListMonitorTask.ADB_TRACK_DEVICES_COMMAND/com.android.tradefed.device.server.DeviceListMonitorTask#ADB_TRACK_DEVICES_COMMAND DeviceListMonitorTask.ADB_TRACK_DEVICES_COMMAND)。然后,它会监控该套接字,以了解设备连接和设备状态的所有变化。如果未启用 ERROR(/AndroidDebugBridge::getClientSupport),则不会运行 ERROR(/DeviceClientMonitorTask),并且设备不会注册。
在另一个线程中,它运行 ERROR(/DeviceClientMonitorTask)。这会为每个已注册的设备建立与 adb 主机的套接字连接,并发出 ERROR(/DeviceClientMonitorTask.ADB_TRACK_JDWP_COMMAND)。在此连接上,它会监控设备上的活跃客户端。注意:单个线程会监控来自所有设备的 JDWP 连接。与 adb 的不同套接字连接(每个设备一个)通过单个选择器进行多路复用。
摘要
嵌套类 | |
|---|---|
class |
DeviceMonitor.DeviceListComparisonResult
|
公共构造函数 | |
|---|---|
DeviceMonitor(AndroidDebugBridge server)
创建新的 |
|
公共方法 | |
|---|---|
int
|
getConnectionAttemptCount()
|
IDevice[]
|
getDevices()
返回设备。 |
int
|
getRestartAttemptCount()
|
boolean
|
hasInitialDeviceList()
|
boolean
|
isMonitoring()
返回监控器当前是否已连接到调试桥服务器。 |
void
|
start()
开始监控。 |
void
|
stop()
停止监控。 |
公共构造函数
DeviceMonitor
public DeviceMonitor (AndroidDebugBridge server)
创建新的 DeviceMonitor 对象并将其与正在运行的 AndroidDebugBridge 对象相关联。
| 参数 | |
|---|---|
server |
AndroidDebugBridge:正在运行的 AndroidDebugBridge。 |
公共方法
getConnectionAttemptCount
public int getConnectionAttemptCount ()
| 返回 | |
|---|---|
int |
|
getRestartAttemptCount
public int getRestartAttemptCount ()
| 返回 | |
|---|---|
int |
|
hasInitialDeviceList
public boolean hasInitialDeviceList ()
| 返回 | |
|---|---|
boolean |
|
isMonitoring
public boolean isMonitoring ()
返回监控器当前是否已连接到调试桥服务器。
| 返回 | |
|---|---|
boolean |
|
start
public void start ()
开始监控。
停止
public void stop ()
停止监控。