Build  |  API reference  |  Android Developers (original) (raw)


public class Build
extends [Object](/reference/java/lang/Object) ``


Information about the current build, extracted from system properties.

Summary

Nested classes
class Build.Partition Build information for a particular device partition.
class Build.VERSION Various version strings.
class Build.VERSION_CODES Enumeration of the currently known SDK version codes.
class Build.VERSION_CODES_FULL Enumeration of the currently known SDK major and minor version codes.
Constants
int BACKPORTED_FIX_STATUS_FIXED The known issue is fixed on this device.
int BACKPORTED_FIX_STATUS_NOT_APPLICABLE The known issue is not applicable to this device.
int BACKPORTED_FIX_STATUS_NOT_FIXED The known issue is not fixed on this device.
int BACKPORTED_FIX_STATUS_UNKNOWN The status of the known issue on this device is not known.
String UNKNOWN Value used for when a build property is unknown.
Fields
public static finalString BOARD The name of the underlying board, like "goldfish".
public static finalString BOOTLOADER The system bootloader version number.
public static finalString BRAND The consumer-visible brand with which the product/hardware will be associated, if any.
public static finalString CPU_ABI This field was deprecated in API level 21. Use SUPPORTED_ABIS instead.
public static finalString CPU_ABI2 This field was deprecated in API level 21. Use SUPPORTED_ABIS instead.
public static finalString DEVICE The name of the industrial design.
public static finalString DISPLAY A build ID string meant for displaying to the user
public static finalString FINGERPRINT A string that uniquely identifies this build.
public static finalString HARDWARE The name of the hardware (from the kernel command line or /proc).
public static finalString HOST
public static finalString ID Either a changelist number, or a label like "M4-rc20".
public static finalString MANUFACTURER The manufacturer of the product/hardware.
public static finalString MODEL The end-user-visible name for the end product.
public static finalString ODM_SKU The SKU of the device as set by the original design manufacturer (ODM).
public static finalString PRODUCT The name of the overall product.
public static finalString RADIO This field was deprecated in API level 15. The radio firmware version is frequently not available when this class is initialized, leading to a blank or "unknown" value for this string. UsegetRadioVersion() instead.
public static finalString SERIAL This field was deprecated in API level 26. Use getSerial() instead.
public static finalString SKU The SKU of the hardware (from the kernel command line).
public static finalString SOC_MANUFACTURER The manufacturer of the device's primary system-on-chip.
public static finalString SOC_MODEL The model name of the device's primary system-on-chip.
public static finalString STRONGBOX_MANUFACTURER The manufacturer of the device's StrongBox chip.
public static finalString STRONGBOX_MODEL The model of the device's StrongBox chip.
public static finalString[] SUPPORTED_32_BIT_ABIS An ordered list of 32 bit ABIs supported by this device.
public static finalString[] SUPPORTED_64_BIT_ABIS An ordered list of 64 bit ABIs supported by this device.
public static finalString[] SUPPORTED_ABIS An ordered list of ABIs supported by this device.
public static finalString TAGS Comma-separated tags describing the build, like "unsigned,debug".
public static final long TIME The time at which the build was produced, given in milliseconds since the UNIX epoch.
public static finalString TYPE The type of build, like "user" or "eng".
public static finalString USER
Public constructors
Build()
Public methods
static int getBackportedFixStatus(long id) The status of the backported fix for a known issue on this device.
staticList<Build.Partition> getFingerprintedPartitions() Get build information about partitions that have a separate fingerprint defined.
static int getMajorSdkVersion(int sdkIntFull) Obtain the major version encoded in a VERSION_CODES_FULL value.
static int getMinorSdkVersion(int sdkIntFull) Obtain the minor version encoded in a VERSION_CODES_FULL value.
staticString getRadioVersion() Returns the version string for the radio firmware.
staticString getSerial() Gets the hardware serial number, if available.
Inherited methods
From class java.lang.Object Object clone() Creates and returns a copy of this object. boolean equals(Object obj) Indicates whether some other object is "equal to" this one. void finalize() Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. finalClass<?> getClass() Returns the runtime class of this Object. int hashCode() Returns a hash code value for the object. final void notify() Wakes up a single thread that is waiting on this object's monitor. final void notifyAll() Wakes up all threads that are waiting on this object's monitor. String toString() Returns a string representation of the object. final void wait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. final void wait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. final void wait() Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Constants

