ModulePusher

public class ModulePusher
extends Object

java.lang.Object
   ↳ com.android.tradefed.targetprep.ModulePusher


Summary

Nested classes

class ModulePusher.ModulePushError

Fatal error during Mainline module push. 

Fields

public static final String LINE_BREAK

Public constructors

ModulePusher(ITestDevice device, long waitTimeMs, long delayWaitingTimeMs)

Public methods

void installModules(ImmutableMultimap<String, File> moduleFiles, boolean factoryReset, boolean disablePackageCache)

Installs moduleFiles to the device by adb push.

Protected methods

void checkApexActivated(ITestDevice device, modules)

Check if all apexes are activated.

Path getApexPathUnderSystem(ITestDevice device, String packageName)
getModulesFailToActivate( toInstall, activatedApexes)

Get modules that failed to be activated.

String[] getPathsOnDevice(ITestDevice device, String packageName)

Get the paths of the installation files of the package on the device.

Path[] getPreloadPaths(ITestDevice device, File[] moduleFiles, String packageName, int apiLevel)

Get the paths of the preload package on the device.

ImmutableMap<String, String> parsePackageVersionCodes(String output)

Parses lines of "package:{key} versionCode:{value}" into a map.

void setupDevice(ITestDevice device)

adb root and remount device before push files under /system

void waitForDeviceToBeResponsive(long waitTime)

Fields

LINE_BREAK

public static final String LINE_BREAK

Public constructors

ModulePusher

public ModulePusher (ITestDevice device, 
                long waitTimeMs, 
                long delayWaitingTimeMs)

Parameters
device ITestDevice

waitTimeMs long

delayWaitingTimeMs long

Public methods

installModules

public void installModules (ImmutableMultimap<String, File> moduleFiles, 
                boolean factoryReset, 
                boolean disablePackageCache)

Installs moduleFiles to the device by adb push.

Parameters
moduleFiles ImmutableMultimap: a multimap from package names to the package files. In split case, the base package should be the first in iteration order.

factoryReset boolean: if reload via factory reset.

disablePackageCache boolean

Throws
DeviceNotAvailableException
ModulePusher.ModulePushError
TargetSetupError

Protected methods

checkApexActivated

protected void checkApexActivated (ITestDevice device, 
                 modules)

Check if all apexes are activated.

Parameters
device ITestDevice: under test.

modules

Throws
ModulePusher.ModulePushError if activation failed.
DeviceNotAvailableException

getApexPathUnderSystem

protected Path getApexPathUnderSystem (ITestDevice device, 
                String packageName)

Parameters
device ITestDevice

packageName String

Returns
Path

Throws
DeviceNotAvailableException
ModulePusher.ModulePushError

getModulesFailToActivate

protected  getModulesFailToActivate ( toInstall, 
                 activatedApexes)

Get modules that failed to be activated.

Parameters
toInstall

activatedApexes : The set of the active apexes on device

Returns
a list containing the apexinfo of the input apex modules that failed to be activated.

getPathsOnDevice

protected String[] getPathsOnDevice (ITestDevice device, 
                String packageName)

Get the paths of the installation files of the package on the device.

Parameters
device ITestDevice: under test

packageName String: of the module

Returns
String[] paths of all files of the package

Throws
DeviceNotAvailableException if device is not available
ModulePusher.ModulePushError

getPreloadPaths

protected Path[] getPreloadPaths (ITestDevice device, 
                File[] moduleFiles, 
                String packageName, 
                int apiLevel)

Get the paths of the preload package on the device.

For split packages, return the path of the package dir followed by the paths of files. As a result, the size of return is always > 1 in this case. For non-split packages, simply return the path of the preload installation file.

Parameters
device ITestDevice: under test

moduleFiles File: local modules files to install

packageName String: of the module

apiLevel int: of the device

Returns
Path[] the paths of the preload files.

Throws
DeviceNotAvailableException
ModulePusher.ModulePushError

parsePackageVersionCodes

protected ImmutableMap<String, String> parsePackageVersionCodes (String output)

Parses lines of "package:{key} versionCode:{value}" into a map.

Parameters
output String

Returns
ImmutableMap<String, String>

setupDevice

protected void setupDevice (ITestDevice device)

adb root and remount device before push files under /system

Parameters
device ITestDevice

Throws
ModulePusher.ModulePushError if device cannot be remounted.
DeviceNotAvailableException if device unavailable.

waitForDeviceToBeResponsive

protected void waitForDeviceToBeResponsive (long waitTime)

Parameters
waitTime long