blob: 1e0dc53e128612ab703abfbd1e17b2db76c2b9a6 [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
Jeff Sharkey55687722014-04-09 18:07:19 -070019import android.text.TextUtils;
Jeff Sharkeybdd44912014-04-11 16:30:14 -070020import android.util.Slog;
Jeff Sharkey55687722014-04-09 18:07:19 -070021
Doug Zongkerad2171a2011-06-14 11:07:24 -070022import com.android.internal.telephony.TelephonyProperties;
23
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080024/**
25 * Information about the current build, extracted from system properties.
26 */
27public class Build {
Jeff Sharkeybdd44912014-04-11 16:30:14 -070028 private static final String TAG = "Build";
29
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080030 /** Value used for when a build property is unknown. */
Ficus Kirkpatrick71de7852010-01-08 13:10:51 -080031 public static final String UNKNOWN = "unknown";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080032
33 /** Either a changelist number, or a label like "M4-rc20". */
34 public static final String ID = getString("ro.build.id");
35
36 /** A build ID string meant for displaying to the user */
37 public static final String DISPLAY = getString("ro.build.display.id");
38
39 /** The name of the overall product. */
40 public static final String PRODUCT = getString("ro.product.name");
41
42 /** The name of the industrial design. */
43 public static final String DEVICE = getString("ro.product.device");
44
45 /** The name of the underlying board, like "goldfish". */
46 public static final String BOARD = getString("ro.product.board");
47
Narayan Kamath1adf4002014-07-12 11:46:37 +010048 /**
49 * The name of the instruction set (CPU type + ABI convention) of native code.
50 *
51 * @deprecated Use {@link #SUPPORTED_ABIS} instead.
52 */
53 @Deprecated
Dianne Hackbornb1811182009-05-21 15:45:42 -070054 public static final String CPU_ABI = getString("ro.product.cpu.abi");
55
Narayan Kamath1adf4002014-07-12 11:46:37 +010056 /**
57 * The name of the second instruction set (CPU type + ABI convention) of native code.
58 *
59 * @deprecated Use {@link #SUPPORTED_ABIS} instead.
60 */
61 @Deprecated
Ficus Kirkpatrickfa9cafa2010-01-06 17:37:13 -080062 public static final String CPU_ABI2 = getString("ro.product.cpu.abi2");
63
Dianne Hackbornd62ad4f2009-05-19 19:06:25 -070064 /** The manufacturer of the product/hardware. */
65 public static final String MANUFACTURER = getString("ro.product.manufacturer");
66
Dirk Dougherty491b40d2013-10-29 18:33:29 -070067 /** The consumer-visible brand with which the product/hardware will be associated, if any. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080068 public static final String BRAND = getString("ro.product.brand");
69
70 /** The end-user-visible name for the end product. */
71 public static final String MODEL = getString("ro.product.model");
72
Doug Zongker74885ef2010-02-02 17:39:26 -080073 /** The system bootloader version number. */
Dan Egnor42471dd2010-01-07 17:25:22 -080074 public static final String BOOTLOADER = getString("ro.bootloader");
75
Doug Zongkerad2171a2011-06-14 11:07:24 -070076 /**
77 * The radio firmware version number.
78 *
79 * @deprecated The radio firmware version is frequently not
80 * available when this class is initialized, leading to a blank or
81 * "unknown" value for this string. Use
82 * {@link #getRadioVersion} instead.
83 */
84 @Deprecated
85 public static final String RADIO = getString(TelephonyProperties.PROPERTY_BASEBAND_VERSION);
Dan Egnor42471dd2010-01-07 17:25:22 -080086
Doug Zongker74885ef2010-02-02 17:39:26 -080087 /** The name of the hardware (from the kernel command line or /proc). */
88 public static final String HARDWARE = getString("ro.hardware");
Dan Egnor42471dd2010-01-07 17:25:22 -080089
Doug Zongker7d2e3df2010-08-11 16:58:04 -070090 /** A hardware serial number, if available. Alphanumeric only, case-insensitive. */
91 public static final String SERIAL = getString("ro.serialno");
Ramin Zaghi1378aba2014-02-28 15:03:19 +000092
93 /**
Narayan Kamath0f206a12014-04-12 11:41:13 +010094 * An ordered list of ABIs supported by this device. The most preferred ABI is the first
95 * element in the list.
96 *
97 * See {@link #SUPPORTED_32_BIT_ABIS} and {@link #SUPPORTED_64_BIT_ABIS}.
Ramin Zaghi1378aba2014-02-28 15:03:19 +000098 */
Torne (Richard Coles)ff701a62014-07-30 12:11:15 +010099 public static final String[] SUPPORTED_ABIS = getStringList("ro.product.cpu.abilist", ",");
Ramin Zaghi1378aba2014-02-28 15:03:19 +0000100
Narayan Kamath0f206a12014-04-12 11:41:13 +0100101 /**
102 * An ordered list of <b>32 bit</b> ABIs supported by this device. The most preferred ABI
103 * is the first element in the list.
104 *
105 * See {@link #SUPPORTED_ABIS} and {@link #SUPPORTED_64_BIT_ABIS}.
Narayan Kamath0f206a12014-04-12 11:41:13 +0100106 */
Torne (Richard Coles)da8c0372014-05-14 16:17:26 +0100107 public static final String[] SUPPORTED_32_BIT_ABIS =
Torne (Richard Coles)ff701a62014-07-30 12:11:15 +0100108 getStringList("ro.product.cpu.abilist32", ",");
Narayan Kamath0f206a12014-04-12 11:41:13 +0100109
110 /**
111 * An ordered list of <b>64 bit</b> ABIs supported by this device. The most preferred ABI
112 * is the first element in the list.
113 *
114 * See {@link #SUPPORTED_ABIS} and {@link #SUPPORTED_32_BIT_ABIS}.
Narayan Kamath0f206a12014-04-12 11:41:13 +0100115 */
Torne (Richard Coles)da8c0372014-05-14 16:17:26 +0100116 public static final String[] SUPPORTED_64_BIT_ABIS =
Torne (Richard Coles)ff701a62014-07-30 12:11:15 +0100117 getStringList("ro.product.cpu.abilist64", ",");
Narayan Kamath0f206a12014-04-12 11:41:13 +0100118
119
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 /** Various version strings. */
121 public static class VERSION {
122 /**
123 * The internal value used by the underlying source control to
124 * represent this build. E.g., a perforce changelist number
125 * or a git hash.
126 */
127 public static final String INCREMENTAL = getString("ro.build.version.incremental");
128
129 /**
130 * The user-visible version string. E.g., "1.0" or "3.4b5".
131 */
132 public static final String RELEASE = getString("ro.build.version.release");
133
134 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700135 * The user-visible SDK version of the framework in its raw String
136 * representation; use {@link #SDK_INT} instead.
137 *
138 * @deprecated Use {@link #SDK_INT} to easily get this as an integer.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800139 */
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700140 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800141 public static final String SDK = getString("ro.build.version.sdk");
Dianne Hackborn851a5412009-05-08 12:06:44 -0700142
143 /**
144 * The user-visible SDK version of the framework; its possible
145 * values are defined in {@link Build.VERSION_CODES}.
146 */
147 public static final int SDK_INT = SystemProperties.getInt(
148 "ro.build.version.sdk", 0);
149
150 /**
151 * The current development codename, or the string "REL" if this is
152 * a release build.
153 */
154 public static final String CODENAME = getString("ro.build.version.codename");
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800155
Dianne Hackbornffcda102014-04-24 13:06:27 -0700156 private static final String[] ALL_CODENAMES
Torne (Richard Coles)ff701a62014-07-30 12:11:15 +0100157 = getStringList("ro.build.version.all_codenames", ",");
Dianne Hackbornffcda102014-04-24 13:06:27 -0700158
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800159 /**
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800160 * @hide
161 */
Dianne Hackbornffcda102014-04-24 13:06:27 -0700162 public static final String[] ACTIVE_CODENAMES = "REL".equals(ALL_CODENAMES[0])
163 ? new String[0] : ALL_CODENAMES;
164
165 /**
166 * The SDK version to use when accessing resources.
167 * Use the current SDK version code. For every active development codename
168 * we are operating under, we bump the assumed resource platform version by 1.
169 * @hide
170 */
171 public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800172 }
173
Dianne Hackborn851a5412009-05-08 12:06:44 -0700174 /**
175 * Enumeration of the currently known SDK version codes. These are the
176 * values that can be found in {@link VERSION#SDK}. Version numbers
177 * increment monotonically with each official platform release.
178 */
179 public static class VERSION_CODES {
180 /**
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700181 * Magic version number for a current development build, which has
182 * not yet turned into an official release.
183 */
184 public static final int CUR_DEVELOPMENT = 10000;
185
186 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700187 * October 2008: The original, first, version of Android. Yay!
188 */
189 public static final int BASE = 1;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700190
Dianne Hackborn851a5412009-05-08 12:06:44 -0700191 /**
192 * February 2009: First Android update, officially called 1.1.
193 */
194 public static final int BASE_1_1 = 2;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700195
Dianne Hackborn851a5412009-05-08 12:06:44 -0700196 /**
197 * May 2009: Android 1.5.
198 */
199 public static final int CUPCAKE = 3;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700200
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700201 /**
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700202 * September 2009: Android 1.6.
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700203 *
204 * <p>Applications targeting this or a later release will get these
205 * new changes in behavior:</p>
206 * <ul>
207 * <li> They must explicitly request the
San Mehat5a3a77d2009-06-01 09:25:28 -0700208 * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission to be
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700209 * able to modify the contents of the SD card. (Apps targeting
210 * earlier versions will always request the permission.)
Dianne Hackbornfe77ec82009-08-12 16:53:56 -0700211 * <li> They must explicitly request the
212 * {@link android.Manifest.permission#READ_PHONE_STATE} permission to be
213 * able to be able to retrieve phone state info. (Apps targeting
214 * earlier versions will always request the permission.)
215 * <li> They are assumed to support different screen densities and
216 * sizes. (Apps targeting earlier versions are assumed to only support
217 * medium density normal size screens unless otherwise indicated).
218 * They can still explicitly specify screen support either way with the
219 * supports-screens manifest tag.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700220 * <li> {@link android.widget.TabHost} will use the new dark tab
221 * background design.
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700222 * </ul>
223 */
Dianne Hackbornfe77ec82009-08-12 16:53:56 -0700224 public static final int DONUT = 4;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700225
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700226 /**
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700227 * November 2009: Android 2.0
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700228 *
229 * <p>Applications targeting this or a later release will get these
230 * new changes in behavior:</p>
231 * <ul>
232 * <li> The {@link android.app.Service#onStartCommand
233 * Service.onStartCommand} function will return the new
234 * {@link android.app.Service#START_STICKY} behavior instead of the
235 * old compatibility {@link android.app.Service#START_STICKY_COMPATIBILITY}.
Dianne Hackborn8d374262009-09-14 21:21:52 -0700236 * <li> The {@link android.app.Activity} class will now execute back
237 * key presses on the key up instead of key down, to be able to detect
238 * canceled presses from virtual keys.
Mike Cleron76097642009-09-25 17:53:56 -0700239 * <li> The {@link android.widget.TabWidget} class will use a new color scheme
240 * for tabs. In the new scheme, the foreground tab has a medium gray background
241 * the background tabs have a dark gray background.
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700242 * </ul>
243 */
Jeff Hamilton6dc3f4e2009-10-10 12:06:19 -0500244 public static final int ECLAIR = 5;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700245
246 /**
Dianne Hackborn17787762009-11-12 16:11:36 -0800247 * December 2009: Android 2.0.1
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700248 */
Dianne Hackborn17787762009-11-12 16:11:36 -0800249 public static final int ECLAIR_0_1 = 6;
Dianne Hackborn23ef7b42009-11-18 18:20:39 -0800250
251 /**
252 * January 2010: Android 2.1
253 */
254 public static final int ECLAIR_MR1 = 7;
Adam Powell216bccf2010-02-01 15:03:17 -0800255
Dianne Hackborn3e03cfa2010-06-13 12:07:00 -0700256 /**
257 * June 2010: Android 2.2
258 */
Adam Powell216bccf2010-02-01 15:03:17 -0800259 public static final int FROYO = 8;
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700260
Dianne Hackborn3e03cfa2010-06-13 12:07:00 -0700261 /**
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800262 * November 2010: Android 2.3
Dianne Hackborn81e92762011-10-09 16:00:21 -0700263 *
264 * <p>Applications targeting this or a later release will get these
265 * new changes in behavior:</p>
266 * <ul>
267 * <li> The application's notification icons will be shown on the new
268 * dark status bar background, so must be visible in this situation.
269 * </ul>
Dianne Hackborn3e03cfa2010-06-13 12:07:00 -0700270 */
Dianne Hackborn4fa1a222010-10-18 13:10:49 -0700271 public static final int GINGERBREAD = 9;
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800272
273 /**
Dianne Hackbornedf1fc62011-03-17 18:34:48 -0700274 * February 2011: Android 2.3.3.
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800275 */
276 public static final int GINGERBREAD_MR1 = 10;
Dianne Hackbornb1ad5972010-08-02 17:30:33 -0700277
278 /**
Dianne Hackbornedf1fc62011-03-17 18:34:48 -0700279 * February 2011: Android 3.0.
Dianne Hackbornb1ad5972010-08-02 17:30:33 -0700280 *
281 * <p>Applications targeting this or a later release will get these
282 * new changes in behavior:</p>
283 * <ul>
Dianne Hackborn3e6d50c2010-08-23 18:30:44 -0700284 * <li> The default theme for applications is now dark holographic:
285 * {@link android.R.style#Theme_Holo}.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700286 * <li> On large screen devices that do not have a physical menu
287 * button, the soft (compatibility) menu is disabled.
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800288 * <li> The activity lifecycle has changed slightly as per
289 * {@link android.app.Activity}.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700290 * <li> An application will crash if it does not call through
291 * to the super implementation of its
292 * {@link android.app.Activity#onPause Activity.onPause()} method.
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800293 * <li> When an application requires a permission to access one of
Dianne Hackborn6c2c5fc2011-01-18 17:02:33 -0800294 * its components (activity, receiver, service, provider), this
295 * permission is no longer enforced when the application wants to
296 * access its own component. This means it can require a permission
297 * on a component that it does not itself hold and still access that
298 * component.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700299 * <li> {@link android.content.Context#getSharedPreferences
300 * Context.getSharedPreferences()} will not automatically reload
301 * the preferences if they have changed on storage, unless
302 * {@link android.content.Context#MODE_MULTI_PROCESS} is used.
303 * <li> {@link android.view.ViewGroup#setMotionEventSplittingEnabled}
304 * will default to true.
305 * <li> {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH}
306 * is enabled by default on windows.
307 * <li> {@link android.widget.PopupWindow#isSplitTouchEnabled()
308 * PopupWindow.isSplitTouchEnabled()} will return true by default.
309 * <li> {@link android.widget.GridView} and {@link android.widget.ListView}
310 * will use {@link android.view.View#setActivated View.setActivated}
311 * for selected items if they do not implement {@link android.widget.Checkable}.
312 * <li> {@link android.widget.Scroller} will be constructed with
313 * "flywheel" behavior enabled by default.
Dianne Hackbornb1ad5972010-08-02 17:30:33 -0700314 * </ul>
315 */
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800316 public static final int HONEYCOMB = 11;
Dianne Hackbornedf1fc62011-03-17 18:34:48 -0700317
318 /**
Dianne Hackborna8138732011-05-12 15:45:21 -0700319 * May 2011: Android 3.1.
Dianne Hackbornedf1fc62011-03-17 18:34:48 -0700320 */
321 public static final int HONEYCOMB_MR1 = 12;
Dianne Hackborna8138732011-05-12 15:45:21 -0700322
323 /**
Dianne Hackborn426431a2011-06-09 11:29:08 -0700324 * June 2011: Android 3.2.
Dianne Hackborne6676352011-06-01 16:51:20 -0700325 *
326 * <p>Update to Honeycomb MR1 to support 7 inch tablets, improve
327 * screen compatibility mode, etc.</p>
328 *
329 * <p>As of this version, applications that don't say whether they
330 * support XLARGE screens will be assumed to do so only if they target
331 * {@link #HONEYCOMB} or later; it had been {@link #GINGERBREAD} or
332 * later. Applications that don't support a screen size at least as
333 * large as the current screen will provide the user with a UI to
334 * switch them in to screen size compatibility mode.</p>
Dianne Hackborne289bff2011-06-13 19:33:22 -0700335 *
336 * <p>This version introduces new screen size resource qualifiers
337 * based on the screen size in dp: see
338 * {@link android.content.res.Configuration#screenWidthDp},
339 * {@link android.content.res.Configuration#screenHeightDp}, and
340 * {@link android.content.res.Configuration#smallestScreenWidthDp}.
341 * Supplying these in &lt;supports-screens&gt; as per
342 * {@link android.content.pm.ApplicationInfo#requiresSmallestWidthDp},
343 * {@link android.content.pm.ApplicationInfo#compatibleWidthLimitDp}, and
344 * {@link android.content.pm.ApplicationInfo#largestWidthLimitDp} is
345 * preferred over the older screen size buckets and for older devices
346 * the appropriate buckets will be inferred from them.</p>
347 *
Dianne Hackborn81e92762011-10-09 16:00:21 -0700348 * <p>Applications targeting this or a later release will get these
349 * new changes in behavior:</p>
350 * <ul>
351 * <li><p>New {@link android.content.pm.PackageManager#FEATURE_SCREEN_PORTRAIT}
Dianne Hackborne289bff2011-06-13 19:33:22 -0700352 * and {@link android.content.pm.PackageManager#FEATURE_SCREEN_LANDSCAPE}
Dianne Hackborn81e92762011-10-09 16:00:21 -0700353 * features were introduced in this release. Applications that target
Dianne Hackborne289bff2011-06-13 19:33:22 -0700354 * previous platform versions are assumed to require both portrait and
355 * landscape support in the device; when targeting Honeycomb MR1 or
356 * greater the application is responsible for specifying any specific
357 * orientation it requires.</p>
Dianne Hackborn81e92762011-10-09 16:00:21 -0700358 * <li><p>{@link android.os.AsyncTask} will use the serial executor
359 * by default when calling {@link android.os.AsyncTask#execute}.</p>
360 * <li><p>{@link android.content.pm.ActivityInfo#configChanges
361 * ActivityInfo.configChanges} will have the
362 * {@link android.content.pm.ActivityInfo#CONFIG_SCREEN_SIZE} and
363 * {@link android.content.pm.ActivityInfo#CONFIG_SMALLEST_SCREEN_SIZE}
364 * bits set; these need to be cleared for older applications because
365 * some developers have done absolute comparisons against this value
366 * instead of correctly masking the bits they are interested in.
367 * </ul>
Dianne Hackborna8138732011-05-12 15:45:21 -0700368 */
Dianne Hackborn426431a2011-06-09 11:29:08 -0700369 public static final int HONEYCOMB_MR2 = 13;
Dianne Hackborn3fc982f2011-03-30 16:20:26 -0700370
371 /**
Dianne Hackbornf35fe232011-11-01 19:25:20 -0700372 * October 2011: Android 4.0.
Dianne Hackborn2d6833b2011-06-24 16:04:19 -0700373 *
374 * <p>Applications targeting this or a later release will get these
375 * new changes in behavior:</p>
376 * <ul>
Dianne Hackborn9d0e37e2011-09-22 12:58:54 -0700377 * <li> For devices without a dedicated menu key, the software compatibility
378 * menu key will not be shown even on phones. By targeting Ice Cream Sandwich
379 * or later, your UI must always have its own menu UI affordance if needed,
380 * on both tablets and phones. The ActionBar will take care of this for you.
Dianne Hackborn2d6833b2011-06-24 16:04:19 -0700381 * <li> 2d drawing hardware acceleration is now turned on by default.
382 * You can use
383 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
384 * to turn it off if needed, although this is strongly discouraged since
385 * it will result in poor performance on larger screen devices.
Adam Powell6e90a362011-08-14 16:48:32 -0700386 * <li> The default theme for applications is now the "device default" theme:
387 * {@link android.R.style#Theme_DeviceDefault}. This may be the
388 * holo dark theme or a different dark theme defined by the specific device.
389 * The {@link android.R.style#Theme_Holo} family must not be modified
390 * for a device to be considered compatible. Applications that explicitly
391 * request a theme from the Holo family will be guaranteed that these themes
392 * will not change character within the same platform version. Applications
393 * that wish to blend in with the device should use a theme from the
394 * {@link android.R.style#Theme_DeviceDefault} family.
Dianne Hackborn9d0e37e2011-09-22 12:58:54 -0700395 * <li> Managed cursors can now throw an exception if you directly close
396 * the cursor yourself without stopping the management of it; previously failures
397 * would be silently ignored.
398 * <li> The fadingEdge attribute on views will be ignored (fading edges is no
399 * longer a standard part of the UI). A new requiresFadingEdge attribute allows
400 * applications to still force fading edges on for special cases.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700401 * <li> {@link android.content.Context#bindService Context.bindService()}
402 * will not automatically add in {@link android.content.Context#BIND_WAIVE_PRIORITY}.
403 * <li> App Widgets will have standard padding automatically added around
404 * them, rather than relying on the padding being baked into the widget itself.
405 * <li> An exception will be thrown if you try to change the type of a
406 * window after it has been added to the window manager. Previously this
407 * would result in random incorrect behavior.
408 * <li> {@link android.view.animation.AnimationSet} will parse out
409 * the duration, fillBefore, fillAfter, repeatMode, and startOffset
410 * XML attributes that are defined.
411 * <li> {@link android.app.ActionBar#setHomeButtonEnabled
412 * ActionBar.setHomeButtonEnabled()} is false by default.
Dianne Hackborn2d6833b2011-06-24 16:04:19 -0700413 * </ul>
Dianne Hackborn3fc982f2011-03-30 16:20:26 -0700414 */
Dianne Hackborn0784cfb2011-09-14 13:48:15 -0700415 public static final int ICE_CREAM_SANDWICH = 14;
Dianne Hackbornf35fe232011-11-01 19:25:20 -0700416
417 /**
Dianne Hackborn81e92762011-10-09 16:00:21 -0700418 * December 2011: Android 4.0.3.
Dianne Hackbornf35fe232011-11-01 19:25:20 -0700419 */
420 public static final int ICE_CREAM_SANDWICH_MR1 = 15;
Dianne Hackborn81e92762011-10-09 16:00:21 -0700421
422 /**
Dianne Hackborn435cdb42012-07-30 17:36:43 -0700423 * June 2012: Android 4.1.
Dianne Hackborn65696252012-03-05 18:49:21 -0800424 *
425 * <p>Applications targeting this or a later release will get these
426 * new changes in behavior:</p>
427 * <ul>
Dianne Hackborn636fd522012-06-05 17:38:50 -0700428 * <li> You must explicitly request the {@link android.Manifest.permission#READ_CALL_LOG}
429 * and/or {@link android.Manifest.permission#WRITE_CALL_LOG} permissions;
430 * access to the call log is no longer implicitly provided through
431 * {@link android.Manifest.permission#READ_CONTACTS} and
432 * {@link android.Manifest.permission#WRITE_CONTACTS}.
433 * <li> {@link android.widget.RemoteViews} will throw an exception if
434 * setting an onClick handler for views being generated by a
435 * {@link android.widget.RemoteViewsService} for a collection container;
436 * previously this just resulted in a warning log message.
437 * <li> New {@link android.app.ActionBar} policy for embedded tabs:
438 * embedded tabs are now always stacked in the action bar when in portrait
439 * mode, regardless of the size of the screen.
440 * <li> {@link android.webkit.WebSettings#setAllowFileAccessFromFileURLs(boolean)
441 * WebSettings.setAllowFileAccessFromFileURLs} and
442 * {@link android.webkit.WebSettings#setAllowUniversalAccessFromFileURLs(boolean)
443 * WebSettings.setAllowUniversalAccessFromFileURLs} default to false.
Dianne Hackborn65696252012-03-05 18:49:21 -0800444 * <li> Calls to {@link android.content.pm.PackageManager#setComponentEnabledSetting
445 * PackageManager.setComponentEnabledSetting} will now throw an
446 * IllegalArgumentException if the given component class name does not
447 * exist in the application's manifest.
Dianne Hackborn636fd522012-06-05 17:38:50 -0700448 * <li> {@link android.nfc.NfcAdapter#setNdefPushMessage
449 * NfcAdapter.setNdefPushMessage},
450 * {@link android.nfc.NfcAdapter#setNdefPushMessageCallback
451 * NfcAdapter.setNdefPushMessageCallback} and
452 * {@link android.nfc.NfcAdapter#setOnNdefPushCompleteCallback
453 * NfcAdapter.setOnNdefPushCompleteCallback} will throw
454 * IllegalStateException if called after the Activity has been destroyed.
455 * <li> Accessibility services must require the new
456 * {@link android.Manifest.permission#BIND_ACCESSIBILITY_SERVICE} permission or
457 * they will not be available for use.
458 * <li> {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_INCLUDE_NOT_IMPORTANT_VIEWS
459 * AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS} must be set
460 * for unimportant views to be included in queries.
Dianne Hackborn65696252012-03-05 18:49:21 -0800461 * </ul>
Dianne Hackborn81e92762011-10-09 16:00:21 -0700462 */
Dianne Hackbornfa61f0b2012-05-09 21:49:38 -0700463 public static final int JELLY_BEAN = 16;
Dianne Hackborn435cdb42012-07-30 17:36:43 -0700464
465 /**
Dianne Hackbornfc494742012-09-27 16:15:42 -0700466 * Android 4.2: Moar jelly beans!
Nick Kralevichf097b162012-07-28 12:43:48 -0700467 *
468 * <p>Applications targeting this or a later release will get these
469 * new changes in behavior:</p>
470 * <ul>
471 * <li>Content Providers: The default value of {@code android:exported} is now
472 * {@code false}. See
Nick Kralevich2caec6c2012-08-08 11:33:17 -0700473 * <a href="{@docRoot}guide/topics/manifest/provider-element.html#exported">
Nick Kralevichf097b162012-07-28 12:43:48 -0700474 * the android:exported section</a> in the provider documentation for more details.</li>
Dianne Hackbornfc494742012-09-27 16:15:42 -0700475 * <li>{@link android.view.View#getLayoutDirection() View.getLayoutDirection()}
476 * can return different values than {@link android.view.View#LAYOUT_DIRECTION_LTR}
477 * based on the locale etc.
478 * <li> {@link android.webkit.WebView#addJavascriptInterface(Object, String)
479 * WebView.addJavascriptInterface} requires explicit annotations on methods
480 * for them to be accessible from Javascript.
Nick Kralevichf097b162012-07-28 12:43:48 -0700481 * </ul>
Dianne Hackborn435cdb42012-07-30 17:36:43 -0700482 */
483 public static final int JELLY_BEAN_MR1 = 17;
Nick Kralevicha985c3b2013-01-09 16:03:14 -0800484
485 /**
Dianne Hackbornd2eeed62013-04-22 13:04:28 -0700486 * Android 4.3: Jelly Bean MR2, the revenge of the beans.
Nick Kralevicha985c3b2013-01-09 16:03:14 -0800487 */
Dianne Hackbornd2eeed62013-04-22 13:04:28 -0700488 public static final int JELLY_BEAN_MR2 = 18;
Dianne Hackborn5d2bfa12013-03-05 10:28:34 -0800489
490 /**
Dianne Hackborn6bc37892013-10-03 11:05:14 -0700491 * Android 4.4: KitKat, another tasty treat.
Dianne Hackborn221ea892013-08-04 16:50:16 -0700492 *
493 * <p>Applications targeting this or a later release will get these
494 * new changes in behavior:</p>
495 * <ul>
Dianne Hackborn6bc37892013-10-03 11:05:14 -0700496 * <li> The default result of {android.preference.PreferenceActivity#isValidFragment
497 * PreferenceActivity.isValueFragment} becomes false instead of true.</li>
498 * <li> In {@link android.webkit.WebView}, apps targeting earlier versions will have
499 * JS URLs evaluated directly and any result of the evaluation will not replace
500 * the current page content. Apps targetting KITKAT or later that load a JS URL will
501 * have the result of that URL replace the content of the current page</li>
502 * <li> {@link android.app.AlarmManager#set AlarmManager.set} becomes interpreted as
503 * an inexact value, to give the system more flexibility in scheduling alarms.</li>
504 * <li> {@link android.content.Context#getSharedPreferences(String, int)
505 * Context.getSharedPreferences} no longer allows a null name.</li>
506 * <li> {@link android.widget.RelativeLayout} changes to compute wrapped content
507 * margins correctly.</li>
508 * <li> {@link android.app.ActionBar}'s window content overlay is allowed to be
509 * drawn.</li>
Jeff Sharkey3ec2f602013-10-29 12:21:23 -0700510 * <li>The {@link android.Manifest.permission#READ_EXTERNAL_STORAGE}
511 * permission is now always enforced.</li>
512 * <li>Access to package-specific external storage directories belonging
513 * to the calling app no longer requires the
514 * {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} or
515 * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE}
516 * permissions.</li>
Dianne Hackborn221ea892013-08-04 16:50:16 -0700517 * </ul>
Dianne Hackborn5d2bfa12013-03-05 10:28:34 -0800518 */
Dianne Hackborn6bc37892013-10-03 11:05:14 -0700519 public static final int KITKAT = 19;
Dianne Hackborn10ad9822014-03-17 11:28:36 -0700520
521 /**
Justin Koh78b94de2014-05-13 15:48:42 -0700522 * Android 4.4W: KitKat for watches, snacks on the run.
523 *
524 * <p>Applications targeting this or a later release will get these
525 * new changes in behavior:</p>
526 * <ul>
527 * <li>{@link android.app.AlertDialog} might not have a default background if the theme does
528 * not specify one.</li>
529 * </ul>
Jeff Brown1c3f3322014-04-16 13:15:22 -0700530 */
Justin Koh78b94de2014-05-13 15:48:42 -0700531 public static final int KITKAT_WATCH = 20;
Jeff Brown047f3c72014-04-16 14:18:49 -0700532
533 /**
Dianne Hackborn10ad9822014-03-17 11:28:36 -0700534 * L!
535 *
536 * <p>Applications targeting this or a later release will get these
537 * new changes in behavior:</p>
538 * <ul>
539 * <li> {@link android.content.Context#bindService Context.bindService} now
Michael Wright5b5def52014-04-11 13:37:50 -0700540 * requires an explicit Intent, and will throw an exception if given an implicit
Dianne Hackborn10ad9822014-03-17 11:28:36 -0700541 * Intent.</li>
542 * </ul>
543 */
Dianne Hackborn521e4bd2014-09-04 14:50:26 -0700544 public static final int L = 21;
Dianne Hackborn851a5412009-05-08 12:06:44 -0700545 }
546
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800547 /** The type of build, like "user" or "eng". */
548 public static final String TYPE = getString("ro.build.type");
549
550 /** Comma-separated tags describing the build, like "unsigned,debug". */
551 public static final String TAGS = getString("ro.build.tags");
552
553 /** A string that uniquely identifies this build. Do not attempt to parse this value. */
Jeff Sharkey55687722014-04-09 18:07:19 -0700554 public static final String FINGERPRINT = deriveFingerprint();
555
556 /**
557 * Some devices split the fingerprint components between multiple
558 * partitions, so we might derive the fingerprint at runtime.
559 */
560 private static String deriveFingerprint() {
561 String finger = SystemProperties.get("ro.build.fingerprint");
562 if (TextUtils.isEmpty(finger)) {
563 finger = getString("ro.product.brand") + '/' +
564 getString("ro.product.name") + '/' +
565 getString("ro.product.device") + ':' +
566 getString("ro.build.version.release") + '/' +
567 getString("ro.build.id") + '/' +
568 getString("ro.build.version.incremental") + ':' +
569 getString("ro.build.type") + '/' +
570 getString("ro.build.tags");
571 }
572 return finger;
573 }
574
575 /**
576 * Ensure that raw fingerprint system property is defined. If it was derived
577 * dynamically by {@link #deriveFingerprint()} this is where we push the
578 * derived value into the property service.
579 *
580 * @hide
581 */
582 public static void ensureFingerprintProperty() {
583 if (TextUtils.isEmpty(SystemProperties.get("ro.build.fingerprint"))) {
Jeff Sharkeybdd44912014-04-11 16:30:14 -0700584 try {
585 SystemProperties.set("ro.build.fingerprint", FINGERPRINT);
586 } catch (IllegalArgumentException e) {
587 Slog.e(TAG, "Failed to set fingerprint property", e);
588 }
Jeff Sharkey55687722014-04-09 18:07:19 -0700589 }
590 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800591
592 // The following properties only make sense for internal engineering builds.
593 public static final long TIME = getLong("ro.build.date.utc") * 1000;
594 public static final String USER = getString("ro.build.user");
595 public static final String HOST = getString("ro.build.host");
596
Doug Zongkerad2171a2011-06-14 11:07:24 -0700597 /**
Jeff Brown89101cd2011-10-27 21:24:54 -0700598 * Returns true if we are running a debug build such as "user-debug" or "eng".
599 * @hide
600 */
601 public static final boolean IS_DEBUGGABLE =
602 SystemProperties.getInt("ro.debuggable", 0) == 1;
603
604 /**
Doug Zongkerad2171a2011-06-14 11:07:24 -0700605 * Returns the version string for the radio firmware. May return
606 * null (if, for instance, the radio is not currently on).
607 */
608 public static String getRadioVersion() {
609 return SystemProperties.get(TelephonyProperties.PROPERTY_BASEBAND_VERSION, null);
610 }
611
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800612 private static String getString(String property) {
613 return SystemProperties.get(property, UNKNOWN);
614 }
615
Torne (Richard Coles)ff701a62014-07-30 12:11:15 +0100616 private static String[] getStringList(String property, String separator) {
617 String value = SystemProperties.get(property);
618 if (value.isEmpty()) {
619 return new String[0];
620 } else {
621 return value.split(separator);
622 }
623 }
624
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800625 private static long getLong(String property) {
626 try {
627 return Long.parseLong(SystemProperties.get(property));
628 } catch (NumberFormatException e) {
629 return -1;
630 }
631 }
632}