Added in API level 1

Build


open class Build
kotlin.Any
   ↳ android.os.Build

Information about the current build, extracted from system properties.

Summary

Nested classes
open

Build information for a particular device partition.

open

Various version strings.

open

Enumeration of the currently known SDK version codes.

open

Enumeration of the currently known SDK major and minor version codes.

Constants
static String

Value used for when a build property is unknown.

Public constructors

Public methods
open static MutableList<Build.Partition!>

Get build information about partitions that have a separate fingerprint defined.

open static Int
getMajorSdkVersion(sdkIntFull: Int)

Obtain the major version encoded in a VERSION_CODES_FULL value.

open static Int
getMinorSdkVersion(sdkIntFull: Int)

Obtain the minor version encoded in a VERSION_CODES_FULL value.

open static String!

Returns the version string for the radio firmware.

open static String!

Gets the hardware serial number, if available.

Properties
static String!

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

static String!

The system bootloader version number.

static String!

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

static String!

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

static String!

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

static String!

The name of the industrial design.

static String!

A build ID string meant for displaying to the user

static String!

A string that uniquely identifies this build.

static String!

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

static String!

static String!

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

static String!

The manufacturer of the product/hardware.

static String!

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

static String

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

static String!

The name of the overall product.

static String!

The radio firmware version number.

static String!

A hardware serial number, if available.

static String

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

static String

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

static String

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

static Array<String!>!

An ordered list of 32 bit ABIs supported by this device.

static Array<String!>!

An ordered list of 64 bit ABIs supported by this device.

static Array<String!>!

An ordered list of ABIs supported by this device.

static String!

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

static Long

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

static String!

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

static String!

Constants

UNKNOWN

Added in API level 8
static val UNKNOWN: String

Value used for when a build property is unknown.

Value: "unknown"

Public constructors

Build

Build()

Public methods

getFingerprintedPartitions

Added in API level 29
open static fun getFingerprintedPartitions(): MutableList<Build.Partition!>

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.

Return
MutableList<Build.Partition!> This value cannot be null.

getMajorSdkVersion

open static fun getMajorSdkVersion(sdkIntFull: Int): Int

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

Parameters
sdkIntFull Int: Value is android.os.Build.VERSION_CODES_FULL#BASE, android.os.Build.VERSION_CODES_FULL#BASE_1_1, android.os.Build.VERSION_CODES_FULL#CUPCAKE, android.os.Build.VERSION_CODES_FULL#DONUT, android.os.Build.VERSION_CODES_FULL#ECLAIR, android.os.Build.VERSION_CODES_FULL#ECLAIR_0_1, android.os.Build.VERSION_CODES_FULL#ECLAIR_MR1, android.os.Build.VERSION_CODES_FULL#FROYO, android.os.Build.VERSION_CODES_FULL#GINGERBREAD, android.os.Build.VERSION_CODES_FULL#GINGERBREAD_MR1, android.os.Build.VERSION_CODES_FULL#HONEYCOMB, android.os.Build.VERSION_CODES_FULL#HONEYCOMB_MR1, android.os.Build.VERSION_CODES_FULL#HONEYCOMB_MR2, android.os.Build.VERSION_CODES_FULL#ICE_CREAM_SANDWICH, android.os.Build.VERSION_CODES_FULL#ICE_CREAM_SANDWICH_MR1, android.os.Build.VERSION_CODES_FULL#JELLY_BEAN, android.os.Build.VERSION_CODES_FULL#JELLY_BEAN_MR1, android.os.Build.VERSION_CODES_FULL#JELLY_BEAN_MR2, android.os.Build.VERSION_CODES_FULL#KITKAT, android.os.Build.VERSION_CODES_FULL#KITKAT_WATCH, android.os.Build.VERSION_CODES_FULL#LOLLIPOP, android.os.Build.VERSION_CODES_FULL#LOLLIPOP_MR1, android.os.Build.VERSION_CODES_FULL#M, android.os.Build.VERSION_CODES_FULL#N, android.os.Build.VERSION_CODES_FULL#N_MR1, android.os.Build.VERSION_CODES_FULL#O, android.os.Build.VERSION_CODES_FULL#O_MR1, android.os.Build.VERSION_CODES_FULL#P, android.os.Build.VERSION_CODES_FULL#Q, android.os.Build.VERSION_CODES_FULL#R, android.os.Build.VERSION_CODES_FULL#S, android.os.Build.VERSION_CODES_FULL#S_V2, android.os.Build.VERSION_CODES_FULL#TIRAMISU, android.os.Build.VERSION_CODES_FULL#UPSIDE_DOWN_CAKE, or android.os.Build.VERSION_CODES_FULL#VANILLA_ICE_CREAM
Return
Int The major version encoded in a VERSION_CODES_FULL value

getMinorSdkVersion

open static fun getMinorSdkVersion(sdkIntFull: Int): Int

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

