远程安卓虚拟设备

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 addExtraConnectionBuilderArgs ( DefaultConnection.ConnectionBuilder builder)
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

受保护的方法

addExtraConnectionBuilderArgs

protected void addExtraConnectionBuilderArgs (DefaultConnection.ConnectionBuilder builder)

参数
builder DefaultConnection.ConnectionBuilder

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