模組推送器

public class ModulePusher
extends Object

java.lang.Object
com.android.tradefed.targetprep.ModulePusher


概括

嵌套類

class ModulePusher.ModulePushError

主線模組推送期間發生致命錯誤。

領域

public static final String LINE_BREAK

公共構造函數

ModulePusher ( ITestDevice device, long waitTimeMs, long delayWaitingTimeMs)

公共方法

void installModules (ImmutableMultimap<String, File> moduleFiles, boolean factoryReset, boolean disablePackageCache)

透過 adb push 將moduleFiles安裝到設備。

受保護的方法

void checkApexActivated ( ITestDevice device, modules) checkApexActivated ( ITestDevice device, modules)

檢查是否所有頂點均已啟動。

Path getApexPathUnderSystem ( ITestDevice device, String packageName)
getModulesFailToActivate ( toInstall, activatedApexes) getModulesFailToActivate ( toInstall, activatedApexes) getModulesFailToActivate ( toInstall, activatedApexes)

取得啟動失敗的模組。

String[] getPathsOnDevice ( ITestDevice device, String packageName)

取得該套件的安裝檔案在裝置上的路徑。

Path[] getPreloadPaths ( ITestDevice device, File[] moduleFiles, String packageName, int apiLevel)

取得預先載入包在設備上的路徑。

ImmutableMap<String, String> parsePackageVersionCodes (String output)

將“package:{key} versionCode:{value}”行解析為映射。

void setupDevice ( ITestDevice device)

在 /system 下推送文件之前 adb root 並重新掛載設備

void waitForDeviceToBeResponsive (long waitTime)

領域

越線

public static final String LINE_BREAK

公共構造函數

模組推送器

public ModulePusher (ITestDevice device, 
                long waitTimeMs, 
                long delayWaitingTimeMs)

參數
device ITestDevice

waitTimeMs long

delayWaitingTimeMs long

公共方法

安裝模組

public void installModules (ImmutableMultimap<String, File> moduleFiles, 
                boolean factoryReset, 
                boolean disablePackageCache)

透過 adb push 將moduleFiles安裝到設備。

參數
moduleFiles ImmutableMultimap :從套件名稱到套件檔案的多重對應。在拆分情況下,基礎包應該是迭代順序中的第一個包。

factoryReset boolean :是否透過恢復原廠設定重新載入。

disablePackageCache boolean

投擲
DeviceNotAvailableException
ModulePusher.ModulePushError
TargetSetupError

受保護的方法

檢查Apex激活

protected void checkApexActivated (ITestDevice device, 
                 modules)

檢查是否所有頂點均已啟動。

參數
device ITestDevice :正在測試中。

modules

投擲
ModulePusher.ModulePushError如果啟動失敗。
DeviceNotAvailableException

取得系統下的ApexPath

protected Path getApexPathUnderSystem (ITestDevice device, 
                String packageName)

參數
device ITestDevice

packageName String

退貨
Path

投擲
DeviceNotAvailableException
ModulePusher.ModulePushError

獲取模組啟動失敗

protected  getModulesFailToActivate ( toInstall, 
                 activatedApexes)

取得啟動失敗的模組。

參數
toInstall

activatedApexes :設備上活動頂點的集合

退貨
包含啟動失敗的輸入 apex 模組的 apexinfo 的清單。

取得設備上的路徑

protected String[] getPathsOnDevice (ITestDevice device, 
                String packageName)

取得該套件的安裝檔案在裝置上的路徑。

參數
device ITestDevice :正在測試中

packageName String :模組的

退貨
String[]包中所有檔案的路徑

投擲
DeviceNotAvailableException如果設備不可用
ModulePusher.ModulePushError

取得預先載入路徑

protected Path[] getPreloadPaths (ITestDevice device, 
                File[] moduleFiles, 
                String packageName, 
                int apiLevel)

取得預先載入包在設備上的路徑。

對於拆分包,返回包目錄的路徑,後面跟著檔案路徑。因此,在這種情況下,傳回的大小始終 > 1。對於非拆分包,只需返回預先載入安裝檔案的路徑即可。

參數
device ITestDevice :正在測試中

moduleFiles File :要安裝的本機模組文件

packageName String :模組的

apiLevel int : 設備的

退貨
Path[]預先載入檔案的路徑。

投擲
DeviceNotAvailableException
ModulePusher.ModulePushError

解析包版本程式碼

protected ImmutableMap<String, String> parsePackageVersionCodes (String output)

將“package:{key} versionCode:{value}”行解析為映射。

參數
output String

退貨
ImmutableMap<String, String>

設定設備

protected void setupDevice (ITestDevice device)

在 /system 下推送文件之前 adb root 並重新掛載設備

參數
device ITestDevice

投擲
ModulePusher.ModulePushError如果設備無法重新安裝。
DeviceNotAvailableException如果設備不可用。

等待設備回應

protected void waitForDeviceToBeResponsive (long waitTime)

參數
waitTime long