Parameters
sdkIntFull Int: Value is android.os.Build.VERSION_CODES_FULL#BASE, android.os.Build.VERSION_CODES_FULL#BASE_1_1, android.os.Build.VERSION_CODES_FULL#CUPCAKE, android.os.Build.VERSION_CODES_FULL#DONUT, android.os.Build.VERSION_CODES_FULL#ECLAIR, android.os.Build.VERSION_CODES_FULL#ECLAIR_0_1, android.os.Build.VERSION_CODES_FULL#ECLAIR_MR1, android.os.Build.VERSION_CODES_FULL#FROYO, android.os.Build.VERSION_CODES_FULL#GINGERBREAD, android.os.Build.VERSION_CODES_FULL#GINGERBREAD_MR1, android.os.Build.VERSION_CODES_FULL#HONEYCOMB, android.os.Build.VERSION_CODES_FULL#HONEYCOMB_MR1, android.os.Build.VERSION_CODES_FULL#HONEYCOMB_MR2, android.os.Build.VERSION_CODES_FULL#ICE_CREAM_SANDWICH, android.os.Build.VERSION_CODES_FULL#ICE_CREAM_SANDWICH_MR1, android.os.Build.VERSION_CODES_FULL#JELLY_BEAN, android.os.Build.VERSION_CODES_FULL#JELLY_BEAN_MR1, android.os.Build.VERSION_CODES_FULL#JELLY_BEAN_MR2, android.os.Build.VERSION_CODES_FULL#KITKAT, android.os.Build.VERSION_CODES_FULL#KITKAT_WATCH, android.os.Build.VERSION_CODES_FULL#LOLLIPOP, android.os.Build.VERSION_CODES_FULL#LOLLIPOP_MR1, android.os.Build.VERSION_CODES_FULL#M, android.os.Build.VERSION_CODES_FULL#N, android.os.Build.VERSION_CODES_FULL#N_MR1, android.os.Build.VERSION_CODES_FULL#O, android.os.Build.VERSION_CODES_FULL#O_MR1, android.os.Build.VERSION_CODES_FULL#P, android.os.Build.VERSION_CODES_FULL#Q, android.os.Build.VERSION_CODES_FULL#R, android.os.Build.VERSION_CODES_FULL#S, android.os.Build.VERSION_CODES_FULL#S_V2, android.os.Build.VERSION_CODES_FULL#TIRAMISU, android.os.Build.VERSION_CODES_FULL#UPSIDE_DOWN_CAKE, or android.os.Build.VERSION_CODES_FULL#VANILLA_ICE_CREAM
Return
Int The minor version encoded in a VERSION_CODES_FULL value

getRadioVersion

Added in API level 14
open static fun getRadioVersion(): String!

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

getSerial

Added in API level 26
open static fun getSerial(): String!

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 use key 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:

  • If the calling app's target SDK is API level 28 or lower and the app has the READ_PHONE_STATE permission then Build.UNKNOWN is returned.
  • If the calling app's target SDK is API level 28 or lower and the app does not have the READ_PHONE_STATE permission, or if the calling app is targeting API level 29 or higher, then a SecurityException is thrown.

Requires android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE
Return
String! The serial number if specified.

Properties

BOARD

Added in API level 1
static val BOARD: String!

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

BOOTLOADER

Added in API level 8
static val BOOTLOADER: String!

The system bootloader version number.

BRAND

Added in API level 1
static val BRAND: String!

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

CPU_ABI

Added in API level 4
Deprecated in API level 21
static val CPU_ABI: String!

Deprecated: Use SUPPORTED_ABIS instead.

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

CPU_ABI2

Added in API level 8
Deprecated in API level 21
static val CPU_ABI2: String!

Deprecated: Use SUPPORTED_ABIS instead.

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

DEVICE

Added in API level 1
static val DEVICE: String!

The name of the industrial design.

DISPLAY

Added in API level 3
static val DISPLAY: String!

A build ID string meant for displaying to the user

FINGERPRINT

Added in API level 1
static val FINGERPRINT: String!

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

HARDWARE

Added in API level 8
static val HARDWARE: String!

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

HOST

Added in API level 1
static val HOST: String!

ID

Added in API level 1
static val ID: String!

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

MANUFACTURER

Added in API level 4
static val MANUFACTURER: String!

The manufacturer of the product/hardware.

MODEL

Added in API level 1
static val MODEL: String!

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

ODM_SKU

Added in API level 31
static val ODM_SKU: String

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.

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

Added in API level 1
static val PRODUCT: String!

The name of the overall product.

RADIO

Added in API level 8
Deprecated in API level 15
static val RADIO: String!

Deprecated: 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 instead.

The radio firmware version number.

SERIAL

Added in API level 9
Deprecated in API level 26
static val SERIAL: String!

Deprecated: Use getSerial() instead.

A hardware serial number, if available. Alphanumeric only, case-insensitive. This field is always set to Build.UNKNOWN.

SKU

Added in API level 31
static val SKU: String

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.

SOC_MANUFACTURER

Added in API level 31
static val SOC_MANUFACTURER: String

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

SOC_MODEL

Added in API level 31
static val SOC_MODEL: String

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

SUPPORTED_32_BIT_ABIS

Added in API level 21
static val SUPPORTED_32_BIT_ABIS: Array<String!>!

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 and SUPPORTED_64_BIT_ABIS.

SUPPORTED_64_BIT_ABIS

Added in API level 21
static val SUPPORTED_64_BIT_ABIS: Array<String!>!

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 and SUPPORTED_32_BIT_ABIS.

SUPPORTED_ABIS

Added in API level 21
static val SUPPORTED_ABIS: Array<String!>!

An ordered list of ABIs supported by this device. The most preferred ABI is the first element in the list. See SUPPORTED_32_BIT_ABIS and SUPPORTED_64_BIT_ABIS.

TAGS

Added in API level 1
static val TAGS: String!

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

TIME

Added in API level 1
static val TIME: Long

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

TYPE

Added in API level 1
static val TYPE: String!

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

USER

Added in API level 1
static val USER: String!