安装 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 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 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 实用程序。

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

尝试在设备上安装包含顶点的主线序列。

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_OPTION 选项

protected static final String APEX_OPTION

APEX_SUFFIX

protected static final String APEX_SUFFIX

APK_SUFFIX

protected static final String APK_SUFFIX

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

mTrain文件夹路径

protected File mTrainFolderPath

公共构造函数

安装 ApexModuleTargetPreparer

public InstallApexModuleTargetPreparer ()

公共方法

getModulesToInstall

public  getModulesToInstall (TestInformation testInfo)

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

参数
testInfo TestInformationTestInformation

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

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

setIgnoreIfNotPreloaded

public void setIgnoreIfNotPreloaded (boolean skip)

参数
skip boolean

setSkipApexTearDown

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

受保护的方法

添加 ApksToTestFiles

protected void addApksToTestFiles ()

检查顶点激活

protected void checkApexActivation (ITestDevice device)

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

参数
device ITestDevice :正在测试中。

投掷
TargetSetupError如果激活失败。
DeviceNotAvailableException

从 ApexModules 收集 ApexInfo

protected  collectApexInfoFromApexModules ( testAppFileNames, 
                TestInformation testInfo)

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

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

testInfo TestInformationTestInformation

退货
包含输入文件列表中顶点模块的顶点信息的列表

投掷
TargetSetupError

getApkInstalled

protected  getApkInstalled ()

退货

getBundletoolFileName

protected String getBundletoolFileName ()

退货
String

getBundletoolUtil

protected BundletoolUtil getBundletoolUtil ()

退货
BundletoolUtil

getModuleKeywordFromApexPackageName

protected String getModuleKeywordFromApexPackageName (String packageName)

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

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

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

getModulesFailToActivate

protected  getModulesFailToActivate ( activatedApexes)

获取激活失败的模块。

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

退货
包含未能激活的输入顶点模块的顶点信息的列表。

投掷
DeviceNotAvailableException
TargetSetupError

getSplitsForApks

protected  getSplitsForApks (TestInformation testInfo, 
                File moduleFile)

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

参数
testInfo TestInformationTestInformation

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

退货
包含拆分的 File[]。

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

initBundletoolUtil

protected void initBundletoolUtil (TestInformation testInfo)

为此类初始化 bundletool 实用程序。

参数
testInfo TestInformation :调用的TestInformation

投掷
TargetSetupError如果找不到 bundletool。

安装火车

protected void installTrain (TestInformation testInfo, 
                 moduleFilenames)

尝试在设备上安装包含顶点的主线序列。

参数
testInfo TestInformationTestInformation

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

投掷
DeviceNotAvailableException
TargetSetupError

安装UsingBundleTool

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

检索顶点信息

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

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

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

deviceDescriptor DeviceDescriptor

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

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