FlashingResourcesParser

public class FlashingResourcesParser
extends Object implements IFlashingResourcesParser

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


A class that parses out required versions of auxiliary image files needed to flash a device. (e.g. bootloader, baseband, etc)

Summary

Nested classes

class FlashingResourcesParser.AndroidInfo

A typedef for Map<String, MultiMap<String, String>>

interface FlashingResourcesParser.Constraint

A filtering interface, intended to allow FlashingResourcesParser to ignore some resources that it otherwise might use  

Constants

String BASEBAND_VERSION_KEY

String BOARD_KEY

String BOOTLOADER_VERSION_KEY

String PRODUCT_KEY

Public constructors

FlashingResourcesParser(File deviceImgZipFile, Map<String, FlashingResourcesParser.Constraint> c)

Create a FlashingResourcesParser and have it parse the specified device image for flashing requirements.

FlashingResourcesParser(File deviceImgZipFile)

Create a FlashingResourcesParser and have it parse the specified device image for flashing requirements.

FlashingResourcesParser(BufferedReader infoReader, Map<String, FlashingResourcesParser.Constraint> c)

Constructs a FlashingResourcesParser with the supplied AndroidInfo Reader

Exposed for unit testing

FlashingResourcesParser(BufferedReader infoReader)

Constructs a FlashingResourcesParser with the supplied AndroidInfo Reader

Exposed for unit testing

Public methods

String getRequiredBasebandVersion()

Gets the required baseband version specified in the device image zip.

If multiple versions are listed, get the latest with the assumption that versions sort from oldest to newest alphabetically.

Collection<String> getRequiredBoards()

Gets the required board type(s) specified in the device image zip.

String getRequiredBootloaderVersion()

Gets the required bootloader version specified in the device image zip.

If multiple versions are listed, get the latest with the assumption that versions sort from oldest to newest alphabetically.

String getRequiredImageVersion(String imageVersionKey)

Gets the required custom image version specified in the device image zip

If multiple versions are listed, get the latest with the assumption that versions sort from oldest to newest alphabetically.

String getRequiredImageVersion(String imageVersionKey, String productName)

Gets the required custom image version specified in the device image zip.

If multiple versions are listed, get the latest with the assumption that versions sort from oldest to newest alphabetically.

Constants

BASEBAND_VERSION_KEY

String BASEBAND_VERSION_KEY

Constant Value: "version-baseband"

BOARD_KEY

String BOARD_KEY

Constant Value: "board"

BOOTLOADER_VERSION_KEY

String BOOTLOADER_VERSION_KEY

Constant Value: "version-bootloader"

PRODUCT_KEY

String PRODUCT_KEY

Constant Value: "product"

Public constructors

FlashingResourcesParser

FlashingResourcesParser (File deviceImgZipFile, 
                Map<String, FlashingResourcesParser.Constraint> c)

Create a FlashingResourcesParser and have it parse the specified device image for flashing requirements. Flashing requirements must pass the appropriate constraint (if one exists) before being added. Rejected requirements will be dropped silently.

Parameters
deviceImgZipFile File: The updater.zip file to be flashed
c Map: A map from key name to FlashingResourcesParser.Constraint. Image names will be checked against the appropriate constraint (if any) as a prereq for being added. May be null to disable filtering.
Throws
TargetSetupError

FlashingResourcesParser

FlashingResourcesParser (File deviceImgZipFile)

Create a FlashingResourcesParser and have it parse the specified device image for flashing requirements.

Parameters
deviceImgZipFile File: The updater.zip file to be flashed
Throws
TargetSetupError

FlashingResourcesParser

FlashingResourcesParser (BufferedReader infoReader, 
                Map<String, FlashingResourcesParser.Constraint> c)

Constructs a FlashingResourcesParser with the supplied AndroidInfo Reader

Exposed for unit testing

Parameters
infoReader BufferedReader: a BufferedReader containing the equivalent of android-info.txt to parse
c Map: A map from key name to FlashingResourcesParser.Constraint. Image names will be checked against the appropriate constraint (if any) as a prereq for being added. May be null to disable filtering.
Throws
IOException

FlashingResourcesParser

FlashingResourcesParser (BufferedReader infoReader)

Constructs a FlashingResourcesParser with the supplied AndroidInfo Reader

Exposed for unit testing

Parameters
infoReader BufferedReader: a BufferedReader containing the equivalent of android-info.txt to parse
Throws
IOException

Public methods

getRequiredBasebandVersion

String getRequiredBasebandVersion ()

Gets the required baseband version specified in the device image zip.

If multiple versions are listed, get the latest with the assumption that versions sort from oldest to newest alphabetically.

Returns
String the baseband version or null if not specified

getRequiredBoards

Collection<String> getRequiredBoards ()

Gets the required board type(s) specified in the device image zip.

Returns
Collection<String> the board types or null if not specified

getRequiredBootloaderVersion

String getRequiredBootloaderVersion ()

Gets the required bootloader version specified in the device image zip.

If multiple versions are listed, get the latest with the assumption that versions sort from oldest to newest alphabetically.

Returns
String the bootloader version or null if not specified

getRequiredImageVersion

String getRequiredImageVersion (String imageVersionKey)

Gets the required custom image version specified in the device image zip

If multiple versions are listed, get the latest with the assumption that versions sort from oldest to newest alphabetically.

Parameters
imageVersionKey String: the expected identifier of the image's version information
Returns
String the required version for given image or null if not specified

getRequiredImageVersion

String getRequiredImageVersion (String imageVersionKey, 
                String productName)

Gets the required custom image version specified in the device image zip. If productName is non-null, this method will check for (and return if present) image requirements specified for that particular product. If no product-specific requirement exists, it will fall back to returning the global requirement, or null if no requirement of any sort exists for that particular versionKey.

If multiple versions are listed, get the latest with the assumption that versions sort from oldest to newest alphabetically.

Parameters
imageVersionKey String: the expected identifier of the image's version information
productName String: A specific product name to check
Returns
String the required version for given image or null if not specified