blob: 6e50e97ae99644a3c444da27cd9fa2e09ba4b0c2 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.os;
18
19/**
20 * Information about the current build, extracted from system properties.
21 */
22public class Build {
23 /** Value used for when a build property is unknown. */
Ficus Kirkpatrick71de7852010-01-08 13:10:51 -080024 public static final String UNKNOWN = "unknown";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025
26 /** Either a changelist number, or a label like "M4-rc20". */
27 public static final String ID = getString("ro.build.id");
28
29 /** A build ID string meant for displaying to the user */
30 public static final String DISPLAY = getString("ro.build.display.id");
31
32 /** The name of the overall product. */
33 public static final String PRODUCT = getString("ro.product.name");
34
35 /** The name of the industrial design. */
36 public static final String DEVICE = getString("ro.product.device");
37
38 /** The name of the underlying board, like "goldfish". */
39 public static final String BOARD = getString("ro.product.board");
40
Dianne Hackbornb1811182009-05-21 15:45:42 -070041 /** The name of the instruction set (CPU type + ABI convention) of native code. */
42 public static final String CPU_ABI = getString("ro.product.cpu.abi");
43
Ficus Kirkpatrickfa9cafa2010-01-06 17:37:13 -080044 /** The name of the second instruction set (CPU type + ABI convention) of native code. */
45 public static final String CPU_ABI2 = getString("ro.product.cpu.abi2");
46
Dianne Hackbornd62ad4f2009-05-19 19:06:25 -070047 /** The manufacturer of the product/hardware. */
48 public static final String MANUFACTURER = getString("ro.product.manufacturer");
49
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050 /** The brand (e.g., carrier) the software is customized for, if any. */
51 public static final String BRAND = getString("ro.product.brand");
52
53 /** The end-user-visible name for the end product. */
54 public static final String MODEL = getString("ro.product.model");
55
Doug Zongker74885ef2010-02-02 17:39:26 -080056 /** The system bootloader version number. */
Dan Egnor42471dd2010-01-07 17:25:22 -080057 public static final String BOOTLOADER = getString("ro.bootloader");
58
Doug Zongker74885ef2010-02-02 17:39:26 -080059 /** The radio firmware version number. */
Dan Egnor42471dd2010-01-07 17:25:22 -080060 public static final String RADIO = getString("gsm.version.baseband");
61
Doug Zongker74885ef2010-02-02 17:39:26 -080062 /** The name of the hardware (from the kernel command line or /proc). */
63 public static final String HARDWARE = getString("ro.hardware");
Dan Egnor42471dd2010-01-07 17:25:22 -080064
Doug Zongker7d2e3df2010-08-11 16:58:04 -070065 /** A hardware serial number, if available. Alphanumeric only, case-insensitive. */
66 public static final String SERIAL = getString("ro.serialno");
67
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 /** Various version strings. */
69 public static class VERSION {
70 /**
71 * The internal value used by the underlying source control to
72 * represent this build. E.g., a perforce changelist number
73 * or a git hash.
74 */
75 public static final String INCREMENTAL = getString("ro.build.version.incremental");
76
77 /**
78 * The user-visible version string. E.g., "1.0" or "3.4b5".
79 */
80 public static final String RELEASE = getString("ro.build.version.release");
81
82 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -070083 * The user-visible SDK version of the framework in its raw String
84 * representation; use {@link #SDK_INT} instead.
85 *
86 * @deprecated Use {@link #SDK_INT} to easily get this as an integer.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080087 */
Dianne Hackborn4a51c202009-08-21 15:14:02 -070088 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080089 public static final String SDK = getString("ro.build.version.sdk");
Dianne Hackborn851a5412009-05-08 12:06:44 -070090
91 /**
92 * The user-visible SDK version of the framework; its possible
93 * values are defined in {@link Build.VERSION_CODES}.
94 */
95 public static final int SDK_INT = SystemProperties.getInt(
96 "ro.build.version.sdk", 0);
97
98 /**
99 * The current development codename, or the string "REL" if this is
100 * a release build.
101 */
102 public static final String CODENAME = getString("ro.build.version.codename");
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800103 }
104
Dianne Hackborn851a5412009-05-08 12:06:44 -0700105 /**
106 * Enumeration of the currently known SDK version codes. These are the
107 * values that can be found in {@link VERSION#SDK}. Version numbers
108 * increment monotonically with each official platform release.
109 */
110 public static class VERSION_CODES {
111 /**
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700112 * Magic version number for a current development build, which has
113 * not yet turned into an official release.
114 */
115 public static final int CUR_DEVELOPMENT = 10000;
116
117 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700118 * October 2008: The original, first, version of Android. Yay!
119 */
120 public static final int BASE = 1;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700121
Dianne Hackborn851a5412009-05-08 12:06:44 -0700122 /**
123 * February 2009: First Android update, officially called 1.1.
124 */
125 public static final int BASE_1_1 = 2;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700126
Dianne Hackborn851a5412009-05-08 12:06:44 -0700127 /**
128 * May 2009: Android 1.5.
129 */
130 public static final int CUPCAKE = 3;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700131
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700132 /**
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700133 * September 2009: Android 1.6.
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700134 *
135 * <p>Applications targeting this or a later release will get these
136 * new changes in behavior:</p>
137 * <ul>
138 * <li> They must explicitly request the
San Mehat5a3a77d2009-06-01 09:25:28 -0700139 * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission to be
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700140 * able to modify the contents of the SD card. (Apps targeting
141 * earlier versions will always request the permission.)
Dianne Hackbornfe77ec82009-08-12 16:53:56 -0700142 * <li> They must explicitly request the
143 * {@link android.Manifest.permission#READ_PHONE_STATE} permission to be
144 * able to be able to retrieve phone state info. (Apps targeting
145 * earlier versions will always request the permission.)
146 * <li> They are assumed to support different screen densities and
147 * sizes. (Apps targeting earlier versions are assumed to only support
148 * medium density normal size screens unless otherwise indicated).
149 * They can still explicitly specify screen support either way with the
150 * supports-screens manifest tag.
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700151 * </ul>
152 */
Dianne Hackbornfe77ec82009-08-12 16:53:56 -0700153 public static final int DONUT = 4;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700154
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700155 /**
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700156 * November 2009: Android 2.0
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700157 *
158 * <p>Applications targeting this or a later release will get these
159 * new changes in behavior:</p>
160 * <ul>
161 * <li> The {@link android.app.Service#onStartCommand
162 * Service.onStartCommand} function will return the new
163 * {@link android.app.Service#START_STICKY} behavior instead of the
164 * old compatibility {@link android.app.Service#START_STICKY_COMPATIBILITY}.
Dianne Hackborn8d374262009-09-14 21:21:52 -0700165 * <li> The {@link android.app.Activity} class will now execute back
166 * key presses on the key up instead of key down, to be able to detect
167 * canceled presses from virtual keys.
Mike Cleron76097642009-09-25 17:53:56 -0700168 * <li> The {@link android.widget.TabWidget} class will use a new color scheme
169 * for tabs. In the new scheme, the foreground tab has a medium gray background
170 * the background tabs have a dark gray background.
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700171 * </ul>
172 */
Jeff Hamilton6dc3f4e2009-10-10 12:06:19 -0500173 public static final int ECLAIR = 5;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700174
175 /**
Dianne Hackborn17787762009-11-12 16:11:36 -0800176 * December 2009: Android 2.0.1
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700177 */
Dianne Hackborn17787762009-11-12 16:11:36 -0800178 public static final int ECLAIR_0_1 = 6;
Dianne Hackborn23ef7b42009-11-18 18:20:39 -0800179
180 /**
181 * January 2010: Android 2.1
182 */
183 public static final int ECLAIR_MR1 = 7;
Adam Powell216bccf2010-02-01 15:03:17 -0800184
Dianne Hackborn3e03cfa2010-06-13 12:07:00 -0700185 /**
186 * June 2010: Android 2.2
187 */
Adam Powell216bccf2010-02-01 15:03:17 -0800188 public static final int FROYO = 8;
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700189
Dianne Hackborn3e03cfa2010-06-13 12:07:00 -0700190 /**
Dianne Hackborn5383f502010-10-22 12:59:20 -0700191 * Newest version of Android, version 2.3.
Dianne Hackborn3e03cfa2010-06-13 12:07:00 -0700192 */
Dianne Hackborn4fa1a222010-10-18 13:10:49 -0700193 public static final int GINGERBREAD = 9;
Dianne Hackbornb1ad5972010-08-02 17:30:33 -0700194
195 /**
196 * Next next version of Android.
197 *
198 * <p>Applications targeting this or a later release will get these
199 * new changes in behavior:</p>
200 * <ul>
Dianne Hackborn3e6d50c2010-08-23 18:30:44 -0700201 * <li> The default theme for applications is now dark holographic:
202 * {@link android.R.style#Theme_Holo}.
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800203 * <li> The activity lifecycle has changed slightly as per
204 * {@link android.app.Activity}.
Dianne Hackbornb1ad5972010-08-02 17:30:33 -0700205 * </ul>
206 */
207 public static final int HONEYCOMB = CUR_DEVELOPMENT;
Dianne Hackborn851a5412009-05-08 12:06:44 -0700208 }
209
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800210 /** The type of build, like "user" or "eng". */
211 public static final String TYPE = getString("ro.build.type");
212
213 /** Comma-separated tags describing the build, like "unsigned,debug". */
214 public static final String TAGS = getString("ro.build.tags");
215
216 /** A string that uniquely identifies this build. Do not attempt to parse this value. */
217 public static final String FINGERPRINT = getString("ro.build.fingerprint");
218
219 // The following properties only make sense for internal engineering builds.
220 public static final long TIME = getLong("ro.build.date.utc") * 1000;
221 public static final String USER = getString("ro.build.user");
222 public static final String HOST = getString("ro.build.host");
223
224 private static String getString(String property) {
225 return SystemProperties.get(property, UNKNOWN);
226 }
227
228 private static long getLong(String property) {
229 try {
230 return Long.parseLong(SystemProperties.get(property));
231 } catch (NumberFormatException e) {
232 return -1;
233 }
234 }
235}