DeviceBuildDescriptor

public class DeviceBuildDescriptor
extends Object

java.lang.Object
   ↳ com.android.tradefed.build.DeviceBuildDescriptor


A wrapper class for a IBuildInfo, that contains helper methods to retrieve device platform build information.

Intended to be use for "unbundled" aka not device builds IBuildInfo, that desire metadata about what device the build was run on.

Summary

Fields

public static final String DEVICE_BUILD_ALIAS

public static final String DEVICE_BUILD_BRANCH

public static final String DEVICE_BUILD_FLAVOR

public static final String DEVICE_BUILD_ID

public static final String DEVICE_DESC

public static final String DEVICE_PRODUCT

Public constructors

DeviceBuildDescriptor(IBuildInfo build)

Public methods

static boolean describesDeviceBuild(IBuildInfo build)

Determines if given IBuildInfo contains device build metadata

static String generateDeviceDesc(ITestDevice device)

Generate the device description string from device properties.

static String generateDeviceProduct(ITestDevice device)

Query the product and variant of the device, in product:variant format.

String getDeviceBuildAlias()

Gets the device build alias.

String getDeviceBuildBranch()

Gets the device build branch eg git_master.

String getDeviceBuildFlavor()

Gets the device build flavor eg yakju-userdebug.

String getDeviceBuildId()

Gets the device build ID.

String getDeviceProduct()

Get the product and variant of the device, in product:variant format.

String getDeviceUserDescription()

Gets a description of the device and build.

static void injectDeviceAttributes(ITestDevice device, IBuildInfo b)

Inserts attributes from device into build.

Fields

DEVICE_BUILD_ALIAS

public static final String DEVICE_BUILD_ALIAS

DEVICE_BUILD_BRANCH

public static final String DEVICE_BUILD_BRANCH

DEVICE_BUILD_FLAVOR

public static final String DEVICE_BUILD_FLAVOR

DEVICE_BUILD_ID

public static final String DEVICE_BUILD_ID

DEVICE_DESC

public static final String DEVICE_DESC

DEVICE_PRODUCT

public static final String DEVICE_PRODUCT

Public constructors

DeviceBuildDescriptor

public DeviceBuildDescriptor (IBuildInfo build)

Parameters
build IBuildInfo

Public methods

describesDeviceBuild

public static boolean describesDeviceBuild (IBuildInfo build)

Determines if given IBuildInfo contains device build metadata

Returns
boolean True if the IBuildInfo contains the device build metadata, false otherwise

generateDeviceDesc

public static String generateDeviceDesc (ITestDevice device)

Generate the device description string from device properties.

Description should follow this format: eg Google Galaxy Nexus 4.2

Returns
String The device description string

Throws
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

generateDeviceProduct

public static String generateDeviceProduct (ITestDevice device)

Query the product and variant of the device, in product:variant format.

Parameters
device ITestDevice

Returns
String

Throws
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getDeviceBuildAlias

public String getDeviceBuildAlias ()

Gets the device build alias. Maps to the ro.build.id property on device. Typically follows format IMM76.

Returns
String

getDeviceBuildBranch

public String getDeviceBuildBranch ()

Gets the device build branch eg git_master.

Returns
String

getDeviceBuildFlavor

public String getDeviceBuildFlavor ()

Gets the device build flavor eg yakju-userdebug.

Returns
String

getDeviceBuildId

public String getDeviceBuildId ()

Gets the device build ID. Maps to the ro.build.incremental.id property on device.

Returns
String

getDeviceProduct

public String getDeviceProduct ()

Get the product and variant of the device, in product:variant format.

Returns
String

getDeviceUserDescription

public String getDeviceUserDescription ()

Gets a description of the device and build. This is typically a more end-user friendly description compared with getDeviceBuildAlias() and getDeviceBuildFlavor() but with the possible penalty of being less precise. eg. it wouldn't be possible to distinguish the GSM (yakju) and CDMA (mysid) variants of Google Galaxy Nexus using this string.

Returns
String

injectDeviceAttributes

public static void injectDeviceAttributes (ITestDevice device, 
                IBuildInfo b)

Inserts attributes from device into build.

Parameters
b IBuildInfo

Throws
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException