ApkChangeDetector

public class ApkChangeDetector
extends Object

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


This class detects whether the APKs to be installed are different from those on the device, in order to decide whether to skip app installation and uninstallation during ERROR(/TestAppInstallSetup)'s setUp and tearDown.

Summary

Public constructors

ApkChangeDetector()

Public methods

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

Handle package cleanup process.

boolean handleTestAppsPreinstall(String packageName, testApps, ITestDevice device)

Handle app pre-install process.

Public constructors

ApkChangeDetector

public ApkChangeDetector ()

Public methods

handlePackageCleanup

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

Handle package cleanup process.

Parameters
packageName String: the name of package to be cleaned up.

device ITestDevice: Indicates the device on which the test is running.

userId Integer: The current user ID.

forAllUsers boolean: Indicates whether the cleanup should be done for all users.

Returns
boolean Whether the cleanup of an indicated package is done. Default to false, which indicates that the cleanup is not done.

Throws
DeviceNotAvailableException

handleTestAppsPreinstall

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

Handle app pre-install process.

Parameters
packageName String: The name of the package.

testApps : Indicate all APK files in the package with the name ERROR(/packageName).

device ITestDevice: Indicates the device on which the test is running.

Returns
boolean Whether the APKs in ERROR(/packageName) are fully handled under local incremental setup. Default to false, which does not oblige to re-install the package APKs.

Throws
DeviceNotAvailableException