to top
public class

TestAppInstallSetup

extends Object
implements ITargetCleaner IAbiReceiver @OptionClass(alias = "tests-zip-app")
java.lang.Object
   ↳ com.android.tradefed.targetprep.TestAppInstallSetup
Known Direct Subclasses

Class Overview

A ITargetPreparer that installs one or more apps from a getTestsDir() folder onto device.

This preparer will look in alternate directories if the tests zip does not exist or does not contain the required apk. The search will go in order from the last alternative dir specified to the first.

Summary

Fields
private AltDirBehavior mAltDirBehavior @Option(name = "alt-dir-behavior", description = "The order of alternate directory to be used when searching for apks to install")
private List<File> mAltDirs @Option(name = "alt-dir", description = "Alternate directory to look for the apk if the apk is not in the tests zip file. For each alternate dir, will look in //, //data/app, //DATA/app, //DATA/app/apk_name/ and //DATA/priv-app/apk_name/. Can be repeated. Look for apks in last alt-dir first.")
private boolean mCleanup @Option(name = "cleanup-apks", description = "Whether apks installed should be uninstalled after test. Note that the preparer does not verify if the apks are successfully removed.")
private String mForceAbi @Option(name = "force-abi", description = "The abi to use, can be either 32 or 64.", importance = com.android.tradefed.config.Option.Importance.IF_UNSET)
private Collection<String> mInstallArgs @Option(name = "install-arg", description = "Additional arguments to be passed to install command, including leading dash, e.g. \"-d\"")
private Collection<String> mTestFileNames @Option(name = "test-file-name", description = "the name of a test zip file to install on device. Can be repeated.", importance = com.android.tradefed.config.Option.Importance.IF_UNSET)
Public Constructors
TestAppInstallSetup()
Public Methods
void addTestFileName(String fileName)
Adds a file to the list of apks to install
void setAbi(IAbi abi)
void setAltDir(File altDir)
Set an alternate directory.
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.
Protected Methods
File getLocalPathForFilename(IBuildInfo buildInfo, String apkFileName)
Resolve the actual apk path based on testing artifact information inside build info.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.tradefed.targetprep.ITargetCleaner
From interface com.android.tradefed.testtype.IAbiReceiver
From interface com.android.tradefed.targetprep.ITargetPreparer

Fields

private AltDirBehavior mAltDirBehavior

private List<File> mAltDirs

private boolean mCleanup

private String mForceAbi

private Collection<String> mInstallArgs

private Collection<String> mTestFileNames

Public Constructors

public TestAppInstallSetup ()

Public Methods

public void addTestFileName (String fileName)

Adds a file to the list of apks to install

public void setAbi (IAbi abi)

Parameters
abi IAbi

public void setAltDir (File altDir)

Set an alternate directory.

Parameters
altDir File

public 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

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

Perform the target cleanup/teardown after testing.

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

Protected Methods

protected File getLocalPathForFilename (IBuildInfo buildInfo, String apkFileName)

Resolve the actual apk path based on testing artifact information inside build info.

Parameters
buildInfo IBuildInfo: build artifact information
apkFileName String: filename of the apk to install
Returns
File a File representing the physical apk file on host or null if the file does not exist.
Throws
TargetSetupError