為配合主幹穩定開發模型,並確保生態系統的平台穩定性,我們將於 2026 年起,在第 2 季和第 4 季將原始碼發布至 AOSP。如要建構及貢獻 AOSP,建議使用 android-latest-release,而非 aosp-main。android-latest-release 資訊清單分支版本一律會參照推送至 AOSP 的最新版本。詳情請參閱「Android 開放原始碼計畫變更」一文。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
ModulePusher
public
class
ModulePusher
extends Object
| java.lang.Object
|
| ↳ |
com.android.tradefed.targetprep.ModulePusher
|
摘要
公用方法 |
void
|
installModules(ImmutableMultimap<String, File> moduleFiles, boolean factoryReset, boolean disablePackageCache)
透過 adb push 將 moduleFiles 安裝到裝置。
|
常數
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 |
受保護的方法
checkApexActivated
protected void checkApexActivated (ITestDevice device,
modules)
確認所有 Apex 是否都已啟用。
| 參數 |
device |
ITestDevice:受測。 |
modules |
|
getApexPathUnderSystem
protected Path getApexPathUnderSystem (ITestDevice device,
String packageName)
| 參數 |
device |
ITestDevice |
packageName |
String |
getModulesFailToActivate
protected getModulesFailToActivate ( toInstall,
activatedApexes)
取得無法啟用的模組。
| 參數 |
toInstall |
|
activatedApexes |
:裝置上的一組有效頂點 |
| 傳回 |
|
包含無法啟動的輸入 Apex 模組 apexinfo 的清單。 |
getPathsOnDevice
protected String[] getPathsOnDevice (ITestDevice device,
String packageName)
取得裝置上套件安裝檔案的路徑。
| 參數 |
device |
ITestDevice:測試中 |
packageName |
String:模組 |
getPreloadPaths
protected Path[] getPreloadPaths (ITestDevice device,
File[] moduleFiles,
String packageName,
int apiLevel)
取得裝置上預先載入套件的路徑。
如果是分割套件,請傳回套件目錄的路徑,然後是檔案的路徑。因此,在此情況下,傳回的大小一律 > 1。如果是未分割的套件,只要傳回預先載入安裝檔案的路徑即可。
| 參數 |
device |
ITestDevice:測試中 |
moduleFiles |
File:要安裝的本機模組檔案 |
packageName |
String:模組 |
apiLevel |
int:裝置 |
parsePackageVersionCodes
protected ImmutableMap<String, String> parsePackageVersionCodes (String output)
將「package:{key} versionCode:{value}」行剖析為對應。
| 傳回 |
ImmutableMap<String, String> |
|
setupDevice
protected void setupDevice (ITestDevice device)
先執行 adb root 並重新掛接裝置,再將檔案推送至 /system
waitForDeviceToBeResponsive
protected void waitForDeviceToBeResponsive (long waitTime)
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-12-04 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-12-04 (世界標準時間)。"],[],[]]