FileDocCategorySizeDatePackage
Build.javaAPI DocAndroid 5.1 API31860Thu Mar 12 22:22:10 GMT 2015android.os

Build

public class Build extends Object
Information about the current build, extracted from system properties.

Fields Summary
private static final String
TAG
public static final String
UNKNOWN
Value used for when a build property is unknown.
public static final String
ID
Either a changelist number, or a label like "M4-rc20".
public static final String
DISPLAY
A build ID string meant for displaying to the user
public static final String
PRODUCT
The name of the overall product.
public static final String
DEVICE
The name of the industrial design.
public static final String
BOARD
The name of the underlying board, like "goldfish".
public static final String
CPU_ABI
The name of the instruction set (CPU type + ABI convention) of native code.
public static final String
CPU_ABI2
The name of the second instruction set (CPU type + ABI convention) of native code.
public static final String
MANUFACTURER
The manufacturer of the product/hardware.
public static final String
BRAND
The consumer-visible brand with which the product/hardware will be associated, if any.
public static final String
MODEL
The end-user-visible name for the end product.
public static final String
BOOTLOADER
The system bootloader version number.
public static final String
RADIO
The radio firmware version number.
public static final String
HARDWARE
The name of the hardware (from the kernel command line or /proc).
public static final String
SERIAL
A hardware serial number, if available. Alphanumeric only, case-insensitive.
public static final String[]
SUPPORTED_ABIS
An ordered list of ABIs supported by this device. The most preferred ABI is the first element in the list. See {@link #SUPPORTED_32_BIT_ABIS} and {@link #SUPPORTED_64_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 {@link #SUPPORTED_ABIS} and {@link #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 {@link #SUPPORTED_ABIS} and {@link #SUPPORTED_32_BIT_ABIS}.
public static final String
TYPE
The type of build, like "user" or "eng".
public static final String
TAGS
Comma-separated tags describing the build, like "unsigned,debug".
public static final String
FINGERPRINT
A string that uniquely identifies this build. Do not attempt to parse this value.
public static final long
TIME
public static final String
USER
public static final String
HOST
public static final boolean
IS_DEBUGGABLE
Returns true if we are running a debug build such as "user-debug" or "eng".
Constructors Summary
Methods Summary
private static java.lang.StringderiveFingerprint()
Some devices split the fingerprint components between multiple partitions, so we might derive the fingerprint at runtime.


                          
        
        String finger = SystemProperties.get("ro.build.fingerprint");
        if (TextUtils.isEmpty(finger)) {
            finger = getString("ro.product.brand") + '/" +
                    getString("ro.product.name") + '/" +
                    getString("ro.product.device") + ':" +
                    getString("ro.build.version.release") + '/" +
                    getString("ro.build.id") + '/" +
                    getString("ro.build.version.incremental") + ':" +
                    getString("ro.build.type") + '/" +
                    getString("ro.build.tags");
        }
        return finger;
    
public static voidensureFingerprintProperty()
Ensure that raw fingerprint system property is defined. If it was derived dynamically by {@link #deriveFingerprint()} this is where we push the derived value into the property service.

hide

        if (TextUtils.isEmpty(SystemProperties.get("ro.build.fingerprint"))) {
            try {
                SystemProperties.set("ro.build.fingerprint", FINGERPRINT);
            } catch (IllegalArgumentException e) {
                Slog.e(TAG, "Failed to set fingerprint property", e);
            }
        }
    
private static longgetLong(java.lang.String property)

        try {
            return Long.parseLong(SystemProperties.get(property));
        } catch (NumberFormatException e) {
            return -1;
        }
    
public static java.lang.StringgetRadioVersion()
Returns the version string for the radio firmware. May return null (if, for instance, the radio is not currently on).


                              
        
        return SystemProperties.get(TelephonyProperties.PROPERTY_BASEBAND_VERSION, null);
    
private static java.lang.StringgetString(java.lang.String property)

        return SystemProperties.get(property, UNKNOWN);
    
private static java.lang.String[]getStringList(java.lang.String property, java.lang.String separator)

        String value = SystemProperties.get(property);
        if (value.isEmpty()) {
            return new String[0];
        } else {
            return value.split(separator);
        }
    
public static booleanisFingerprintConsistent()
Check that device fingerprint is defined and that it matches across various partitions.

hide

        final String system = SystemProperties.get("ro.build.fingerprint");
        final String vendor = SystemProperties.get("ro.vendor.build.fingerprint");

        if (TextUtils.isEmpty(system)) {
            Slog.e(TAG, "Required ro.build.fingerprint is empty!");
            return false;
        }

        if (!TextUtils.isEmpty(vendor)) {
            if (!Objects.equals(system, vendor)) {
                Slog.e(TAG, "Mismatched fingerprints; system reported " + system
                        + " but vendor reported " + vendor);
                return false;
            }
        }

        return true;