public class

FlashingResourcesParser

extends Object
implements IFlashingResourcesParser
java.lang.Object
   ↳ com.android.tradefed.targetprep.FlashingResourcesParser

Class Overview

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, 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.

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.

[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.tradefed.targetprep.IFlashingResourcesParser

Constants

public static final String BASEBAND_VERSION_KEY

Constant Value: "version-baseband"

public static final String BOARD_KEY

Constant Value: "board"

public static final String BOOTLOADER_VERSION_KEY

Constant Value: "version-bootloader"

public static final String PRODUCT_KEY

Constant Value: "product"

Public Constructors

public 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 The updater.zip file to be flashed
c 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.

public FlashingResourcesParser (File deviceImgZipFile)

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

Parameters
deviceImgZipFile The updater.zip file to be flashed

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

Constructs a FlashingResourcesParser with the supplied AndroidInfo Reader

Exposed for unit testing

Parameters
infoReader a BufferedReader containing the equivalent of android-info.txt to parse
c 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
IOException

public FlashingResourcesParser (BufferedReader infoReader)

Constructs a FlashingResourcesParser with the supplied AndroidInfo Reader

Exposed for unit testing

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

Public Methods

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
  • the baseband version or null if not specified

public Collection<String> getRequiredBoards ()

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

Returns
  • the board types or null if not specified

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
  • the bootloader version or null if not specified

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 the expected identifier of the image's version information
productName A specific product name to check
Returns
  • the required version for given image or null if not specified

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 the expected identifier of the image's version information
Returns
  • the required version for given image or null if not specified