遠端Android虛擬設備
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 計算引擎 (Gce) 中運行的全端 Android 裝置的RemoteAndroidDevice
行為。假設設備序號的格式為
概括
公共構造函數 | |
---|---|
RemoteAndroidVirtualDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor) |
公共方法 | |
---|---|
GceAvdInfo | getAvdInfo () 從已建立的遠端VM返回 |
DeviceDescriptor | getDeviceDescriptor () |
getTombstones () Cuttlefish 有一個特殊功能,可以將墓碑帶到遠端主機,我們可以直接取得它們。 | |
void | postBootSetup () {@繼承} |
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) 根據建置資訊啟動實際的 gce 裝置。 |
void | waitForTunnelOnline (long waitTime) 檢查隧道監視器是否正在運作。 |
公共構造函數
遠端Android虛擬設備
public RemoteAndroidVirtualDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)
建立一個RemoteAndroidVirtualDevice
。
參數 | |
---|---|
device | IDevice :關聯的IDevice |
stateMonitor | IDeviceStateMonitor :要使用的IDeviceStateMonitor 機制 |
allocationMonitor | IDeviceMonitor :通知指派狀態變更的IDeviceMonitor 。 |
公共方法
取得設備描述符
public DeviceDescriptor getDeviceDescriptor ()
退貨 | |
---|---|
DeviceDescriptor |
取得墓碑
publicgetTombstones ()
Cuttlefish 有一個特殊功能,可以將墓碑帶到遠端主機,我們可以直接取得它們。
退貨 | |
---|---|
投擲 | |
---|---|
DeviceNotAvailableException |
啟動後設定
public void postBootSetup ()
{@繼承}
投擲 | |
---|---|
DeviceNotAvailableException |
調用後拆卸
public void postInvocationTearDown (Throwable exception)
參數 | |
---|---|
exception | Throwable |
強力清洗Gce
public boolean powerwashGce ()
嘗試對 GCE 實例進行 Powerwash
退貨 | |
---|---|
boolean | 如果 powerwash Gce 成功,則傳回 true。 |
投擲 | |
---|---|
| com.android.tradefed.targetprep.TargetSetupError |
DeviceNotAvailableException | |
TargetSetupError |
調用前設定
public void preInvocationSetup (IBuildInfo info, MultiMap<String, String> attributes)
參數 | |
---|---|
info | IBuildInfo |
attributes | MultiMap |
投擲 | |
---|---|
DeviceNotAvailableException | |
TargetSetupError |
恢復設備
public void recoverDevice ()
嘗試恢復設備通訊。
投擲 | |
---|---|
DeviceNotAvailableException |
設定GceSshMonitor
public void setGceSshMonitor (GceSshTunnelMonitor gceSshMonitor)
覆蓋設備的內部GceSshTunnelMonitor
。
參數 | |
---|---|
gceSshMonitor | GceSshTunnelMonitor |
設定測試記錄器
public void setTestLogger (ITestLogger testLogger)
參數 | |
---|---|
testLogger | ITestLogger |
受保護的方法
執行AdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode, String reason)
執行 adb 重啟。
參數 | |
---|---|
rebootMode | NativeDevice.RebootMode :重啟的一種模式。 |
reason | String :用於此次重新啟動。 |
投擲 | |
---|---|
DeviceNotAvailableException |
取得當前時間
protected long getCurrentTime ()
返回目前系統時間。暴露進行測試。
退貨 | |
---|---|
long |
取得GceSshMonitor
protected GceSshTunnelMonitor getGceSshMonitor ()
返回設備的GceSshTunnelMonitor
。暴露進行測試。
退貨 | |
---|---|
GceSshTunnelMonitor |
啟動Gce
protected void launchGce (IBuildInfo buildInfo, MultiMap<String, String> attributes)
根據建置資訊啟動實際的 gce 裝置。
參數 | |
---|---|
buildInfo | IBuildInfo |
attributes | MultiMap |
投擲 | |
---|---|
TargetSetupError |
等待隧道在線
protected void waitForTunnelOnline (long waitTime)
檢查隧道監視器是否正在運作。
參數 | |
---|---|
waitTime | long |
投擲 | |
---|---|
DeviceNotAvailableException |