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 模組收集 PEX 資訊以進行啟用檢查。 |
boolean
|
containsPersistentApk(
檢查輸入檔案是否包含任何永久性 APK。 |
|
getApkInstalled()
|
String
|
getBundletoolFileName()
|
BundletoolUtil
|
getBundletoolUtil()
|
String
|
getModuleKeywordFromApexPackageName(String packageName)
取得關鍵字 (例如「tzdata」com.android.tzdata.apex)。 |
|
getModulesFailToActivate(
取得無法啟用的模組。 |
|
getSplitsForApks(TestInformation testInfo, File moduleFile)
擷取並傳回指定 apk 的分割。 |
void
|
initBundletoolUtil(TestInformation testInfo)
針對這個類別初始化 bundletool 公用程式。 |
void
|
installTrain(TestInformation testInfo,
嘗試在裝置上安裝含有 pex 的主線列車。 |
void
|
installUsingBundleTool(TestInformation testInfo,
嘗試使用 bundletool 安裝主系列模組。 |
void
|
installer(TestInformation testInfo,
嘗試在裝置上安裝套件或分割套件。 |
boolean
|
isPersistentApk(File filename, TestInformation testInfo)
檢查 APK 是否為永久 APK。 |
ITestDevice.ApexInfo
|
retrieveApexInfo(File testApexFile, DeviceDescriptor deviceDescriptor)
擷取 ApexInfo,內容中包含指定 apex 檔案中的 packageName 和 versionCode。 |
欄位
APEX_後置字串
protected static final String APEX_SUFFIX
APK_後置字串
protected static final String APK_SUFFIX
SPLIT_APKS 後置字串
protected static final String SPLIT_APKS_SUFFIX
公用建構函式
InstallApexModuleTargetPreparer
public InstallApexModuleTargetPreparer ()
公用方法
getModulesToInstall
publicgetModulesToInstall (TestInformation testInfo)
根據裝置上預先載入的模組,取得應在訓練時安裝的模組 裝置。系統不會安裝未預先載入的模組。
參數 | |
---|---|
testInfo |
TestInformation :TestInformation |
傳回 | |
---|---|
|
清單 |
擲回 | |
---|---|
DeviceNotAvailableException |
並在你無法使用裝置時傳送 |
TargetSetupError |
如未安裝必要模組,或無法將模組 已安裝。 |
設定忽略 IfNot 預先載入
public void setIgnoreIfNotPreloaded (boolean skip)
參數 | |
---|---|
skip |
boolean |
設定 SkipApexTearDown
public void setSkipApexTearDown (boolean skip)
參數 | |
---|---|
skip |
boolean |
設定
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 ()
collectionApexInfoFromApexModules
protectedcollectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo)
從 Apex 模組收集 PEX 資訊以進行啟用檢查。
參數 | |
---|---|
testAppFileNames |
:待安裝模組的檔案名稱清單 |
testInfo |
TestInformation :TestInformation |
傳回 | |
---|---|
|
此清單含有輸入檔案清單中 Apex 模組的 apexinfo |
擲回 | |
---|---|
TargetSetupError |
包含 PersistentApk
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)。
參數 | |
---|---|
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 |
,或是無法產生裝置規格檔案。 |
initBundletoolUtil
protected void initBundletoolUtil (TestInformation testInfo)
針對這個類別初始化 bundletool 公用程式。
參數 | |
---|---|
testInfo |
TestInformation :叫用的 TestInformation 。 |
擲回 | |
---|---|
TargetSetupError |
。 |
安裝訓練
protected void installTrain (TestInformation testInfo,moduleFilenames, String[] extraArgs)
嘗試在裝置上安裝含有 pex 的主線列車。
參數 | |
---|---|
testInfo |
TestInformation :TestInformation |
moduleFilenames |
:字串清單。要發布的主系列模組檔案名稱清單
已安裝。
|
extraArgs |
String |
擲回 | |
---|---|
DeviceNotAvailableException |
|
TargetSetupError |
installUsingBundleTool
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 |
isPersistentApk
protected boolean isPersistentApk (File filename, TestInformation testInfo)
檢查 APK 是否為永久 APK。
參數 | |
---|---|
filename |
File :要檢查的 APK 模組檔案 |
testInfo |
TestInformation :TestInformation |
傳回 | |
---|---|
boolean |
如果這是永久 APK 模組,則為 true 。
|
擲回 | |
---|---|
DeviceNotAvailableException |
|
TargetSetupError |
擷取 ApexInfo
protected ITestDevice.ApexInfo retrieveApexInfo (File testApexFile, DeviceDescriptor deviceDescriptor)
擷取 ApexInfo,內容中包含指定 apex 檔案中的 packageName 和 versionCode。
參數 | |
---|---|
testApexFile |
File :我們擷取資訊的 Apex 檔案。 |
deviceDescriptor |
DeviceDescriptor |
傳回 | |
---|---|
ITestDevice.ApexInfo |
包含指定檔案的 packageName 和 versionCode 的 ApexInfo |
擲回 | |
---|---|
TargetSetupError |
表示 aapt 剖析器無法剖析檔案。 |