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)
将“package:{key} versionCode:{value}”格式的行解析为映射。 |
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:从软件包名称到软件包文件的 multimap。在拆分的情况下,基本软件包应是迭代顺序中的第一个。 |
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 |
| 返回 | |
|---|---|
|
一个列表,其中包含未能成功激活的输入 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 |