RemoteAndroidVirtualDevice
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 |
Extends RemoteAndroidDevice
behavior for a full stack android device running in the
Google Compute Engine (Gce). Assume the device serial will be in the format
Summary
Public constructors | |
---|---|
RemoteAndroidVirtualDevice(IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)
Creates a |
Public methods | |
---|---|
GceAvdInfo
|
getAvdInfo()
Returns the |
GceAvdInfo
|
getAvdInfoAnyState()
Returns the |
DeviceDescriptor
|
getDeviceDescriptor()
Return a |
GceSshTunnelMonitor
|
getGceSshMonitor()
Returns the |
|
getTombstones()
Cuttlefish has a special feature that brings the tombstones to the remote host where we can get them directly. |
void
|
postBootSetup()
{@inherit } |
void
|
postInvocationTearDown(Throwable exception)
Extra steps for device specific required clean up that will be executed after the invocation is done. |
CommandResult
|
powerwash()
Attempt to powerwash a GCE instance |
CommandResult
|
powerwashGce(String user, Integer offset)
Attempt to powerwash a GCE instance |
boolean
|
powerwashGce()
Attempt to powerwash a GCE instance |
void
|
preInvocationSetup(IBuildInfo info, MultiMap<String, String> attributes)
Extra steps for device specific required setup that will be executed on the device prior to the invocation flow. |
boolean
|
recoverDevice()
Attempts to recover device communication. |
void
|
setAvdInfo(GceAvdInfo gceAvdInfo)
Set the |
void
|
setGceSshMonitor(GceSshTunnelMonitor gceSshMonitor)
Override the internal |
Protected methods | |
---|---|
void
|
doAdbReboot(NativeDevice.RebootMode rebootMode, String reason)
Perform a adb reboot. |
long
|
getCurrentTime()
Returns the current system time. |
void
|
launchGce(IBuildInfo buildInfo, MultiMap<String, String> attributes)
Launch the actual gce device based on the build info. |
void
|
postAdbReboot()
Possible extra actions that can be taken after a reboot. |
void
|
waitForTunnelOnline(long waitTime)
Check if the tunnel monitor is running. |
Public constructors
RemoteAndroidVirtualDevice
public RemoteAndroidVirtualDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)
Creates a RemoteAndroidVirtualDevice
.
Parameters | |
---|---|
device |
IDevice : the associated IDevice |
stateMonitor |
IDeviceStateMonitor : the IDeviceStateMonitor mechanism to use |
allocationMonitor |
IDeviceMonitor : the IDeviceMonitor to inform of allocation state changes. |
Public methods
getAvdInfo
public GceAvdInfo getAvdInfo ()
Returns the GceAvdInfo
from the created remote VM. Returns null if the bring up was
not successful.
Returns | |
---|---|
GceAvdInfo |
getAvdInfoAnyState
public GceAvdInfo getAvdInfoAnyState ()
Returns the GceAvdInfo
from the created remote VM. Returns regardless of the status
so we can inspect the info.
Returns | |
---|---|
GceAvdInfo |
getDeviceDescriptor
public DeviceDescriptor getDeviceDescriptor ()
Return a DeviceDescriptor
from the device information to get info on it without
passing the actual device object.
Returns | |
---|---|
DeviceDescriptor |
getGceSshMonitor
public GceSshTunnelMonitor getGceSshMonitor ()
Returns the GceSshTunnelMonitor
of the device.
Returns | |
---|---|
GceSshTunnelMonitor |
getTombstones
publicgetTombstones ()
Cuttlefish has a special feature that brings the tombstones to the remote host where we can get them directly.
Returns | |
---|---|
|
A list of tombstone files, empty if no tombstone. |
Throws | |
---|---|
DeviceNotAvailableException |
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
Extra steps for device specific required clean up that will be executed after the invocation is done.
Parameters | |
---|---|
exception |
Throwable : if any, the final exception raised by the invocation failure. |
powerwash
public CommandResult powerwash ()
Attempt to powerwash a GCE instance
Returns | |
---|---|
CommandResult |
returns CommandResult of the powerwash attempts |
Throws | |
---|---|
|
com.android.tradefed.targetprep.TargetSetupError |
TargetSetupError |
powerwashGce
public CommandResult powerwashGce (String user, Integer offset)
Attempt to powerwash a GCE instance
Parameters | |
---|---|
user |
String : the host running user of AVD, null if not applicable. |
offset |
Integer : the device num offset of the AVD in the host, null if not
applicable |
Returns | |
---|---|
CommandResult |
returns CommandResult of the powerwash attempts |
Throws | |
---|---|
|
com.android.tradefed.targetprep.TargetSetupError |
TargetSetupError |
powerwashGce
public boolean powerwashGce ()
Attempt to powerwash a GCE instance
Returns | |
---|---|
boolean |
returns CommandResult of the powerwash attempts |
Throws | |
---|---|
TargetSetupError |
preInvocationSetup
public void preInvocationSetup (IBuildInfo info, MultiMap<String, String> attributes)
Extra steps for device specific required setup that will be executed on the device prior to the invocation flow.
Parameters | |
---|---|
info |
IBuildInfo : The IBuildInfo of the device. |
attributes |
MultiMap : The attributes stored in the invocation context |
Throws | |
---|---|
DeviceNotAvailableException |
|
TargetSetupError |
recoverDevice
public boolean recoverDevice ()
Attempts to recover device communication.
Returns | |
---|---|
boolean |
True if recovery attempted and successful, returns False if recovery was skipped |
Throws | |
---|---|
DeviceNotAvailableException |
setAvdInfo
public void setAvdInfo (GceAvdInfo gceAvdInfo)
Set the GceAvdInfo
for launched device.
Parameters | |
---|---|
gceAvdInfo |
GceAvdInfo |
Throws | |
---|---|
TargetSetupError |
setGceSshMonitor
public void setGceSshMonitor (GceSshTunnelMonitor gceSshMonitor)
Override the internal GceSshTunnelMonitor
of the
device.
Parameters | |
---|---|
gceSshMonitor |
GceSshTunnelMonitor |
Protected methods
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode, String reason)
Perform a adb reboot.
Parameters | |
---|---|
rebootMode |
NativeDevice.RebootMode : a mode of this reboot. |
reason |
String : for this reboot. |
Throws | |
---|---|
DeviceNotAvailableException |
getCurrentTime
protected long getCurrentTime ()
Returns the current system time. Exposed for testing.
Returns | |
---|---|
long |
launchGce
protected void launchGce (IBuildInfo buildInfo, MultiMap<String, String> attributes)
Launch the actual gce device based on the build info.
Parameters | |
---|---|
buildInfo |
IBuildInfo |
attributes |
MultiMap |
Throws | |
---|---|
TargetSetupError |
postAdbReboot
protected void postAdbReboot ()
Possible extra actions that can be taken after a reboot.
Throws | |
---|---|
DeviceNotAvailableException |
waitForTunnelOnline
protected void waitForTunnelOnline (long waitTime)
Check if the tunnel monitor is running.
Parameters | |
---|---|
waitTime |
long |
Throws | |
---|---|
DeviceNotAvailableException |