安装ApexModuleTargetPreparer
public class InstallApexModuleTargetPreparer
extends SuiteApkInstaller
概括
受保护的方法 |
---|
void | addApksToTestFiles () |
| collectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo) collectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo) 从 apex 模块收集 apex 信息以进行激活检查。 |
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 util。 |
void | installTrain (TestInformation testInfo, moduleFilenames, String[] extraArgs) installTrain (TestInformation testInfo, moduleFilenames, String[] extraArgs) 尝试在设备上安装包含 apex 的主线列车。 |
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 | 当未安装强制模块或无法安装模块时。 |
设置忽略如果未预加载
public void setIgnoreIfNotPreloaded (boolean skip)
设置SkipApexTearDown
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 | |
受保护的方法
添加 Apks 到测试文件
protected void addApksToTestFiles ()
protected collectApexInfoFromApexModules ( testAppFileNames,
TestInformation testInfo)
从 apex 模块收集 apex 信息以进行激活检查。
退货 |
---|
| 包含输入文件列表中 apex 模块的 apexinfo 的列表 |
protected boolean containsPersistentApk ( testAppFileNames,
TestInformation testInfo)
检查输入文件是否包含任何持久性 apk。
退货 |
---|
boolean | 如果输入文件包含持久 apk 模块,则为true 。 |
投掷 |
---|
DeviceNotAvailableException | |
TargetSetupError | |
获取已安装的Apk
protected getApkInstalled ()
protected String getBundletoolFileName ()
从 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 | |
protected getSplitsForApks (TestInformation testInfo,
File moduleFile)
提取并返回指定 apk 的拆分。
投掷 |
---|
TargetSetupError | 如果找不到bundletool或无法生成设备规格文件。 |
protected void initBundletoolUtil (TestInformation testInfo)
初始化此类的bundletool util。
投掷 |
---|
TargetSetupError | 如果找不到bundletool。 |
protected void installTrain (TestInformation testInfo,
moduleFilenames,
String[] extraArgs)
尝试在设备上安装包含 apex 的主线列车。
参数 |
---|
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 | |
检索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 解析器无法解析文件。 |