SdkAvdPreparer

public class SdkAvdPreparer
extends Object implements ITargetPreparer, IHostCleaner

java.lang.Object
   ↳ com.android.tradefed.targetprep.SdkAvdPreparer
Known Direct Subclasses
LocalSdkAvdPreparer A ITargetPreparer that will create an avd and launch an emulator  


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)

Perform the target setup for testing.

Public constructors

SdkAvdPreparer

SdkAvdPreparer ()

Creates a SdkAvdPreparer.

Public methods

cleanUp

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

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

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

void setForceKvm (boolean forceKvm)

Parameters
forceKvm boolean

setGpu

void setGpu (boolean gpu)

Sets programmatically whether the gpu should be on or off.

setUp

void setUp (ITestDevice device, 
                IBuildInfo buildInfo)

Perform the target setup for testing.

Parameters
device ITestDevice: the ITestDevice to prepare.
buildInfo IBuildInfo: data about the build under test.
Throws
TargetSetupError
DeviceNotAvailableException
BuildError