ModulePusher
public
class
ModulePusher
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.targetprep.ModulePusher |
摘要
巢狀類別 | |
|---|---|
class |
ModulePusher.ModulePushError
推送 Mainline 模組時發生嚴重錯誤。 |
常數 | |
|---|---|
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,
確認所有 Apex 是否都已啟用。 |
Path
|
getApexPathUnderSystem(ITestDevice device, String packageName)
|
|
getModulesFailToActivate(
取得無法啟用的模組。 |
String[]
|
getPathsOnDevice(ITestDevice device, String packageName)
取得裝置上套件安裝檔案的路徑。 |
Path[]
|
getPreloadPaths(ITestDevice device, File[] moduleFiles, String packageName, int apiLevel)
取得裝置上預先載入套件的路徑。 |
ImmutableMap<String, String>
|
parsePackageVersionCodes(String output)
Parses lines of "package:{key} versionCode:{value}" into a map. |
void
|
setupDevice(ITestDevice device)
在 /system 下推送檔案前,請先執行 adb root 並重新掛接裝置 |
void
|
waitForDeviceToBeResponsive(long waitTime)
|
常數
LINE_BREAK
public static final String LINE_BREAK
常數值: "\r?\n"
公用建構函式
ModulePusher
public ModulePusher (ITestDevice device, long waitTimeMs, long delayWaitingTimeMs)
| 參數 | |
|---|---|
device |
ITestDevice |
waitTimeMs |
long |
delayWaitingTimeMs |
long |
公用方法
installModules
public void installModules (ImmutableMultimap<String, File> moduleFiles,
boolean factoryReset,
boolean disablePackageCache)透過 adb push 將 moduleFiles 安裝到裝置。
| 參數 | |
|---|---|
moduleFiles |
ImmutableMultimap:從套件名稱到套件檔案的多重對應。如果是分割案例,疊代順序應以基本套件為先。 |
factoryReset |
boolean:如果透過恢復原廠設定重新載入。 |
disablePackageCache |
boolean |
| 擲回 | |
|---|---|
DeviceNotAvailableException |
|
ModulePusher.ModulePushError |
|
TargetSetupError |
|
受保護的方法
checkApexActivated
protected void checkApexActivated (ITestDevice device,modules)
確認所有 Apex 是否都已啟用。
| 參數 | |
|---|---|
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 |
:裝置上的一組有效頂點 |
| 傳回 | |
|---|---|
|
包含無法啟動的輸入 Apex 模組 apexinfo 的清單。 |
getPathsOnDevice
protected String[] getPathsOnDevice (ITestDevice device, String packageName)
取得裝置上套件安裝檔案的路徑。
| 參數 | |
|---|---|
device |
ITestDevice:測試中 |
packageName |
String:模組 |
| 傳回 | |
|---|---|
String[] |
套件中所有檔案的路徑 |
| 擲回 | |
|---|---|
DeviceNotAvailableException |
如果裝置無法使用 |
ModulePusher.ModulePushError |
|
getPreloadPaths
protected Path[] getPreloadPaths (ITestDevice device, File[] moduleFiles, String packageName, int apiLevel)
取得裝置上預先載入套件的路徑。
如果是分割套件,請傳回套件目錄的路徑,然後是檔案的路徑。因此,在此情況下,傳回的大小一律 > 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> |
|
setupDevice
protected void setupDevice (ITestDevice device)
先執行 adb root 並重新掛接裝置,再將檔案推送至 /system
| 參數 | |
|---|---|
device |
ITestDevice |
| 擲回 | |
|---|---|
ModulePusher.ModulePushError |
如果裝置無法重新掛接。 |
DeviceNotAvailableException |
如果裝置無法使用。 |
waitForDeviceToBeResponsive
protected void waitForDeviceToBeResponsive (long waitTime)
| 參數 | |
|---|---|
waitTime |
long |