to top
public class

SdkAvdPreparer

extends Object
implements ITargetPreparer ITargetCleaner
java.lang.Object
   ↳ com.android.tradefed.targetprep.SdkAvdPreparer
Known Direct Subclasses

Class Overview

A ITargetPreparer that will create an avd and launch an emulator

Summary

Public Constructors
SdkAvdPreparer()
Creates a SdkAvdPreparer.
Public Methods
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.
void tearDown(ITestDevice device, IBuildInfo buildInfo, Throwable e)
Perform the target cleanup/teardown after testing.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.tradefed.targetprep.ITargetPreparer
From interface com.android.tradefed.targetprep.ITargetCleaner

Public Constructors

public SdkAvdPreparer ()

Creates a SdkAvdPreparer.

Public Methods

public String createAvd (ISdkBuildInfo sdkBuildInfo)

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

Parameters
sdkBuildInfo the ISdkBuildInfo
Returns
  • the created AVD name
Throws
TargetSetupError if could not get targets
BuildError if failed to create the AVD

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 the ISdkBuildInfo
device the placeholder ITestDevice representing allocated emulator device
avd the avd to launch
Throws
DeviceNotAvailableException
TargetSetupError if could not get targets
BuildError if emulator fails to boot
DeviceNotAvailableException

public void setForceKvm (boolean forceKvm)

public void setGpu (boolean gpu)

Sets programmatically whether the gpu should be on or off.

public void setUp (ITestDevice device, IBuildInfo buildInfo)

Perform the target setup for testing.

Parameters
device the ITestDevice to prepare.
buildInfo data about the build under test.

public void tearDown (ITestDevice device, IBuildInfo buildInfo, Throwable e)

Perform the target cleanup/teardown after testing.

Parameters
device the ITestDevice to prepare.
buildInfo data about the build under test.
e if the invocation ended with an exception, this will be the exception that was caught at the Invocation level. Otherwise, will be null.