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 | |||
摘要
字段 | |
|---|---|
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
|
public
static
final
String |
ROLLBACK_STATE_COMMITTED
|
public
static
final
String |
ROLLBACK_STATE_UNKNOWN
|
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(
|
void
|
addTimeoutMillisForBundletool(
|
void
|
checkApexActivation(ITestDevice device)
检查所有顶点是否已激活。 |
|
collectApexInfoFromApexModules(
从 apex 模块收集 apex 信息以进行激活检查。 |
|
getApkInstalled()
|
String
|
getBundletoolFileName()
|
BundletoolUtil
|
getBundletoolUtil()
|
String
|
getModuleKeywordFromApexPackageName(String packageName)
获取关键字(例如从 apex 软件包名称中提取相应软件包的名称(例如,对于 com.android.tzdata.apex,则为“tzdata”)。 |
|
getModulesFailToActivate(
获取未能激活的模块。 |
|
getSplitsForApks(TestInformation testInfo, File moduleFile)
提取并返回指定 apk 的分块。 |
void
|
initBundletoolUtil(TestInformation testInfo)
为此类初始化 bundletool 实用程序。 |
void
|
installTrain(TestInformation testInfo,
尝试在设备上安装包含 apex 的 Mainline 模块序列。 |
void
|
installUsingBundleTool(TestInformation testInfo,
尝试使用 bundletool 安装 Mainline 模块。 |
void
|
installer(TestInformation testInfo,
尝试在设备上安装软件包或分屏软件包。 |
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
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
ROLLBACK_STATE_COMMITTED
public static final String ROLLBACK_STATE_COMMITTED
ROLLBACK_STATE_UNKNOWN
public static final String ROLLBACK_STATE_UNKNOWN
SPLIT_APKS_SUFFIX
protected static final String SPLIT_APKS_SUFFIX
mTrainFolderPath
protected File mTrainFolderPath
公共构造函数
InstallApexModuleTargetPreparer
public InstallApexModuleTargetPreparer ()
公共方法
getModulesToInstall
publicgetModulesToInstall (TestInformation testInfo)
根据设备上预加载的模块,获取应安装在模块序列中的模块。系统不会安装未预加载的模块。
| 参数 | |
|---|---|
testInfo |
TestInformation:TestInformation |
| 返回 | |
|---|---|
|
应安装在设备上的模块的列表。 |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
设备不可用时。 |
TargetSetupError |
未安装强制性模块或无法安装模块。 |
setIgnoreIfNotPreloaded
public void setIgnoreIfNotPreloaded (boolean skip)
| 参数 | |
|---|---|
skip |
boolean |
setSkipApexTearDown
public void setSkipApexTearDown (boolean skip)
| 参数 | |
|---|---|
skip |
boolean |
setUp
public void setUp (TestInformation testInfo)
| 参数 | |
|---|---|
testInfo |
TestInformation |
| 抛出 | |
|---|---|
BuildError |
|
DeviceNotAvailableException |
|
TargetSetupError |
|
tearDown
public void tearDown (TestInformation testInfo, Throwable e)
| 参数 | |
|---|---|
testInfo |
TestInformation |
e |
Throwable |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
DeviceRuntimeException |
|
受保护的方法
addApksToTestFiles
protected void addApksToTestFiles ()
addStagedReadyTimeoutForAdb
protected void addStagedReadyTimeoutForAdb (cmd)
| 参数 | |
|---|---|
cmd |
|
addTimeoutMillisForBundletool
protected void addTimeoutMillisForBundletool (extraArgs)
| 参数 | |
|---|---|
extraArgs |
|
checkApexActivation
protected void checkApexActivation (ITestDevice device)
检查所有顶点是否已激活。
| 参数 | |
|---|---|
device |
ITestDevice:正在测试中。 |
| 抛出 | |
|---|---|
TargetSetupError |
激活失败。 |
DeviceNotAvailableException |
|
collectApexInfoFromApexModules
protectedcollectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo)
从 apex 模块收集 apex 信息以进行激活检查。
| 参数 | |
|---|---|
testAppFileNames |
:要安装的模块的文件名列表 |
testInfo |
TestInformation:TestInformation |
| 返回 | |
|---|---|
|
包含输入文件列表中 apex 模块的 apexinfo 的列表 |
| 抛出 | |
|---|---|
TargetSetupError |
|
getApkInstalled
protectedgetApkInstalled ()
| 返回 | |
|---|---|
|
|
getBundletoolFileName
protected String getBundletoolFileName ()
| 返回 | |
|---|---|
String |
|
getModuleKeywordFromApexPackageName
protected String getModuleKeywordFromApexPackageName (String packageName)
获取关键字(例如'tzdata' 为 com.android.tzdata.apex)从 apex 软件包名称中提取。
| 参数 | |
|---|---|
packageName |
String:Apex 文件的软件包名称。 |
| 返回 | |
|---|---|
String |
一个字符串。Apex 软件包名称的关键字。 |
getModulesFailToActivate
protectedgetModulesFailToActivate ( activatedApexes)
获取未能激活的模块。
| 参数 | |
|---|---|
activatedApexes |
:设备上的一组活跃顶点 |
| 返回 | |
|---|---|
|
包含未能激活的输入 apex 模块的 apexinfo 的列表。 |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
TargetSetupError |
|
getSplitsForApks
protectedgetSplitsForApks (TestInformation testInfo, File moduleFile)
提取并返回指定 apk 的分块。
| 参数 | |
|---|---|
testInfo |
TestInformation:TestInformation |
moduleFile |
File:要从中提取分块的模块文件。 |
| 返回 | |
|---|---|
|
包含分块的 File[]。 |
| 抛出 | |
|---|---|
TargetSetupError |
如果找不到 bundletool 或设备规范文件未能生成。 |
initBundletoolUtil
protected void initBundletoolUtil (TestInformation testInfo)
为此类初始化 bundletool 实用程序。
| 参数 | |
|---|---|
testInfo |
TestInformation:调用的 TestInformation。 |
| 抛出 | |
|---|---|
TargetSetupError |
如果找不到 bundletool。 |
installTrain
protected void installTrain (TestInformation testInfo,moduleFilenames)
尝试在设备上安装包含 apex 的 Mainline 模块序列。
| 参数 | |
|---|---|
testInfo |
TestInformation:TestInformation |
moduleFilenames |
:字符串列表。要安装的 Mainline 模块的文件名列表。 |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
TargetSetupError |
|
installUsingBundleTool
protected void installUsingBundleTool (TestInformation testInfo,testAppFileNames)
尝试使用 bundletool 安装 Mainline 模块。
| 参数 | |
|---|---|
testInfo |
TestInformation:TestInformation |
testAppFileNames |
:要安装的预加载模块的文件名。 |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
TargetSetupError |
|
安装者
protected void installer (TestInformation testInfo,testAppFileNames)
尝试在设备上安装软件包或分屏软件包。
| 参数 | |
|---|---|
testInfo |
TestInformation:调用的 TestInformation |
testAppFileNames |
:要安装的 apk 及其软件包。 |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
TargetSetupError |
|
retrieveApexInfo
protected ITestDevice.ApexInfo retrieveApexInfo (File testApexFile, DeviceDescriptor deviceDescriptor)
从给定的 apex 文件中检索包含 packageName 和 versionCode 的 ApexInfo。
| 参数 | |
|---|---|
testApexFile |
File:我们从中检索信息的 apex 文件。 |
deviceDescriptor |
DeviceDescriptor |
| 返回 | |
|---|---|
ITestDevice.ApexInfo |
包含给定文件的 packageName 和 versionCode 的 ApexInfo |
| 抛出 | |
|---|---|
TargetSetupError |
如果 aapt 解析器未能解析文件。 |