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 push 将 |
受保护的方法 | |
|---|---|
void
|
checkApexActivated(ITestDevice device,
检查所有顶点是否已激活。 |
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
公共构造函数
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)
检查所有顶点是否已激活。
| 参数 | |
|---|---|
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)
在将文件推送到 /system 之前,请先 adb root 并重新挂载设备
| 参数 | |
|---|---|
device |
ITestDevice |
| 抛出 | |
|---|---|
ModulePusher.ModulePushError |
如果无法重新挂载设备。 |
DeviceNotAvailableException |
(如果设备不可用)。 |
waitForDeviceToBeResponsive
protected void waitForDeviceToBeResponsive (long waitTime)
| 参数 | |
|---|---|
waitTime |
long |