远程Android设备

public class RemoteAndroidDevice
extends TestDevice

java.lang.Object
com.android.tradefed.device.NativeDevice
com.android.tradefed.device.TestDevice
com.android.tradefed.device.RemoteAndroidDevice


通过 adb connect 连接的全栈 Android 设备的ITestDevice实现。假设设备序列号的格式为在亚行。

概括

常数

long DEFAULT_SHORT_CMD_TIMEOUT

int MAX_RETRIES

long RETRY_INTERVAL_MS

long WAIT_FOR_ADB_CONNECT

公共构造函数

RemoteAndroidDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

创建一个RemoteAndroidDevice

公共方法

static boolean checkSerialFormatValid (String serialString)

检查串口格式是否符合预期:港口

boolean connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid)

连接到 wifi 网络。

DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

从设备信息中返回DeviceDescriptor以获取其信息,而无需传递实际的设备对象。

String getFastbootSerialNumber ()

返回快速启动模式序列号。

String getMacAddress ()

返回设备的MAC地址,如果向设备查询失败则返回null。

boolean isEncryptionSupported ()

返回设备是否支持加密。

常数

DEFAULT_SHORT_CMD_TIMEOUT

protected static final long DEFAULT_SHORT_CMD_TIMEOUT

常量值:20000 (0x0000000000004e20)

最多重试次数

protected static final int MAX_RETRIES

常量值:5 (0x00000005)

重试间隔毫秒

protected static final long RETRY_INTERVAL_MS

常量值:5000 (0x0000000000001388)

WAIT_FOR_ADB_CONNECT

public static final long WAIT_FOR_ADB_CONNECT

常量值:120000 (0x000000000001d4c0)

公共构造函数

远程Android设备

public RemoteAndroidDevice (IDevice device, 
                IDeviceStateMonitor stateMonitor, 
                IDeviceMonitor allocationMonitor)

创建一个RemoteAndroidDevice

参数
device IDevice :关联的IDevice

stateMonitor IDeviceStateMonitor :要使用的IDeviceStateMonitor机制

allocationMonitor IDeviceMonitor :通知分配状态更改的IDeviceMonitor

公共方法

检查串行格式是否有效

public static boolean checkSerialFormatValid (String serialString)

检查串口格式是否符合预期:港口

参数
serialString String

退货
boolean如果格式有效,则为 true,否则为 false。

连接到Wifi网络

public boolean connectToWifiNetwork ( wifiSsidToPsk, 
                boolean scanSsid)

连接到 wifi 网络。

打开 wifi 并阻止,直到与 wifiSsidToPsk 映射中给出的 wifi 网络之一成功连接。建立连接后,实例将在每次重新启动后尝试恢复连接,直到调用ITestDevice#disconnectFromWifi()ITestDevice#clearLastConnectedWifiNetwork()为止。

参数
wifiSsidToPsk :wifi SSID 到密码的映射。

scanSsid boolean :是否扫描该网络的隐藏 SSID。

退货
boolean如果成功连接到 wifi 网络则为true 。否则为false

投掷
DeviceNotAvailableException

获取设备描述符

public DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

从设备信息中返回DeviceDescriptor以获取其信息,而无需传递实际的设备对象。

参数
shortDescriptor boolean :是否将描述符限制为最低限度的信息

退货
DeviceDescriptor

获取Fastboot序列号

public String getFastbootSerialNumber ()

返回快速启动模式序列号。

退货
String

获取Mac地址

public String getMacAddress ()

返回设备的MAC地址,如果向设备查询失败则返回null。

退货
String

是否支持加密

public boolean isEncryptionSupported ()

返回设备是否支持加密。

退货
boolean如果设备支持加密,则为true