安裝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 解析器解析文件失敗。 |