IDeviceFlasher

public interface IDeviceFlasher

com.android.tradefed.targetprep.IDeviceFlasher


Flashes a device image on a device.

Summary

Public methods

abstract void flash(ITestDevice device, IDeviceBuildInfo deviceBuild)

Flashes build on device.

default getAdditionalFileFilters()

Get filters for additional build artifacts.

abstract CommandStatus getSystemFlashingStatus()

Retrieve the command execution status for flashing primary system partitions.

abstract IDeviceFlasher.UserDataFlashOption getUserDataFlashOption()

Gets whether the user data image should be flashed, wiped, or retained

abstract void overrideDeviceOptions(ITestDevice device)

Override options for a device.

default void postFlashOperations(ITestDevice device, IDeviceBuildInfo deviceBuild)

All clean up operations & checks that must occur after actual flashing critical section.

default void preFlashOperations(ITestDevice device, IDeviceBuildInfo deviceBuild)

All setup operations & checks that must occur before actual flashing critical section.

abstract void setDataWipeSkipList( dataWipeSkipList)

Sets the list of paths under /data to avoid clearing when using ITestsZipInstaller

Note that the granularity of the skip list is direct children of /data.

abstract void setFlashingResourcesRetriever(IFlashingResourcesRetriever retriever)

Sets the mechanism by which the flasher can retrieve resource files for flashing.

abstract void setForceSystemFlash(boolean forceSystemFlash)

Sets if system should always be flashed even if running current build

default void setRamdiskPartition(String ramdiskPartition)

Sets ramdisk partition

default void setShouldFlashRamdisk(boolean shouldFlashRamdisk)

Sets if an additional ramdisk should be flashed after updating device via image zip

abstract void setUserDataFlashOption(IDeviceFlasher.UserDataFlashOption flashOption)

Toggles whether the user data image should be flashed, wiped, or retained

abstract void setWipeTimeout(long timeout)

Set the timeout for wiping the data.

default boolean shouldFlashRamdisk()

Checks if the flasher is set to have an additional ramdisk should be flashed after updating device via image zip

default boolean supportsFlashingInFastbootD()

Whether the device that implements the flasher can be flashed in fastbootd mode.

Public methods

flash

public abstract void flash (ITestDevice device, 
                IDeviceBuildInfo deviceBuild)

Flashes build on device.

Returns immediately after flashing is complete. Callers should wait for device to be online and available before proceeding with testing.

Parameters
device ITestDevice: the ITestDevice to flash

deviceBuild IDeviceBuildInfo: the IDeviceBuildInfo to flash

Throws
TargetSetupError if failed to flash build
DeviceNotAvailableException if device becomes unresponsive

getAdditionalFileFilters

public  getAdditionalFileFilters ()

Get filters for additional build artifacts.

Some flashers need certain build artifacts which are not among the default ones used. Such flashers should override this method, so every user of the flashing tools doesn't need to know about these files and provide command line options.

Note that this method is invoked on a temporary instance of the IDeviceFlasher, so no state beyond that provided in the default constructor should be relied upon.

Strings in the Set are interpreted as file patterns, and all files matching the pattern will be retrieved.

By default, this method returns an empty Set.

Returns

getSystemFlashingStatus

public abstract CommandStatus getSystemFlashingStatus ()

Retrieve the command execution status for flashing primary system partitions.

Note that if system partitions are not flashed (system already has the build to be flashed) the command status may be null

Returns
CommandStatus

getUserDataFlashOption

public abstract IDeviceFlasher.UserDataFlashOption getUserDataFlashOption ()

Gets whether the user data image should be flashed, wiped, or retained

Returns
IDeviceFlasher.UserDataFlashOption Whether the user data image should be flashed, wiped, or retained

overrideDeviceOptions

public abstract void overrideDeviceOptions (ITestDevice device)

Override options for a device. Used to override default option values if the defaults are not supported by a particular device.

postFlashOperations

public void postFlashOperations (ITestDevice device, 
                IDeviceBuildInfo deviceBuild)

All clean up operations & checks that must occur after actual flashing critical section. None of those operations will be included in the concurrency-controlled critical section.

Parameters
device ITestDevice: the ITestDevice to flash

deviceBuild IDeviceBuildInfo: the IDeviceBuildInfo to flash

Throws
TargetSetupError if any setup fails
DeviceNotAvailableException if device becomes unresponsive

preFlashOperations

public void preFlashOperations (ITestDevice device, 
                IDeviceBuildInfo deviceBuild)

All setup operations & checks that must occur before actual flashing critical section. None of those operations will be included in the concurrency-controlled critical section.

Parameters
device ITestDevice: the ITestDevice to flash

deviceBuild IDeviceBuildInfo: the IDeviceBuildInfo to flash

Throws
TargetSetupError if any setup fails
DeviceNotAvailableException if device becomes unresponsive

setDataWipeSkipList

public abstract void setDataWipeSkipList ( dataWipeSkipList)

Sets the list of paths under /data to avoid clearing when using ITestsZipInstaller

Note that the granularity of the skip list is direct children of /data.

Parameters
dataWipeSkipList

setFlashingResourcesRetriever

public abstract void setFlashingResourcesRetriever (IFlashingResourcesRetriever retriever)

Sets the mechanism by which the flasher can retrieve resource files for flashing.

Parameters
retriever IFlashingResourcesRetriever: the IFlashingResourcesRetriever to use

setForceSystemFlash

public abstract void setForceSystemFlash (boolean forceSystemFlash)

Sets if system should always be flashed even if running current build

setRamdiskPartition

public void setRamdiskPartition (String ramdiskPartition)

Sets ramdisk partition

setShouldFlashRamdisk

public void setShouldFlashRamdisk (boolean shouldFlashRamdisk)

Sets if an additional ramdisk should be flashed after updating device via image zip

setUserDataFlashOption

public abstract void setUserDataFlashOption (IDeviceFlasher.UserDataFlashOption flashOption)

Toggles whether the user data image should be flashed, wiped, or retained

setWipeTimeout

public abstract void setWipeTimeout (long timeout)

Set the timeout for wiping the data.

Parameters
timeout long

shouldFlashRamdisk

public boolean shouldFlashRamdisk ()

Checks if the flasher is set to have an additional ramdisk should be flashed after updating device via image zip

Returns
boolean

supportsFlashingInFastbootD

public boolean supportsFlashingInFastbootD ()

Whether the device that implements the flasher can be flashed in fastbootd mode.

Returns
boolean