ModulePusher

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 推送至裝置上安裝 moduleFiles

受保護的方法

void checkApexActivated(ITestDevice device, modules)

檢查是否已啟用所有頂點。

Path getApexPathUnderSystem(ITestDevice device, String packageName)
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)

欄位

LINE_BREAK

public static final String LINE_BREAK

公用建構函式

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 推送至裝置上安裝 moduleFiles

參數
moduleFiles ImmutableMultimap:從套件名稱到套件檔案的多重對應。在分割情況下,基本套件應為疊代順序中的第一個套件。

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

disablePackageCache boolean

擲回
DeviceNotAvailableException
ModulePusher.ModulePushError
TargetSetupError

受保護的方法

checkApexActivated

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 :裝置上有效的頂點集合

傳回
清單,其中包含無法啟動的輸入 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)

在 /system 下推送檔案前,先使用 ADB 取得裝置的 root 權限並重新掛載裝置

參數
device ITestDevice

擲回
ModulePusher.ModulePushError 如果裝置無法重新掛載。
DeviceNotAvailableException 找不到裝置時。

waitForDeviceToBeResponsive

protected void waitForDeviceToBeResponsive (long waitTime)

參數
waitTime long