BACKPORTED_FIX_STATUS_FIXED

public static final int BACKPORTED_FIX_STATUS_FIXED

The known issue is fixed on this device.

Constant Value: 1 (0x00000001)

BACKPORTED_FIX_STATUS_NOT_APPLICABLE

public static final int BACKPORTED_FIX_STATUS_NOT_APPLICABLE

The known issue is not applicable to this device.

For example if the issue only affects a specific brand, devices from other brands would report not applicable.

Constant Value: 2 (0x00000002)

BACKPORTED_FIX_STATUS_NOT_FIXED

public static final int BACKPORTED_FIX_STATUS_NOT_FIXED

The known issue is not fixed on this device.

Constant Value: 3 (0x00000003)

BACKPORTED_FIX_STATUS_UNKNOWN

public static final int BACKPORTED_FIX_STATUS_UNKNOWN

The status of the known issue on this device is not known.

Constant Value: 0 (0x00000000)

UNKNOWN

public static final String UNKNOWN

Value used for when a build property is unknown.

Constant Value: "unknown"

Fields

BOARD

public static final String BOARD

The name of the underlying board, like "goldfish".

BOOTLOADER

public static final String BOOTLOADER

The system bootloader version number.

BRAND

public static final String BRAND

The consumer-visible brand with which the product/hardware will be associated, if any.

CPU_ABI

public static final String CPU_ABI

