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 

Fields

public static final String BASEBAND_VERSION_KEY

public static final String BOARD_KEY

public static final String BOOTLOADER_VERSION_KEY

public static final String PRODUCT_KEY

Public constructors

FlashingResourcesParser(BufferedReader infoReader)

Constructs a FlashingResourcesParser with the supplied AndroidInfo Reader

Exposed for unit testing

FlashingResourcesParser(BufferedReader infoReader, c)

Constructs a FlashingResourcesParser with the supplied AndroidInfo Reader

Exposed for unit testing

FlashingResourcesParser(File deviceImgZipFile)

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

FlashingResourcesParser(File deviceImgZipFile, c)

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

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.

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.

Fields

BASEBAND_VERSION_KEY

public static final String BASEBAND_VERSION_KEY

BOARD_KEY

public static final String BOARD_KEY

BOOTLOADER_VERSION_KEY

public static final String BOOTLOADER_VERSION_KEY

PRODUCT_KEY

public static final String PRODUCT_KEY

Public constructors

FlashingResourcesParser

public FlashingResourcesParser (BufferedReader infoReader)

Constructs a FlashingResourcesParser with the supplied AndroidInfo Reader

Exposed for unit testing

Parameters
infoReader BufferedReader: a ERROR(/BufferedReader) containing the equivalent of android-info.txt to parse

FlashingResourcesParser

public FlashingResourcesParser (BufferedReader infoReader, 
                 c)

Constructs a FlashingResourcesParser with the supplied AndroidInfo Reader

Exposed for unit testing

Parameters
infoReader BufferedReader: a ERROR(/BufferedReader) containing the equivalent of android-info.txt to parse

c : A map from key name to Constraint. Image names will be checked against the appropriate constraint (if any) as a prereq for being added. May be null to disable filtering.

FlashingResourcesParser

public 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

public FlashingResourcesParser (File deviceImgZipFile, 
                 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 : A map from key name to 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

Public methods

getRequiredBasebandVersion

public 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

public  getRequiredBoards ()

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

Returns
the board types or null if not specified

getRequiredBootloaderVersion

public 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

public 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

public 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