模塊推送器
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 將 |
受保護的方法 | |
---|---|
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 |
受保護的方法
checkApex已激活
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
protectedgetModulesFailToActivate ( toInstall, activatedApexes)
獲取激活失敗的模塊。
參數 | |
---|---|
toInstall | |
activatedApexes |
退貨 | |
---|---|
包含未能激活的輸入頂點模塊的頂點信息的列表。 |
getPathsOnDevice
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)
獲取設備上預加載包的路徑。
對於拆分包,返回包目錄的路徑,後跟文件的路徑。因此,在這種情況下,return 的大小始終 > 1。對於非拆分包,只需返回預加載安裝文件的路徑。
參數 | |
---|---|
device | ITestDevice :正在測試中 |
moduleFiles | File :要安裝的本地模塊文件 |
packageName | String :模塊的 |
apiLevel | int : 設備的 |
退貨 | |
---|---|
Path[] | 預加載文件的路徑。 |
投擲 | |
---|---|
DeviceNotAvailableException | |
ModulePusher.ModulePushError |
parsePackageVersionCodes
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 | 如果設備不可用。 |
waitForDeviceToBeResponsive
protected void waitForDeviceToBeResponsive (long waitTime)
參數 | |
---|---|
waitTime | long |
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2022-11-07 (世界標準時間)。
[]
[]