安装ApexModuleTargetPreparer
public class InstallApexModuleTargetPreparer
extends SuiteApkInstaller
概括
受保护的方法 |
---|
void | addApksToTestFiles () |
| collectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo) collectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo) 从顶点模块收集顶点信息以进行激活检查。 |
boolean | containsPersistentApk ( testAppFileNames, TestInformation testInfo) containsPersistentApk ( testAppFileNames, TestInformation testInfo) 检查输入文件是否包含任何持久的 apk。 |
| 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, String[] extraArgs) installTrain (TestInformation testInfo, moduleFilenames, String[] extraArgs) 尝试在设备上安装包含顶点的主线列车。 |
void | installUsingBundleTool (TestInformation testInfo, testAppFileNames) installUsingBundleTool (TestInformation testInfo, testAppFileNames) 尝试使用 bundletool 安装主线模块。 |
void | installer (TestInformation testInfo, testAppFileNames) installer (TestInformation testInfo, testAppFileNames) 尝试在设备上安装包或拆分包。 |
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
公共构造函数
安装ApexModuleTargetPreparer
public InstallApexModuleTargetPreparer ()
公共方法
public getModulesToInstall (TestInformation testInfo)
根据设备上预装的模块,获取应该安装在火车上的模块。不会安装未预加载的模块。
投掷 |
---|
DeviceNotAvailableException | 当设备不可用时。 |
TargetSetupError | 未安装强制模块或无法安装模块时。 |
setIgnoreIfNotPreloaded
public void setIgnoreIfNotPreloaded (boolean skip)
setSkipApexTearDown
public void setSkipApexTearDown (boolean skip)
public void setUp (TestInformation testInfo)
参数 |
---|
testInfo | TestInformation |
投掷 |
---|
BuildError | |
DeviceNotAvailableException | |
TargetSetupError | |
public void tearDown (TestInformation testInfo,
Throwable e)
参数 |
---|
testInfo | TestInformation |
e | Throwable |
投掷 |
---|
DeviceNotAvailableException | |
受保护的方法
addApksToTestFiles
protected void addApksToTestFiles ()
protected collectApexInfoFromApexModules ( testAppFileNames,
TestInformation testInfo)
从顶点模块收集顶点信息以进行激活检查。
参数 |
---|
testAppFileNames | : 要安装的模块的文件名列表 |
testInfo | TestInformation :该TestInformation |
退货 |
---|
| 包含输入文件列表中 apex 模块的 apexinfo 的列表 |
protected boolean containsPersistentApk ( testAppFileNames,
TestInformation testInfo)
检查输入文件是否包含任何持久的 apk。
参数 |
---|
testAppFileNames | : 要安装的模块的文件名列表 |
testInfo | TestInformation :该TestInformation |
退货 |
---|
boolean | true 如果输入文件包含一个持久的apk模块。 |
投掷 |
---|
DeviceNotAvailableException | |
TargetSetupError | |
安装了安装包
protected getApkInstalled ()
protected String getBundletoolFileName ()
getModuleKeywordFromApexPackageName
protected String getModuleKeywordFromApexPackageName (String packageName)
从 apex 包名称中获取关键字(例如,com.android.tzdata.apex 的“tzdata”)。
参数 |
---|
packageName | String :心尖文件的包名。 |
退货 |
---|
String | a 字符串 apex 包名称的关键字。 |
getModulesFailToActivate
protected getModulesFailToActivate ( activatedApexes)
获取激活失败的模块。
参数 |
---|
activatedApexes | : 设备上的活动顶点集 |
投掷 |
---|
DeviceNotAvailableException | |
TargetSetupError | |
protected getSplitsForApks (TestInformation testInfo,
File moduleFile)
提取并返回指定 apk 的拆分。
投掷 |
---|
TargetSetupError | 如果找不到 bundletool 或无法生成设备规范文件。 |
protected void initBundletoolUtil (TestInformation testInfo)
为此类初始化 bundletool 实用程序。
投掷 |
---|
TargetSetupError | 如果找不到 bundletool。 |
protected void installTrain (TestInformation testInfo,
moduleFilenames,
String[] extraArgs)
尝试在设备上安装包含顶点的主线列车。
参数 |
---|
testInfo | TestInformation :在TestInformation |
moduleFilenames | : 字符串列表。要安装的主线模块的文件名列表。 |
extraArgs | String |
投掷 |
---|
DeviceNotAvailableException | |
TargetSetupError | |
protected void installUsingBundleTool (TestInformation testInfo,
testAppFileNames)
尝试使用 bundletool 安装主线模块。
参数 |
---|
testInfo | TestInformation :在TestInformation |
testAppFileNames | :要安装的预加载模块的文件名。 |
投掷 |
---|
DeviceNotAvailableException | |
TargetSetupError | |
protected void installer (TestInformation testInfo,
testAppFileNames)
尝试在设备上安装包或拆分包。
参数 |
---|
testInfo | TestInformation :在TestInformation 的调用 |
testAppFileNames | : 要安装的 apk 和它们的包。 |
投掷 |
---|
DeviceNotAvailableException | |
TargetSetupError | |
protected boolean isPersistentApk (File filename,
TestInformation testInfo)
检查 apk 是否是持久 apk。
退货 |
---|
boolean | true 如果这是一个持续的APK模块。 |
投掷 |
---|
DeviceNotAvailableException | |
TargetSetupError | |
检索ApexInfo
protected ITestDevice.ApexInfo retrieveApexInfo (File testApexFile,
DeviceDescriptor deviceDescriptor)
从给定的 apex 文件中检索包含 packageName 和 versionCode 的 ApexInfo。
参数 |
---|
testApexFile | File :我们检索信息的顶点文件。 |
deviceDescriptor | DeviceDescriptor |
退货 |
---|
ITestDevice.ApexInfo | 一个ApexInfo 包含给定文件的的packageName和的versionCode |
投掷 |
---|
TargetSetupError | 如果 aapt 解析器解析文件失败。 |