遠程安卓虛擬設備

public class RemoteAndroidVirtualDevice
extends RemoteAndroidDevice

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


為在 Google Compute Engine (Gce) 中運行的全棧 android 設備擴展RemoteAndroidDevice行為。假設設備序列號的格式:在亞行。

概括

公共構造函數

RemoteAndroidVirtualDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

創建一個RemoteAndroidVirtualDevice

公共方法

GceAvdInfo getAvdInfo ()

從創建的遠程 VM 返回GceAvdInfo

GceAvdInfo getAvdInfoAnyState ()

從創建的遠程 VM 返回GceAvdInfo

DeviceDescriptor getDeviceDescriptor ()

從設備信息中返回一個DeviceDescriptor以獲取有關它的信息,而不傳遞實際的設備對象。

GceSshTunnelMonitor getGceSshMonitor ()

返回設備的GceSshTunnelMonitor

getTombstones ()

Cuttlefish 有一個特殊的功能,可以將墓碑帶到我們可以直接獲取它們的遠程主機。

void postBootSetup ()

{@繼承}

void postInvocationTearDown (Throwable exception)

特定於設備的額外步驟需要清理,將在調用完成後執行。

CommandResult powerwash ()

嘗試 powerwash 一個 GCE 實例

CommandResult powerwashGce (String user, Integer offset)

嘗試 powerwash 一個 GCE 實例

boolean powerwashGce ()

嘗試 powerwash 一個 GCE 實例

void preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes)

設備特定所需設置的額外步驟將在調用流程之前在設備上執行。

boolean recoverDevice ()

嘗試恢復設備通信。

void setAvdInfo ( GceAvdInfo gceAvdInfo)

為啟動的設備設置GceAvdInfo

void setGceSshMonitor ( GceSshTunnelMonitor gceSshMonitor)

覆蓋設備的內部GceSshTunnelMonitor

受保護的方法

void doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason)

執行 adb 重啟。

long getCurrentTime ()

返回當前系統時間。

void launchGce ( IBuildInfo buildInfo, MultiMap <String, String> attributes)

根據構建信息啟動實際的 gce 設備。

void postAdbReboot ()

重啟後可能執行的額外操作。

void waitForTunnelOnline (long waitTime)

檢查隧道監視器是否正在運行。

公共構造函數

遠程安卓虛擬設備

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

創建一個RemoteAndroidVirtualDevice

參數
device IDevice :關聯的IDevice

stateMonitor IDeviceStateMonitor :要使用的IDeviceStateMonitor機制

allocationMonitor IDeviceMonitor :通知分配狀態更改的IDeviceMonitor

公共方法

獲取AVD信息

public GceAvdInfo getAvdInfo ()

從創建的遠程 VM 返回GceAvdInfo 。如果啟動不成功,則返回 null。

退貨
GceAvdInfo

getAvdInfoAnyState

public GceAvdInfo getAvdInfoAnyState ()

從創建的遠程 VM 返回GceAvdInfo 。無論狀態如何都返回,以便我們檢查信息。

退貨
GceAvdInfo

獲取設備描述符

public DeviceDescriptor getDeviceDescriptor ()

從設備信息中返回一個DeviceDescriptor以獲取有關它的信息,而不傳遞實際的設備對象。

退貨
DeviceDescriptor

獲取GceSshMonitor

public GceSshTunnelMonitor getGceSshMonitor ()

返回設備的GceSshTunnelMonitor

退貨
GceSshTunnelMonitor

獲取墓碑

public  getTombstones ()

Cuttlefish 有一個特殊的功能,可以將墓碑帶到我們可以直接獲取它們的遠程主機。

退貨
墓碑文件列表,如果沒有墓碑則為空。

投擲
DeviceNotAvailableException

後啟動設置

public void postBootSetup ()

{@繼承}

投擲
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

特定於設備的額外步驟需要清理,將在調用完成後執行。

參數
exception Throwable :如果有的話,調用失敗引發的最終異常。

強力清洗

public CommandResult powerwash ()

嘗試 powerwash 一個 GCE 實例

退貨
CommandResult返回 Powerwash 嘗試的 CommandResult

投擲
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

powerwashGce

public CommandResult powerwashGce (String user, 
                Integer offset)

嘗試 powerwash 一個 GCE 實例

參數
user String : AVD 的主機運行用戶,如果不適用則為null

offset Integer : 主機中 AVD 的設備編號偏移量,如果不適用則為null

退貨
CommandResult返回 Powerwash 嘗試的 CommandResult

投擲
com.android.tradefed.targetprep.TargetSetupError
TargetSetupError

powerwashGce

public boolean powerwashGce ()

嘗試 powerwash 一個 GCE 實例

退貨
boolean返回 Powerwash 嘗試的 CommandResult

投擲
TargetSetupError

預調用設置

public void preInvocationSetup (IBuildInfo info, 
                MultiMap<String, String> attributes)

設備特定所需設置的額外步驟將在調用流程之前在設備上執行。

參數
info IBuildInfo :設備的IBuildInfo

attributes MultiMap :存儲在調用上下文中的屬性

投擲
DeviceNotAvailableException
TargetSetupError

恢復設備

public boolean recoverDevice ()

嘗試恢復設備通信。

退貨
boolean如果嘗試恢復並成功則返回 True,如果跳過恢復則返回 False

投擲
DeviceNotAvailableException

設置AVD信息

public void setAvdInfo (GceAvdInfo gceAvdInfo)

為啟動的設備設置GceAvdInfo

參數
gceAvdInfo GceAvdInfo

投擲
TargetSetupError

設置GceSshMonitor

public void setGceSshMonitor (GceSshTunnelMonitor gceSshMonitor)

覆蓋設備的內部GceSshTunnelMonitor

參數
gceSshMonitor GceSshTunnelMonitor

受保護的方法

doAdbReboot

protected void doAdbReboot (NativeDevice.RebootMode rebootMode, 
                String reason)

執行 adb 重啟。

參數
rebootMode NativeDevice.RebootMode :此重啟的模式。

reason String :用於此次重啟。

投擲
DeviceNotAvailableException

獲取當前時間

protected long getCurrentTime ()

返回當前系統時間。暴露測試。

退貨
long

啟動Gce

protected void launchGce (IBuildInfo buildInfo, 
                MultiMap<String, String> attributes)

根據構建信息啟動實際的 gce 設備。

參數
buildInfo IBuildInfo

attributes MultiMap

投擲
TargetSetupError

postAdbReboot

protected void postAdbReboot ()

重啟後可能執行的額外操作。

投擲
DeviceNotAvailableException

等待隧道在線

protected void waitForTunnelOnline (long waitTime)

檢查隧道監視器是否正在運行。

參數
waitTime long

投擲
DeviceNotAvailableException