SdkAvdPreparer

public class SdkAvdPreparer
extends BaseTargetPreparer implements IHostCleaner

java.lang.Object
   ↳ com.android.tradefed.targetprep.BaseTargetPreparer
     ↳ com.android.tradefed.targetprep.SdkAvdPreparer


A ITargetPreparer that will create an avd and launch an emulator

Summary

Public constructors

SdkAvdPreparer()

Creates a SdkAvdPreparer.

Public methods

void cleanUp(IBuildInfo buildInfo, Throwable e)

Clean the host (remove the tmp files, etc).

String createAvd(ISdkBuildInfo sdkBuildInfo)

Finds SDK target based on the ISdkBuildInfo, creates AVD for this target and returns its name.

void launchEmulatorForAvd(ISdkBuildInfo sdkBuild, ITestDevice device, String avd)

Launch an emulator for given avd, and wait for it to become available.

void setForceKvm(boolean forceKvm)
void setGpu(boolean gpu)

Sets programmatically whether the gpu should be on or off.

void setUp(ITestDevice device, IBuildInfo buildInfo)

Public constructors

SdkAvdPreparer

public SdkAvdPreparer ()

Creates a SdkAvdPreparer.

Public methods

cleanUp

public void cleanUp (IBuildInfo buildInfo, 
                Throwable e)

Clean the host (remove the tmp files, etc).

Parameters
buildInfo IBuildInfo: IBuildInfo.

e Throwable: the Throwable which ended the test.

createAvd

public String createAvd (ISdkBuildInfo sdkBuildInfo)

Finds SDK target based on the ISdkBuildInfo, creates AVD for this target and returns its name.

Parameters
sdkBuildInfo ISdkBuildInfo: the ISdkBuildInfo

Returns
String the created AVD name

Throws
TargetSetupError if could not get targets
BuildError if failed to create the AVD

launchEmulatorForAvd

public void launchEmulatorForAvd (ISdkBuildInfo sdkBuild, 
                ITestDevice device, 
                String avd)

Launch an emulator for given avd, and wait for it to become available. Will launch the emulator on the port specified in the allocated ITestDevice

Parameters
sdkBuild ISdkBuildInfo: the ISdkBuildInfo

device ITestDevice: the placeholder ITestDevice representing allocated emulator device

avd String: the avd to launch

Throws
DeviceNotAvailableException
TargetSetupError if could not get targets
BuildError if emulator fails to boot
DeviceNotAvailableException

setForceKvm

public void setForceKvm (boolean forceKvm)

Parameters
forceKvm boolean

setGpu

public void setGpu (boolean gpu)

Sets programmatically whether the gpu should be on or off.

setUp

public void setUp (ITestDevice device, 
                IBuildInfo buildInfo)

Parameters
device ITestDevice

buildInfo IBuildInfo

Throws
TargetSetupError
DeviceNotAvailableException
BuildError