安裝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 資訊以進行啟動檢查。
參數 |
---|
testAppFileNames | :要安裝的模組的檔案名稱列表 |
testInfo | TestInformation : TestInformation |
退貨 |
---|
| 包含輸入檔列表中 apex 模組的 apexinfo 的列表 |
protected boolean containsPersistentApk ( testAppFileNames,
TestInformation testInfo)
檢查輸入檔是否包含任何持久性 apk。
參數 |
---|
testAppFileNames | :要安裝的模組的檔案名稱列表 |
testInfo | TestInformation : TestInformation |
退貨 |
---|
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 檔案的套件名稱。 |
獲取模組啟動失敗
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 解析器無法解析檔案。 |