This field was deprecated in API level 21.
Use [SUPPORTED_ABIS](/reference/android/os/Build#SUPPORTED%5FABIS) instead.

The name of the instruction set (CPU type + ABI convention) of native code.

CPU_ABI2

public static final String CPU_ABI2

This field was deprecated in API level 21.
Use [SUPPORTED_ABIS](/reference/android/os/Build#SUPPORTED%5FABIS) instead.

The name of the second instruction set (CPU type + ABI convention) of native code.

DEVICE

public static final String DEVICE

The name of the industrial design.

DISPLAY

public static final String DISPLAY

A build ID string meant for displaying to the user

FINGERPRINT

public static final String FINGERPRINT

A string that uniquely identifies this build. Do not attempt to parse this value.

HARDWARE

public static final String HARDWARE

The name of the hardware (from the kernel command line or /proc).

HOST

public static final String HOST

ID

public static final String ID

Either a changelist number, or a label like "M4-rc20".

MANUFACTURER

public static final String MANUFACTURER

The manufacturer of the product/hardware.

MODEL

public static final String MODEL

The end-user-visible name for the end product.

ODM_SKU

public static final String ODM_SKU

The SKU of the device as set by the original design manufacturer (ODM).

This is a runtime-initialized property set during startup to configure device services. If no value is set, this is reported as [UNKNOWN](/reference/android/os/Build#UNKNOWN).

The ODM SKU may have multiple variants for the same system SKU in case a manufacturer produces variants of the same design. For example, the same build may be released with variations in physical keyboard and/or display hardware, each with a different ODM SKU.

PRODUCT

public static final String PRODUCT

The name of the overall product.

RADIO

public static final String RADIO

This field was deprecated in API level 15.
The radio firmware version is frequently not available when this class is initialized, leading to a blank or "unknown" value for this string. Use[getRadioVersion()](/reference/android/os/Build#getRadioVersion%28%29) instead.

The radio firmware version number.

SERIAL

public static final String SERIAL

This field was deprecated in API level 26.
Use [getSerial()](/reference/android/os/Build#getSerial%28%29) instead.

A hardware serial number, if available. Alphanumeric only, case-insensitive. This field is always set to [Build.UNKNOWN](/reference/android/os/Build#UNKNOWN).

SKU

public static final String SKU

The SKU of the hardware (from the kernel command line).

The SKU is reported by the bootloader to configure system software features. If no value is supplied by the bootloader, this is reported as [UNKNOWN](/reference/android/os/Build#UNKNOWN).

SOC_MANUFACTURER

public static final String SOC_MANUFACTURER

The manufacturer of the device's primary system-on-chip.

SOC_MODEL

public static final String SOC_MODEL

The model name of the device's primary system-on-chip.

STRONGBOX_MANUFACTURER

public static final String STRONGBOX_MANUFACTURER

The manufacturer of the device's StrongBox chip. If the device does not use StrongBox, this should be set to "unsupported".

STRONGBOX_MODEL

public static final String STRONGBOX_MODEL

The model of the device's StrongBox chip. If the device does not use StrongBox, this should be set to "unsupported".

SUPPORTED_32_BIT_ABIS

public static final String[] SUPPORTED_32_BIT_ABIS

An ordered list of 32 bit ABIs supported by this device. The most preferred ABI is the first element in the list. See [SUPPORTED_ABIS](/reference/android/os/Build#SUPPORTED%5FABIS) and [SUPPORTED_64_BIT_ABIS](/reference/android/os/Build#SUPPORTED%5F64%5FBIT%5FABIS).

SUPPORTED_64_BIT_ABIS

public static final String[] SUPPORTED_64_BIT_ABIS

An ordered list of 64 bit ABIs supported by this device. The most preferred ABI is the first element in the list. See [SUPPORTED_ABIS](/reference/android/os/Build#SUPPORTED%5FABIS) and [SUPPORTED_32_BIT_ABIS](/reference/android/os/Build#SUPPORTED%5F32%5FBIT%5FABIS).

TAGS

public static final String TAGS

Comma-separated tags describing the build, like "unsigned,debug".

TIME

public static final long TIME

The time at which the build was produced, given in milliseconds since the UNIX epoch.

TYPE

public static final String TYPE

The type of build, like "user" or "eng".

USER

public static final String USER

Public constructors

Public methods

getFingerprintedPartitions

public static List<Build.Partition> getFingerprintedPartitions ()

Get build information about partitions that have a separate fingerprint defined. The list includes partitions that are suitable candidates for over-the-air updates. This is not an exhaustive list of partitions on the device.

Returns
List<Build.Partition> This value cannot be null.

getMajorSdkVersion

public static int getMajorSdkVersion (int sdkIntFull)

Obtain the major version encoded in a VERSION_CODES_FULL value. This value is guaranteed to be non-negative.

Parameters
sdkIntFull int
Returns
int The major version encoded in a VERSION_CODES_FULL value

getMinorSdkVersion

public static int getMinorSdkVersion (int sdkIntFull)

Obtain the minor version encoded in a VERSION_CODES_FULL value. This value is guaranteed to be non-negative.

Parameters
sdkIntFull int
Returns
int The minor version encoded in a VERSION_CODES_FULL value

getRadioVersion

public static String getRadioVersion ()

Returns the version string for the radio firmware. May return null (if, for instance, the radio is not currently on).

Returns
String

getSerial

public static String getSerial ()

Gets the hardware serial number, if available.

Note: Root access may allow you to modify device identifiers, such as the hardware serial number. If you change these identifiers, you can not usekey attestation to obtain proof of the device's original identifiers. KeyMint will reject an ID attestation request if the identifiers provided by the frameworks do not match the identifiers it was provisioned with.

Starting with API level 29, persistent device identifiers are guarded behind additional restrictions, and apps are recommended to use resettable identifiers (see Best practices for unique identifiers). This method can be invoked if one of the following requirements is met:

If the calling app does not meet one of these requirements then this method will behave as follows:

.
Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE

Returns
String The serial number if specified.