ApkChangeDetector

public class ApkChangeDetector
extends Object

java.lang.Object
   ↳ com.android.tradefed.targetprep.incremental.ApkChangeDetector


此类用于检测要安装的 APK 是否与设备上的 APK 不同,以便决定是否在 ERROR(/TestAppInstallSetup) 的 setUp 和 tearDown 期间跳过应用安装和卸载。

摘要

公共构造函数

ApkChangeDetector()

公共方法

boolean handlePackageCleanup(String packageName, ITestDevice device, Integer userId, boolean forAllUsers)

处理软件包清理流程。

boolean handleTestAppsPreinstall(String packageName, testApps, ITestDevice device)

处理应用预安装流程。

公共构造函数

ApkChangeDetector

public ApkChangeDetector ()

公共方法

handlePackageCleanup

public boolean handlePackageCleanup (String packageName, 
                ITestDevice device, 
                Integer userId, 
                boolean forAllUsers)

处理软件包清理流程。

参数
packageName String:要清理的软件包的名称。

device ITestDevice:指示测试正在运行的设备。

userId Integer:当前用户 ID。

forAllUsers boolean:指示是否应为所有用户执行清理。

返回
boolean 是否已完成所指软件包的清理。默认为 false,表示尚未完成清理。

抛出
DeviceNotAvailableException

handleTestAppsPreinstall

public boolean handleTestAppsPreinstall (String packageName, 
                 testApps, 
                ITestDevice device)

处理应用预安装流程。

参数
packageName String:软件包的名称。

testApps :指明软件包中名称为 ERROR(/packageName) 的所有 APK 文件。

device ITestDevice:指示测试正在运行的设备。

返回
boolean 在本地增量配置下,ERROR(/packageName) 中的 APK 是否已完全处理。默认为 false,表示无需重新安装软件包 APK。

抛出
DeviceNotAvailableException