遠端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) 建立一個 |
公共方法 | |
---|---|
static boolean | checkSerialFormatValid (String serialString) 檢查串口格式是否符合預期 |
boolean | connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) 連接到 wifi 網路。 |
DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) 從設備資訊中返回 |
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 | |
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 。 |