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_SUFFIX
|
protected
static
final
String |
APK_SUFFIX
|
protected
static
final
String |
SPLIT_APKS_SUFFIX
|
公共构造函数 | |
|---|---|
InstallApexModuleTargetPreparer()
|
|
公共方法 | |
|---|---|
|
getModulesToInstall(TestInformation testInfo)
根据设备上预加载的模块,获取应安装在模块序列中的模块。 |
void
|
setIgnoreIfNotPreloaded(boolean skip)
|
void
|
setSkipApexTearDown(boolean skip)
|
void
|
setUp(TestInformation testInfo)
|
void
|
tearDown(TestInformation testInfo, Throwable e)
|
受保护的方法 | |
|---|---|
void
|
addApksToTestFiles()
|
|
collectApexInfoFromApexModules(
从 apex 模块收集 apex 信息以进行激活检查。 |
boolean
|
containsPersistentApk(
检查输入文件是否包含任何永久性 apk。 |
|
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,
尝试在设备上安装软件包或分屏软件包。 |
boolean
|
isPersistentApk(File filename, TestInformation testInfo)
检查 apk 是否为永久性 apk。 |
ITestDevice.ApexInfo
|
retrieveApexInfo(File testApexFile, DeviceDescriptor deviceDescriptor)
从给定的 apex 文件中检索包含 packageName 和 versionCode 的 ApexInfo。 |
字段
APEX_SUFFIX
protected static final String APEX_SUFFIX
APK_SUFFIX
protected static final String APK_SUFFIX
SPLIT_APKS_SUFFIX
protected static final String SPLIT_APKS_SUFFIX
公共构造函数
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 |
|
受保护的方法
addApksToTestFiles
protected void addApksToTestFiles ()
collectApexInfoFromApexModules
protectedcollectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo)
从 apex 模块收集 apex 信息以进行激活检查。
| 参数 | |
|---|---|
testAppFileNames |
:要安装的模块的文件名列表 |
testInfo |
TestInformation:TestInformation |
| 返回 | |
|---|---|
|
包含输入文件列表中 apex 模块的 apexinfo 的列表 |
| 抛出 | |
|---|---|
TargetSetupError |
|
containsPersistentApk
protected boolean containsPersistentApk (testAppFileNames, TestInformation testInfo)
检查输入文件是否包含任何永久性 apk。
| 参数 | |
|---|---|
testAppFileNames |
:要安装的模块的文件名列表 |
testInfo |
TestInformation:TestInformation |
| 返回 | |
|---|---|
boolean |
如果输入文件包含永久性 APK 模块,则为 true。 |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
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,
String[] extraArgs) 尝试在设备上安装包含 apex 的 Mainline 模块序列。
| 参数 | |
|---|---|
testInfo |
TestInformation:TestInformation |
moduleFilenames |
:字符串列表。要安装的 Mainline 模块的文件名列表。 |
extraArgs |
String |
| 抛出 | |
|---|---|
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 |
|
isPersistentApk
protected boolean isPersistentApk (File filename,
TestInformation testInfo)检查 apk 是否为永久性 apk。
| 参数 | |
|---|---|
filename |
File:要检查的 apk 模块文件 |
testInfo |
TestInformation:TestInformation |
| 返回 | |
|---|---|
boolean |
如果这是永久性 APK 模块,则为 true。 |
| 抛出 | |
|---|---|
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 解析器未能解析文件。 |