安装ApexModuleTargetPreparer

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


概括

领域

protected static final String APEX_OPTION

protected static final String APEX_SUFFIX

protected static final String APK_SUFFIX

protected static final String APK_ZIP_OPTION

protected static final String CHILD_SESSION_CREATION_CMD

protected static final String PARENT_SESSION_CREATION_CMD

protected static final String SPLIT_APKS_SUFFIX

protected File mTrainFolderPath

公共构造函数

InstallApexModuleTargetPreparer ()

公共方法

getModulesToInstall ( TestInformation testInfo)

根据设备上预加载的模块,获取应安装在列车上的模块。

void setIgnoreIfNotPreloaded (boolean skip)
void setSkipApexTearDown (boolean skip)
void setUp ( TestInformation testInfo)

void tearDown ( TestInformation testInfo, Throwable e)

受保护的方法

void addApksToTestFiles ()
void addStagedReadyTimeoutForAdb ( cmd) addStagedReadyTimeoutForAdb ( cmd)
void addTimeoutMillisForBundletool ( extraArgs) addTimeoutMillisForBundletool ( extraArgs)
void checkApexActivation ( ITestDevice device)

检查是否所有顶点均已激活。

collectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo) collectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo)

从 apex 模块收集 apex 信息以进行激活检查。

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

从 apex 包名称获取关键字(例如,com.android.tzdata.apex 的“tzdata”)。

getModulesFailToActivate ( activatedApexes) getModulesFailToActivate ( activatedApexes)

获取激活失败的模块。

getSplitsForApks ( TestInformation testInfo, File moduleFile)

提取并返回指定 apk 的拆分。

void initBundletoolUtil ( TestInformation testInfo)

初始化此类的bundletool util。

void installTrain ( TestInformation testInfo, moduleFilenames) installTrain ( TestInformation testInfo, moduleFilenames)

尝试在设备上安装包含 apex 的主线列车。

void installUsingBundleTool ( TestInformation testInfo, testAppFileNames) installUsingBundleTool ( TestInformation testInfo, testAppFileNames)

尝试使用bundletool安装主线模块。

void installer ( TestInformation testInfo, testAppFileNames) installer ( TestInformation testInfo, testAppFileNames)

尝试在设备上安装软件包或拆分软件包。

ITestDevice.ApexInfo retrieveApexInfo (File testApexFile, DeviceDescriptor deviceDescriptor)

从给定的 apex 文件中检索包含 packageName 和 versionCode 的 ApexInfo。

领域

APEX_选项

protected static final String APEX_OPTION

APEX_SUFFIX

protected static final String APEX_SUFFIX

APK_SUFFIX

protected static final String APK_SUFFIX

APK_ZIP_OPTION

protected static final String APK_ZIP_OPTION

CHILD_SESSION_CREATION_CMD

protected static final String CHILD_SESSION_CREATION_CMD

PARENT_SESSION_CREATION_CMD

protected static final String PARENT_SESSION_CREATION_CMD

SPLIT_APKS_SUFFIX

protected static final String SPLIT_APKS_SUFFIX

mTrainFolderPath

protected File mTrainFolderPath

公共构造函数

安装ApexModuleTargetPreparer

public InstallApexModuleTargetPreparer ()

公共方法

获取要安装的模块

public  getModulesToInstall (TestInformation testInfo)

根据设备上预加载的模块,获取应安装在列车上的模块。未预加载的模块将不会被安装。

参数
testInfo TestInformationTestInformation

退货
列表应安装在设备上的模块。

投掷
DeviceNotAvailableException当设备不可用时。
TargetSetupError当未安装强制模块或无法安装模块时。

设置忽略如果未预加载

public void setIgnoreIfNotPreloaded (boolean skip)

参数
skip boolean

设置SkipApexTearDown

public void setSkipApexTearDown (boolean skip)

参数
skip boolean

设置

public void setUp (TestInformation testInfo)

参数
testInfo TestInformation

投掷
BuildError
DeviceNotAvailableException
TargetSetupError

