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_OPTION
|
protected
static
final
String |
APEX_SUFFIX
|
protected
static
final
String |
APK_SUFFIX
|
protected
static
final
String |
APK_ZIP_OPTION
|
protected
static
final
String |
CHILD_SESSION_CREATION_CMD
|
protected
static
final
String |
PARENT_SESSION_CREATION_CMD
|
public
static
final
String |
ROLLBACK_STATE_COMMITTED
|
public
static
final
String |
ROLLBACK_STATE_UNKNOWN
|
protected
static
final
String |
SPLIT_APKS_SUFFIX
|
protected
File |
mTrainFolderPath
|
公用建構函式 | |
---|---|
InstallApexModuleTargetPreparer()
|
公用方法 | |
---|---|
|
getModulesToInstall(TestInformation testInfo)
根據裝置上預先載入的模組,取得應在火車上安裝的模組。 |
void
|
setIgnoreIfNotPreloaded(boolean skip)
|
void
|
setSkipApexTearDown(boolean skip)
|
void
|
setUp(TestInformation testInfo)
|
void
|
tearDown(TestInformation testInfo, Throwable e)
|
受保護的方法 | |
---|---|
void
|
addApksToTestFiles()
|
void
|
addStagedReadyTimeoutForAdb(
|
void
|
addTimeoutMillisForBundletool(
|
void
|
checkApexActivation(ITestDevice device)
檢查是否已啟用所有頂點。 |
|
collectApexInfoFromApexModules(
從頂層模組收集頂層資訊,以便進行啟用檢查。 |
|
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,
嘗試在裝置上安裝含有 Apex 的主要程式群組。 |
void
|
installUsingBundleTool(TestInformation testInfo,
嘗試使用 bundletool 安裝主線程模組。 |
void
|
installer(TestInformation testInfo,
嘗試在裝置上安裝套件或分割套件。 |
ITestDevice.ApexInfo
|
retrieveApexInfo(File testApexFile, DeviceDescriptor deviceDescriptor)
從指定的 Apex 檔案中擷取含有 packageName 和 versionCode 的 ApexInfo。 |
欄位
APEX_OPTION
protected static final String APEX_OPTION
APEX_SUFFIX
protected static final String APEX_SUFFIX
APK_SUFFIX
protected static final String APK_SUFFIX
APK_ZIP_OPTION
protected static final String APK_ZIP_OPTION
CHILD_SESSION_CREATION_CMD
protected static final String CHILD_SESSION_CREATION_CMD
PARENT_SESSION_CREATION_CMD
protected static final String PARENT_SESSION_CREATION_CMD
ROLLBACK_STATE_COMMITTED
public static final String ROLLBACK_STATE_COMMITTED
ROLLBACK_STATE_UNKNOWN
public static final String ROLLBACK_STATE_UNKNOWN
SPLIT_APKS_SUFFIX
protected static final String SPLIT_APKS_SUFFIX
mTrainFolderPath
protected File mTrainFolderPath
公用建構函式
InstallApexModuleTargetPreparer
public InstallApexModuleTargetPreparer ()
公用方法
getModulesToInstall
publicgetModulesToInstall (TestInformation testInfo)
根據裝置上預先載入的模組,取得應在火車上安裝的模組。系統不會安裝未預先載入的模組。
參數 | |
---|---|
testInfo |
TestInformation :TestInformation |
傳回 | |
---|---|
|
應在裝置上安裝的模組清單 |
擲回 | |
---|---|
DeviceNotAvailableException |
裝置無法使用時。 |
TargetSetupError |
未安裝必要模組,或無法安裝模組。 |
setIgnoreIfNotPreloaded
public void setIgnoreIfNotPreloaded (boolean skip)
參數 | |
---|---|
skip |
boolean |
setSkipApexTearDown
public void setSkipApexTearDown (boolean skip)
參數 | |
---|---|
skip |
boolean |
setUp
public void setUp (TestInformation testInfo)
參數 | |
---|---|
testInfo |
TestInformation |
擲回 | |
---|---|
BuildError |
|
DeviceNotAvailableException |
|
TargetSetupError |
tearDown
public void tearDown (TestInformation testInfo, Throwable e)
參數 | |
---|---|
testInfo |
TestInformation |
e |
Throwable |
擲回 | |
---|---|
DeviceNotAvailableException |
|
DeviceRuntimeException |
受保護的方法
addApksToTestFiles
protected void addApksToTestFiles ()
addStagedReadyTimeoutForAdb
protected void addStagedReadyTimeoutForAdb (cmd)
參數 | |
---|---|
cmd |
|
addTimeoutMillisForBundletool
protected void addTimeoutMillisForBundletool (extraArgs)
參數 | |
---|---|
extraArgs |
|
checkApexActivation
protected void checkApexActivation (ITestDevice device)
檢查是否已啟用所有頂點。
參數 | |
---|---|
device |
ITestDevice :測試中。 |
擲回 | |
---|---|
TargetSetupError |
啟用失敗。 |
DeviceNotAvailableException |
collectApexInfoFromApexModules
protectedcollectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo)
從 Apex 模組收集 Apex 資訊,以便進行啟用檢查。
參數 | |
---|---|
testAppFileNames |
:要安裝的模組檔案名稱清單 |
testInfo |
TestInformation :TestInformation |
傳回 | |
---|---|
|
清單,其中包含輸入檔案清單中的 Apex 模組 ApexInfo |
擲回 | |
---|---|
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 |
如果找不到 bundletool 或無法產生裝置規格檔案。 |
initBundletoolUtil
protected void initBundletoolUtil (TestInformation testInfo)
為此類別初始化 bundletool 實用工具。
參數 | |
---|---|
testInfo |
TestInformation :叫用作業的 TestInformation 。 |
擲回 | |
---|---|
TargetSetupError |
找不到 bundletool。 |
installTrain
protected void installTrain (TestInformation testInfo,moduleFilenames)
嘗試在裝置上安裝含有 Apex 的主要列車。
參數 | |
---|---|
testInfo |
TestInformation :TestInformation |
moduleFilenames |
:字串清單。要安裝的主線程式模組檔案名稱清單。 |
擲回 | |
---|---|
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 |
retrieveApexInfo
protected ITestDevice.ApexInfo retrieveApexInfo (File testApexFile, DeviceDescriptor deviceDescriptor)
從指定的 Apex 檔案中擷取含有 packageName 和 versionCode 的 ApexInfo。
參數 | |
---|---|
testApexFile |
File :我們用來擷取資訊的頂層檔案。 |
deviceDescriptor |
DeviceDescriptor |
傳回 | |
---|---|
ITestDevice.ApexInfo |
包含指定檔案的 packageName 和 versionCode 的 ApexInfo |
擲回 | |
---|---|
TargetSetupError |
如果 aapt 剖析器無法剖析檔案。 |