安裝 ApexModuleTargetPreparer

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 CHILD_SESSION_CREATION_CMD

protected static final String PARENT_SESSION_CREATION_CMD

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 checkApexActivation ( ITestDevice device)

檢查是否所有頂點都已激活。

collectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo) collectApexInfoFromApexModules ( testAppFileNames, TestInformation testInfo)

從 apex 模塊收集 apex 信息以進行激活檢查。

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) installTrain ( TestInformation testInfo, moduleFilenames)

嘗試在設備上安裝包含頂點的主線序列。

void installUsingBundleTool ( TestInformation testInfo, testAppFileNames) installUsingBundleTool ( TestInformation testInfo, testAppFileNames)

嘗試使用 bundletool 安裝主線模塊。

void installer ( TestInformation testInfo, testAppFileNames) installer ( TestInformation testInfo, testAppFileNames)

嘗試在設備上安裝包或拆分包。

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

CHILD_SESSION_CREATION_CMD

protected static final String CHILD_SESSION_CREATION_CMD

PARENT_SESSION_CREATION_CMD

protected static final String PARENT_SESSION_CREATION_CMD

SPLIT_APKS_SUFFIX

protected static final String SPLIT_APKS_SUFFIX

mTrain文件夾路徑

protected File mTrainFolderPath

公共構造函數

安裝 ApexModuleTargetPreparer

public InstallApexModuleTargetPreparer ()

公共方法

getModulesToInstall

public  getModulesToInstall (TestInformation testInfo)

根據設備上預加載的模塊獲取應安裝在火車上的模塊。不會安裝未預加載的模塊。

參數
testInfo TestInformationTestInformation

退貨
列表應該安裝在設備上的模塊。

投擲
DeviceNotAvailableException當設備不可用時。
TargetSetupError當未安裝必需模塊或無法安裝模塊時。

setIgnoreIfNotPreloaded

public void setIgnoreIfNotPreloaded (boolean skip)

參數
skip boolean

setSkipApexTearDown

public void setSkipApexTearDown (boolean skip)

參數
skip boolean

設置

public void setUp (TestInformation testInfo)

參數
testInfo TestInformation

投擲
BuildError
DeviceNotAvailableException
TargetSetupError

拆除

public void tearDown (TestInformation testInfo, 
                Throwable e)

參數
testInfo TestInformation

e Throwable

投擲
DeviceNotAvailableException

受保護的方法

添加 ApksToTestFiles

protected void addApksToTestFiles ()

檢查頂點激活

protected void checkApexActivation (ITestDevice device)

檢查是否所有頂點都已激活。

參數
device ITestDevice :正在測試中。

投擲
TargetSetupError如果激活失敗。
DeviceNotAvailableException

從 ApexModules 收集 ApexInfo

protected  collectApexInfoFromApexModules ( testAppFileNames, 
                TestInformation testInfo)

從 apex 模塊收集 apex 信息以進行激活檢查。

參數
testAppFileNames :要安裝的模塊的文件名列表

testInfo TestInformationTestInformation

退貨
包含輸入文件列表中頂點模塊的頂點信息的列表

投擲
TargetSetupError

getApkInstalled

protected  getApkInstalled ()

退貨

getBundletoolFileName

protected String getBundletoolFileName ()

退貨
String

getBundletoolUtil

protected BundletoolUtil getBundletoolUtil ()

退貨
BundletoolUtil

getModuleKeywordFromApexPackageName

protected String getModuleKeywordFromApexPackageName (String packageName)

從 apex 包名稱中獲取關鍵字(例如,com.android.tzdata.apex 的“tzdata”)。

參數
packageName String : apex 文件的包名。

退貨
String字符串 apex 包名稱的關鍵字。

getModulesFailToActivate

protected  getModulesFailToActivate ( activatedApexes)

獲取激活失敗的模塊。

參數
activatedApexes :設備上的活動頂點集

退貨
包含未能激活的輸入頂點模塊的頂點信息的列表。

投擲
DeviceNotAvailableException
TargetSetupError

getSplitsForApks

protected  getSplitsForApks (TestInformation testInfo, 
                File moduleFile)

提取並返回指定 apk 的拆分。

參數
testInfo TestInformationTestInformation

moduleFile File :要從中提取拆分的模塊文件。

退貨
包含拆分的 File[]。

投擲
TargetSetupError如果找不到 bundletool 或設備規範文件無法生成。

initBundletoolUtil

protected void initBundletoolUtil (TestInformation testInfo)

為此類初始化 bundletool 實用程序。

參數
testInfo TestInformation :調用的TestInformation

投擲
TargetSetupError如果找不到 bundletool。

安裝火車

protected void installTrain (TestInformation testInfo, 
                 moduleFilenames)

嘗試在設備上安裝包含頂點的主線序列。

參數
testInfo TestInformationTestInformation

moduleFilenames : 字符串列表。要安裝的主線模塊的文件名列表。

投擲
DeviceNotAvailableException
TargetSetupError

安裝UsingBundleTool

protected void installUsingBundleTool (TestInformation testInfo, 
                 testAppFileNames)

嘗試使用 bundletool 安裝主線模塊。

參數
testInfo TestInformationTestInformation

testAppFileNames :要安裝的預加載模塊的文件名。

投擲
DeviceNotAvailableException
TargetSetupError

安裝程序

protected void installer (TestInformation testInfo, 
                 testAppFileNames)

嘗試在設備上安裝包或拆分包。

參數
testInfo TestInformation :調用的TestInformation

testAppFileNames :要安裝的 apk 及其包。

投擲
DeviceNotAvailableException
TargetSetupError

檢索頂點信息

protected ITestDevice.ApexInfo retrieveApexInfo (File testApexFile, 
                DeviceDescriptor deviceDescriptor)

從給定的 apex 文件中檢索包含 packageName 和 versionCode 的 ApexInfo。

參數
testApexFile File :我們從中檢索信息的頂點文件。

deviceDescriptor DeviceDescriptor

退貨
ITestDevice.ApexInfo包含給定文件的 packageName 和 versionCode ApexInfo

投擲
TargetSetupError如果 aapt 解析器無法解析文件。