RemoteAndroidDevice

public class RemoteAndroidDevice
extends TestDevice

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


為透過 ADB 連線的完整堆疊 Android 裝置實作 ITestDevice。假設裝置序號的格式為 : (在 ADB 中)。

摘要

常數

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)

檢查序列的格式是否符合預期 :port

boolean connectToWifiNetwork( wifiSsidToPsk, boolean scanSsid)

連線至 Wi-Fi 網路。

DeviceDescriptor getDeviceDescriptor(boolean shortDescriptor)

從裝置資訊傳回 DeviceDescriptor,即可取得相關資訊,而無須傳遞實際的裝置物件。

String getMacAddress()

傳回裝置的 MAC 位址,如果無法從裝置查詢,則傳回空值。

boolean isEncryptionSupported()

傳回裝置是否支援加密功能。

常數

DEFAULT_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

public static final long WAIT_FOR_ADB_CONNECT

常數值: 120000 (0x000000000001d4c0)

公用建構函式

RemoteAndroidDevice

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

建立 RemoteAndroidDevice

參數
device IDevice:相關聯的 IDevice

stateMonitor IDeviceStateMonitor:要使用的 IDeviceStateMonitor 機制

allocationMonitor IDeviceMonitor:用於通知分配狀態變更的 IDeviceMonitor

公用方法

checkSerialFormatValid

public static boolean checkSerialFormatValid (String serialString)

檢查序列的格式是否符合預期 :port

參數
serialString String

傳回
boolean 如果格式有效,則傳回 true,否則傳回 false。

connectToWifiNetwork

public boolean connectToWifiNetwork ( wifiSsidToPsk, 
                boolean scanSsid)

連線至 Wi-Fi 網路。

開啟 Wi-Fi 並封鎖,直到與 wifiSsidToPsk 地圖中提供的其中一個 Wi-Fi 網路成功連線為止。連線完成後,執行個體會在每次重新啟動後嘗試還原連線,直到呼叫 ITestDevice.disconnectFromWifi()ITestDevice.clearLastConnectedWifiNetwork() 為止。

參數
wifiSsidToPsk :Wi-Fi SSID 與密碼的對應表。

scanSsid boolean:是否掃描這個網路的隱藏 SSID。

傳回
boolean true 已成功連上 Wi-Fi 網路。false otherwise

擲回
DeviceNotAvailableException

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

從裝置資訊傳回 DeviceDescriptor,即可取得相關資訊,而無須傳遞實際的裝置物件。

參數
shortDescriptor boolean:是否將描述符限制為最少必要資訊

傳回
DeviceDescriptor

getMacAddress

public String getMacAddress ()

傳回裝置的 MAC 位址,如果無法從裝置查詢,則傳回空值。

傳回
String

isEncryptionSupported

public boolean isEncryptionSupported ()

傳回裝置是否支援加密功能。

傳回
boolean true (如果裝置支援加密功能)。