RemoteAndroidVirtualDevice
public
class
RemoteAndroidVirtualDevice
extends RemoteAndroidDevice
implements
ITestLoggerReceiver
| 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 行为。假设设备序列号的格式为 adb 中的
摘要
公共构造函数 | |
|---|---|
RemoteAndroidVirtualDevice(IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)
|
|
公共方法 | |
|---|---|
GceAvdInfo
|
getAvdInfo()
从创建的远程虚拟机返回 |
DeviceDescriptor
|
getDeviceDescriptor()
|
|
getTombstones()
Cuttlefish 有一项特殊功能,可将墓碑带到远程主机,以便我们直接获取它们。 |
void
|
postBootSetup()
{@inherit } |
void
|
postInvocationTearDown(Throwable exception)
|
boolean
|
powerwashGce()
尝试对 GCE 实例执行 Powerwash 操作 |
void
|
preInvocationSetup(IBuildInfo info, MultiMap<String, String> attributes)
|
void
|
recoverDevice()
尝试恢复设备通信。 |
void
|
setGceSshMonitor(GceSshTunnelMonitor gceSshMonitor)
替换设备的内部 |
void
|
setTestLogger(ITestLogger testLogger)
|
受保护的方法 | |
|---|---|
void
|
doAdbReboot(NativeDevice.RebootMode rebootMode, String reason)
执行 adb 重启。 |
long
|
getCurrentTime()
返回当前系统时间。 |
GceSshTunnelMonitor
|
getGceSshMonitor()
返回设备的 |
void
|
launchGce(IBuildInfo buildInfo, MultiMap<String, String> attributes)
根据 build 信息启动实际的 GCE 设备。 |
void
|
waitForTunnelOnline(long waitTime)
检查隧道监视器是否正在运行。 |
公共构造函数
RemoteAndroidVirtualDevice
public RemoteAndroidVirtualDevice (IDevice device,
IDeviceStateMonitor stateMonitor,
IDeviceMonitor allocationMonitor)创建 RemoteAndroidVirtualDevice。
| 参数 | |
|---|---|
device |
IDevice:关联的 IDevice |
stateMonitor |
IDeviceStateMonitor:要使用的 IDeviceStateMonitor 机制 |
allocationMonitor |
IDeviceMonitor:用于通知分配状态变化的 IDeviceMonitor。 |
公共方法
getDeviceDescriptor
public DeviceDescriptor getDeviceDescriptor ()
| 返回 | |
|---|---|
DeviceDescriptor |
|
getTombstones
publicgetTombstones ()
Cuttlefish 有一项特殊功能,可将墓碑传送到远程主机,以便我们直接获取它们。
| 返回 | |
|---|---|
|
|
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
postBootSetup
public void postBootSetup ()
{@inherit }
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
| 参数 | |
|---|---|
exception |
Throwable |
powerwashGce
public boolean powerwashGce ()
尝试对 GCE 实例执行 Powerwash
| 返回 | |
|---|---|
boolean |
如果 GCE 的 Powerwash 成功,则返回 true。 |
| 抛出 | |
|---|---|
|
com.android.tradefed.targetprep.TargetSetupError |
DeviceNotAvailableException |
|
TargetSetupError |
|
preInvocationSetup
public void preInvocationSetup (IBuildInfo info,
MultiMap<String, String> attributes)
| 参数 | |
|---|---|
info |
IBuildInfo |
attributes |
MultiMap |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
TargetSetupError |
|
recoverDevice
public void recoverDevice ()
尝试恢复设备通信。
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
setGceSshMonitor
public void setGceSshMonitor (GceSshTunnelMonitor gceSshMonitor)
替换设备的内部 GceSshTunnelMonitor。
| 参数 | |
|---|---|
gceSshMonitor |
GceSshTunnelMonitor |
setTestLogger
public void setTestLogger (ITestLogger testLogger)
| 参数 | |
|---|---|
testLogger |
ITestLogger |
受保护的方法
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode, String reason)
执行 adb reboot。
| 参数 | |
|---|---|
rebootMode |
NativeDevice.RebootMode:此重新启动的模式。 |
reason |
String:针对此次重新启动。 |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
getCurrentTime
protected long getCurrentTime ()
返回当前系统时间。公开以供测试。
| 返回 | |
|---|---|
long |
|
getGceSshMonitor
protected GceSshTunnelMonitor getGceSshMonitor ()
返回设备的 GceSshTunnelMonitor。
公开以供测试。
| 返回 | |
|---|---|
GceSshTunnelMonitor |
|
launchGce
protected void launchGce (IBuildInfo buildInfo,
MultiMap<String, String> attributes)根据 build 信息启动实际的 GCE 设备。
| 参数 | |
|---|---|
buildInfo |
IBuildInfo |
attributes |
MultiMap |
| 抛出 | |
|---|---|
TargetSetupError |
|
waitForTunnelOnline
protected void waitForTunnelOnline (long waitTime)
检查隧道监视器是否正在运行。
| 参数 | |
|---|---|
waitTime |
long |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|