模塊推送器

public class ModulePusher
extends Object

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


概括

嵌套類

class ModulePusher.ModulePushError

Mainline 模塊推送期間出現致命錯誤。

字段

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)

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

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

受保護的方法

檢查ApexActivated

protected void checkApexActivated (ITestDevice device, 
                 modules)

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

參數
device ITestDevice :正在測試中。

modules

投擲
ModulePusher.ModulePushError如果激活失敗。
DeviceNotAvailableException

getApexPathUnderSystem

protected Path getApexPathUnderSystem (ITestDevice device, 
                String packageName)

參數
device ITestDevice

packageName String

退貨
Path

投擲
DeviceNotAvailableException
ModulePusher.ModulePushError

getModulesFailToActivate

protected  getModulesFailToActivate ( toInstall, 
                 activatedApexes)

獲取激活失敗的模塊。

參數
toInstall

activatedApexes :設備上的活動頂點集

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

獲取設備上的路徑

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)

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

參數
device ITestDevice

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

等待設備響應

protected void waitForDeviceToBeResponsive (long waitTime)

參數
waitTime long