拆除

public void tearDown (TestInformation testInfo, 
                Throwable e)

参数
testInfo TestInformation

e Throwable

投掷
DeviceNotAvailableException

受保护的方法

添加 Apks 到测试文件

protected void addApksToTestFiles ()

addStgedReadyTimeoutForAdb

protected void addStagedReadyTimeoutForAdb ( cmd)

参数
cmd

addTimeoutMillisForBundle工具

protected void addTimeoutMillisForBundletool ( extraArgs)

参数
extraArgs

检查Apex激活

protected void checkApexActivation (ITestDevice device)

检查是否所有顶点均已激活。

参数
device ITestDevice :正在测试中。

投掷
TargetSetupError如果激活失败。
DeviceNotAvailableException

从 ApexModules 收集 ApexInfo

protected  collectApexInfoFromApexModules ( testAppFileNames, 
                TestInformation testInfo)

从 apex 模块收集 apex 信息以进行激活检查。

参数
testAppFileNames :要安装的模块的文件名列表

testInfo TestInformationTestInformation

退货
包含输入文件列表中 apex 模块的 apexinfo 的列表

投掷
TargetSetupError

获取已安装的Apk

protected  getApkInstalled ()

退货

获取Bundletool文件名

protected String getBundletoolFileName ()

退货
String

获取BundletoolUtil

protected BundletoolUtil getBundletoolUtil ()

退货
BundletoolUtil

从 ApexPackageName 获取模块关键字

protected String getModuleKeywordFromApexPackageName (String packageName)

从 apex 包名称获取关键字(例如,com.android.tzdata.apex 的“tzdata”)。

参数
packageName String : apex 文件的包名。

退货
String字符串 apex 包名称的关键字。

获取模块激活失败

protected  getModulesFailToActivate ( activatedApexes)

获取激活失败的模块。

参数
activatedApexes :设备上活动顶点的集合

退货
包含激活失败的输入 apex 模块的 apexinfo 的列表。

投掷
DeviceNotAvailableException
TargetSetupError

getSplitForApks

protected  getSplitsForApks (TestInformation testInfo, 
                File moduleFile)

提取并返回指定 apk 的拆分。

参数
testInfo TestInformationTestInformation

moduleFile File :从中提取拆分的模块文件。

退货
包含分割的 File[]。

投掷
TargetSetupError如果找不到bundletool或无法生成设备规格文件。

初始化BundletoolUtil

protected void initBundletoolUtil (TestInformation testInfo)

初始化此类的bundletool util。

参数
testInfo TestInformation :调用的TestInformation

投掷
TargetSetupError如果找不到bundletool。

安装火车

protected void installTrain (TestInformation testInfo, 
                 moduleFilenames)

尝试在设备上安装包含 apex 的主线列车。

参数
testInfo TestInformationTestInformation

moduleFilenames :字符串列表。要安装的主线模块的文件名列表。

投掷
DeviceNotAvailableException
TargetSetupError

安装使用Bundle工具

protected void installUsingBundleTool (TestInformation testInfo, 
                 testAppFileNames)

尝试使用bundletool安装主线模块。

参数
testInfo TestInformationTestInformation

testAppFileNames :要安装的预加载模块的文件名。

投掷
DeviceNotAvailableException
TargetSetupError

安装人员

protected void installer (TestInformation testInfo, 
                 testAppFileNames)

尝试在设备上安装软件包或拆分软件包。

参数
testInfo TestInformation :调用的TestInformation

testAppFileNames :要安装的apk及其包。

投掷
DeviceNotAvailableException
TargetSetupError

检索Apex信息

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

从给定的 apex 文件中检索包含 packageName 和 versionCode 的 ApexInfo。

参数
testApexFile File :我们从中检索信息的 apex 文件。

deviceDescriptor DeviceDescriptor

退货
ITestDevice.ApexInfo包含给定文件的 packageName 和 versionCode 的ApexInfo

投掷
TargetSetupError如果 aapt 解析器无法解析文件。