InstallApexModuleTargetPreparer

public class InstallApexModuleTargetPreparer
extends SuiteApkInstaller

java.lang.Object
   ↳ com.android.tradefed.targetprep.BaseTargetPreparer
     ↳ com.android.tradefed.targetprep.TestAppInstallSetup
       ↳ com.android.tradefed.targetprep.suite.SuiteApkInstaller
         ↳ com.android.tradefed.targetprep.InstallApexModuleTargetPreparer


Summary

Public constructors

InstallApexModuleTargetPreparer()

Public methods

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

getApkInstalled()
String getBundletoolFileName()
BundletoolUtil getBundletoolUtil()
String getModuleKeywordFromApexPackageName(String packageName)

Gets the keyword (e.g., 'tzdata' for com.android.tzdata.apex) from the apex package name.

void installMultiPackageContainingApex(ITestDevice device, IBuildInfo buildInfo, moduleFilenames)

Attempts to install a mainline train containing apex on the device.

void installUsingBundleTool(IBuildInfo buildInfo, ITestDevice device)

Attempts to install mainline module(s) using bundletool.

void installer(ITestDevice device, IBuildInfo buildInfo, appNames)

Attempt to install an package or split package on the device.

ITestDevice.ApexInfo retrieveApexInfo(File testApexFile, DeviceDescriptor deviceDescriptor)

Retrieves ApexInfo which contains packageName and versionCode from the given apex file.

Public constructors

InstallApexModuleTargetPreparer

public InstallApexModuleTargetPreparer ()

Public methods

setUp

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
DeviceNotAvailableException
TargetSetupError

tearDown

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

getApkInstalled

protected  getApkInstalled ()

Returns

getBundletoolFileName

protected String getBundletoolFileName ()

Returns
String

getBundletoolUtil

protected BundletoolUtil getBundletoolUtil ()

Returns
BundletoolUtil

getModuleKeywordFromApexPackageName

protected String getModuleKeywordFromApexPackageName (String packageName)

Gets the keyword (e.g., 'tzdata' for com.android.tzdata.apex) from the apex package name.

Parameters
packageName String: The package name of the apex file.

Returns
String a string The keyword of the apex package name.

installMultiPackageContainingApex

protected void installMultiPackageContainingApex (ITestDevice device, 
                IBuildInfo buildInfo, 
                 moduleFilenames)

Attempts to install a mainline train containing apex on the device.

Parameters
device ITestDevice: the ITestDevice to install the train

buildInfo IBuildInfo: build artifact information

moduleFilenames : List of String. The list of filenames of the mainline modules to be installed.

Throws
DeviceNotAvailableException
TargetSetupError

installUsingBundleTool

protected void installUsingBundleTool (IBuildInfo buildInfo, 
                ITestDevice device)

Attempts to install mainline module(s) using bundletool.

Parameters
buildInfo IBuildInfo: build artifact information

device ITestDevice: the ITestDevice to install the train

Throws
DeviceNotAvailableException
TargetSetupError

installer

protected void installer (ITestDevice device, 
                IBuildInfo buildInfo, 
                 appNames)

Attempt to install an package or split package on the device.

Parameters
device ITestDevice: the ITestDevice to install package

buildInfo IBuildInfo: build artifact information

appNames : List of String. The application file base names to be installed. If apkNames contains only one apk name, the apk will be installed as single package. If apkNames contains more than one name, the apks will be installed as split apks.

Throws
DeviceNotAvailableException
TargetSetupError

retrieveApexInfo

protected ITestDevice.ApexInfo retrieveApexInfo (File testApexFile, 
                DeviceDescriptor deviceDescriptor)

Retrieves ApexInfo which contains packageName and versionCode from the given apex file.

Parameters
testApexFile File: The apex file we retrieve information from.

deviceDescriptor DeviceDescriptor

Returns
ITestDevice.ApexInfo an ApexInfo containing the packageName and versionCode of the given file

Throws
TargetSetupError if aapt parser failed to parse the file.