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


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 : in adb.

Summary

Public constructors

RemoteAndroidVirtualDevice(IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

Creates a RemoteAndroidVirtualDevice.

Public methods

GceAvdInfo getAvdInfo()

Returns the GceAvdInfo from the created remote VM.

DeviceDescriptor getDeviceDescriptor()

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)

boolean powerwashGce()

Attempt to powerwash a GCE instance

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

void recoverDevice()

Attempts to recover device communication.

void setGceSshMonitor(GceSshTunnelMonitor gceSshMonitor)

Override the internal GceSshTunnelMonitor of the device.

void setTestLogger(ITestLogger testLogger)

Protected methods

void doAdbReboot(NativeDevice.RebootMode rebootMode, String reason)

Perform a adb reboot.

long getCurrentTime()

Returns the current system time.

GceSshTunnelMonitor getGceSshMonitor()

Returns the GceSshTunnelMonitor of the device.

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

Launch the actual gce device based on the build info.

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

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor ()

Returns
DeviceDescriptor

getTombstones

public  getTombstones ()

Cuttlefish has a special feature that brings the tombstones to the remote host where we can get them directly.

Returns

Throws
DeviceNotAvailableException

postBootSetup

public void postBootSetup ()

{@inherit }

Throws
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

Parameters
exception Throwable

powerwashGce

public boolean powerwashGce ()

Attempt to powerwash a GCE instance

Returns
boolean returns true if powerwash Gce success.

Throws
com.android.tradefed.targetprep.TargetSetupError
DeviceNotAvailableException
TargetSetupError

preInvocationSetup

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

Parameters
info IBuildInfo

attributes MultiMap

Throws
DeviceNotAvailableException
TargetSetupError

recoverDevice

public void recoverDevice ()

Attempts to recover device communication.

Throws
DeviceNotAvailableException

setGceSshMonitor

public void setGceSshMonitor (GceSshTunnelMonitor gceSshMonitor)

Override the internal GceSshTunnelMonitor of the device.

Parameters
gceSshMonitor GceSshTunnelMonitor

setTestLogger

public void setTestLogger (ITestLogger testLogger)

Parameters
testLogger ITestLogger

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

getGceSshMonitor

protected GceSshTunnelMonitor getGceSshMonitor ()

Returns the GceSshTunnelMonitor of the device. Exposed for testing.

Returns
GceSshTunnelMonitor

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

waitForTunnelOnline

protected void waitForTunnelOnline (long waitTime)

Check if the tunnel monitor is running.

Parameters
waitTime long

Throws
DeviceNotAvailableException