blob: 11e379523bc2bce2253f4eefb139250649db6238 [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
Doug Zongkerad2171a2011-06-14 11:07:24 -070019import com.android.internal.telephony.TelephonyProperties;
20
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021/**
22 * Information about the current build, extracted from system properties.
23 */
24public class Build {
25 /** Value used for when a build property is unknown. */
Ficus Kirkpatrick71de7852010-01-08 13:10:51 -080026 public static final String UNKNOWN = "unknown";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027
28 /** Either a changelist number, or a label like "M4-rc20". */
29 public static final String ID = getString("ro.build.id");
30
31 /** A build ID string meant for displaying to the user */
32 public static final String DISPLAY = getString("ro.build.display.id");
33
34 /** The name of the overall product. */
35 public static final String PRODUCT = getString("ro.product.name");
36
37 /** The name of the industrial design. */
38 public static final String DEVICE = getString("ro.product.device");
39
40 /** The name of the underlying board, like "goldfish". */
41 public static final String BOARD = getString("ro.product.board");
42
Dianne Hackbornb1811182009-05-21 15:45:42 -070043 /** The name of the instruction set (CPU type + ABI convention) of native code. */
44 public static final String CPU_ABI = getString("ro.product.cpu.abi");
45
Ficus Kirkpatrickfa9cafa2010-01-06 17:37:13 -080046 /** The name of the second instruction set (CPU type + ABI convention) of native code. */
47 public static final String CPU_ABI2 = getString("ro.product.cpu.abi2");
48
Dianne Hackbornd62ad4f2009-05-19 19:06:25 -070049 /** The manufacturer of the product/hardware. */
50 public static final String MANUFACTURER = getString("ro.product.manufacturer");
51
Dirk Dougherty491b40d2013-10-29 18:33:29 -070052 /** The consumer-visible brand with which the product/hardware will be associated, if any. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080053 public static final String BRAND = getString("ro.product.brand");
54
55 /** The end-user-visible name for the end product. */
56 public static final String MODEL = getString("ro.product.model");
57
Doug Zongker74885ef2010-02-02 17:39:26 -080058 /** The system bootloader version number. */
Dan Egnor42471dd2010-01-07 17:25:22 -080059 public static final String BOOTLOADER = getString("ro.bootloader");
60
Doug Zongkerad2171a2011-06-14 11:07:24 -070061 /**
62 * The radio firmware version number.
63 *
64 * @deprecated The radio firmware version is frequently not
65 * available when this class is initialized, leading to a blank or
66 * "unknown" value for this string. Use
67 * {@link #getRadioVersion} instead.
68 */
69 @Deprecated
70 public static final String RADIO = getString(TelephonyProperties.PROPERTY_BASEBAND_VERSION);
Dan Egnor42471dd2010-01-07 17:25:22 -080071
Doug Zongker74885ef2010-02-02 17:39:26 -080072 /** The name of the hardware (from the kernel command line or /proc). */
73 public static final String HARDWARE = getString("ro.hardware");
Dan Egnor42471dd2010-01-07 17:25:22 -080074
Doug Zongker7d2e3df2010-08-11 16:58:04 -070075 /** A hardware serial number, if available. Alphanumeric only, case-insensitive. */
76 public static final String SERIAL = getString("ro.serialno");
Ramin Zaghi1378aba2014-02-28 15:03:19 +000077
78 /**
79 * A list of ABIs (in priority) order supported by this device.
80 *
81 * @hide
82 */
83 public static final String[] SUPPORTED_ABIS = getString("ro.product.cpu.abilist").split(",");
84
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085 /** Various version strings. */
86 public static class VERSION {
87 /**
88 * The internal value used by the underlying source control to
89 * represent this build. E.g., a perforce changelist number
90 * or a git hash.
91 */
92 public static final String INCREMENTAL = getString("ro.build.version.incremental");
93
94 /**
95 * The user-visible version string. E.g., "1.0" or "3.4b5".
96 */
97 public static final String RELEASE = getString("ro.build.version.release");
98
99 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700100 * The user-visible SDK version of the framework in its raw String
101 * representation; use {@link #SDK_INT} instead.
102 *
103 * @deprecated Use {@link #SDK_INT} to easily get this as an integer.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800104 */
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700105 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106 public static final String SDK = getString("ro.build.version.sdk");
Dianne Hackborn851a5412009-05-08 12:06:44 -0700107
108 /**
109 * The user-visible SDK version of the framework; its possible
110 * values are defined in {@link Build.VERSION_CODES}.
111 */
112 public static final int SDK_INT = SystemProperties.getInt(
113 "ro.build.version.sdk", 0);
114
115 /**
116 * The current development codename, or the string "REL" if this is
117 * a release build.
118 */
119 public static final String CODENAME = getString("ro.build.version.codename");
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800120
Dianne Hackbornffcda102014-04-24 13:06:27 -0700121 private static final String[] ALL_CODENAMES
122 = getString("ro.build.version.all_codenames").split(",");
123
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800124 /**
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800125 * @hide
126 */
Dianne Hackbornffcda102014-04-24 13:06:27 -0700127 public static final String[] ACTIVE_CODENAMES = "REL".equals(ALL_CODENAMES[0])
128 ? new String[0] : ALL_CODENAMES;
129
130 /**
131 * The SDK version to use when accessing resources.
132 * Use the current SDK version code. For every active development codename
133 * we are operating under, we bump the assumed resource platform version by 1.
134 * @hide
135 */
136 public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800137 }
138
Dianne Hackborn851a5412009-05-08 12:06:44 -0700139 /**
140 * Enumeration of the currently known SDK version codes. These are the
141 * values that can be found in {@link VERSION#SDK}. Version numbers
142 * increment monotonically with each official platform release.
143 */
144 public static class VERSION_CODES {
145 /**
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700146 * Magic version number for a current development build, which has
147 * not yet turned into an official release.
148 */
149 public static final int CUR_DEVELOPMENT = 10000;
150
151 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700152 * October 2008: The original, first, version of Android. Yay!
153 */
154 public static final int BASE = 1;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700155
Dianne Hackborn851a5412009-05-08 12:06:44 -0700156 /**
157 * February 2009: First Android update, officially called 1.1.
158 */
159 public static final int BASE_1_1 = 2;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700160
Dianne Hackborn851a5412009-05-08 12:06:44 -0700161 /**
162 * May 2009: Android 1.5.
163 */
164 public static final int CUPCAKE = 3;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700165
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700166 /**
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700167 * September 2009: Android 1.6.
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700168 *
169 * <p>Applications targeting this or a later release will get these
170 * new changes in behavior:</p>
171 * <ul>
172 * <li> They must explicitly request the
San Mehat5a3a77d2009-06-01 09:25:28 -0700173 * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission to be
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700174 * able to modify the contents of the SD card. (Apps targeting
175 * earlier versions will always request the permission.)
Dianne Hackbornfe77ec82009-08-12 16:53:56 -0700176 * <li> They must explicitly request the
177 * {@link android.Manifest.permission#READ_PHONE_STATE} permission to be
178 * able to be able to retrieve phone state info. (Apps targeting
179 * earlier versions will always request the permission.)
180 * <li> They are assumed to support different screen densities and
181 * sizes. (Apps targeting earlier versions are assumed to only support
182 * medium density normal size screens unless otherwise indicated).
183 * They can still explicitly specify screen support either way with the
184 * supports-screens manifest tag.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700185 * <li> {@link android.widget.TabHost} will use the new dark tab
186 * background design.
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700187 * </ul>
188 */
Dianne Hackbornfe77ec82009-08-12 16:53:56 -0700189 public static final int DONUT = 4;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700190
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700191 /**
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700192 * November 2009: Android 2.0
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700193 *
194 * <p>Applications targeting this or a later release will get these
195 * new changes in behavior:</p>
196 * <ul>
197 * <li> The {@link android.app.Service#onStartCommand
198 * Service.onStartCommand} function will return the new
199 * {@link android.app.Service#START_STICKY} behavior instead of the
200 * old compatibility {@link android.app.Service#START_STICKY_COMPATIBILITY}.
Dianne Hackborn8d374262009-09-14 21:21:52 -0700201 * <li> The {@link android.app.Activity} class will now execute back
202 * key presses on the key up instead of key down, to be able to detect
203 * canceled presses from virtual keys.
Mike Cleron76097642009-09-25 17:53:56 -0700204 * <li> The {@link android.widget.TabWidget} class will use a new color scheme
205 * for tabs. In the new scheme, the foreground tab has a medium gray background
206 * the background tabs have a dark gray background.
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700207 * </ul>
208 */
Jeff Hamilton6dc3f4e2009-10-10 12:06:19 -0500209 public static final int ECLAIR = 5;
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700210
211 /**
Dianne Hackborn17787762009-11-12 16:11:36 -0800212 * December 2009: Android 2.0.1
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700213 */
Dianne Hackborn17787762009-11-12 16:11:36 -0800214 public static final int ECLAIR_0_1 = 6;
Dianne Hackborn23ef7b42009-11-18 18:20:39 -0800215
216 /**
217 * January 2010: Android 2.1
218 */
219 public static final int ECLAIR_MR1 = 7;
Adam Powell216bccf2010-02-01 15:03:17 -0800220
Dianne Hackborn3e03cfa2010-06-13 12:07:00 -0700221 /**
222 * June 2010: Android 2.2
223 */
Adam Powell216bccf2010-02-01 15:03:17 -0800224 public static final int FROYO = 8;
Dianne Hackborn14cee9f2010-04-23 17:51:26 -0700225
Dianne Hackborn3e03cfa2010-06-13 12:07:00 -0700226 /**
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800227 * November 2010: Android 2.3
Dianne Hackborn81e92762011-10-09 16:00:21 -0700228 *
229 * <p>Applications targeting this or a later release will get these
230 * new changes in behavior:</p>
231 * <ul>
232 * <li> The application's notification icons will be shown on the new
233 * dark status bar background, so must be visible in this situation.
234 * </ul>
Dianne Hackborn3e03cfa2010-06-13 12:07:00 -0700235 */
Dianne Hackborn4fa1a222010-10-18 13:10:49 -0700236 public static final int GINGERBREAD = 9;
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800237
238 /**
Dianne Hackbornedf1fc62011-03-17 18:34:48 -0700239 * February 2011: Android 2.3.3.
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800240 */
241 public static final int GINGERBREAD_MR1 = 10;
Dianne Hackbornb1ad5972010-08-02 17:30:33 -0700242
243 /**
Dianne Hackbornedf1fc62011-03-17 18:34:48 -0700244 * February 2011: Android 3.0.
Dianne Hackbornb1ad5972010-08-02 17:30:33 -0700245 *
246 * <p>Applications targeting this or a later release will get these
247 * new changes in behavior:</p>
248 * <ul>
Dianne Hackborn3e6d50c2010-08-23 18:30:44 -0700249 * <li> The default theme for applications is now dark holographic:
250 * {@link android.R.style#Theme_Holo}.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700251 * <li> On large screen devices that do not have a physical menu
252 * button, the soft (compatibility) menu is disabled.
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800253 * <li> The activity lifecycle has changed slightly as per
254 * {@link android.app.Activity}.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700255 * <li> An application will crash if it does not call through
256 * to the super implementation of its
257 * {@link android.app.Activity#onPause Activity.onPause()} method.
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800258 * <li> When an application requires a permission to access one of
Dianne Hackborn6c2c5fc2011-01-18 17:02:33 -0800259 * its components (activity, receiver, service, provider), this
260 * permission is no longer enforced when the application wants to
261 * access its own component. This means it can require a permission
262 * on a component that it does not itself hold and still access that
263 * component.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700264 * <li> {@link android.content.Context#getSharedPreferences
265 * Context.getSharedPreferences()} will not automatically reload
266 * the preferences if they have changed on storage, unless
267 * {@link android.content.Context#MODE_MULTI_PROCESS} is used.
268 * <li> {@link android.view.ViewGroup#setMotionEventSplittingEnabled}
269 * will default to true.
270 * <li> {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH}
271 * is enabled by default on windows.
272 * <li> {@link android.widget.PopupWindow#isSplitTouchEnabled()
273 * PopupWindow.isSplitTouchEnabled()} will return true by default.
274 * <li> {@link android.widget.GridView} and {@link android.widget.ListView}
275 * will use {@link android.view.View#setActivated View.setActivated}
276 * for selected items if they do not implement {@link android.widget.Checkable}.
277 * <li> {@link android.widget.Scroller} will be constructed with
278 * "flywheel" behavior enabled by default.
Dianne Hackbornb1ad5972010-08-02 17:30:33 -0700279 * </ul>
280 */
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800281 public static final int HONEYCOMB = 11;
Dianne Hackbornedf1fc62011-03-17 18:34:48 -0700282
283 /**
Dianne Hackborna8138732011-05-12 15:45:21 -0700284 * May 2011: Android 3.1.
Dianne Hackbornedf1fc62011-03-17 18:34:48 -0700285 */
286 public static final int HONEYCOMB_MR1 = 12;
Dianne Hackborna8138732011-05-12 15:45:21 -0700287
288 /**
Dianne Hackborn426431a2011-06-09 11:29:08 -0700289 * June 2011: Android 3.2.
Dianne Hackborne6676352011-06-01 16:51:20 -0700290 *
291 * <p>Update to Honeycomb MR1 to support 7 inch tablets, improve
292 * screen compatibility mode, etc.</p>
293 *
294 * <p>As of this version, applications that don't say whether they
295 * support XLARGE screens will be assumed to do so only if they target
296 * {@link #HONEYCOMB} or later; it had been {@link #GINGERBREAD} or
297 * later. Applications that don't support a screen size at least as
298 * large as the current screen will provide the user with a UI to
299 * switch them in to screen size compatibility mode.</p>
Dianne Hackborne289bff2011-06-13 19:33:22 -0700300 *
301 * <p>This version introduces new screen size resource qualifiers
302 * based on the screen size in dp: see
303 * {@link android.content.res.Configuration#screenWidthDp},
304 * {@link android.content.res.Configuration#screenHeightDp}, and
305 * {@link android.content.res.Configuration#smallestScreenWidthDp}.
306 * Supplying these in &lt;supports-screens&gt; as per
307 * {@link android.content.pm.ApplicationInfo#requiresSmallestWidthDp},
308 * {@link android.content.pm.ApplicationInfo#compatibleWidthLimitDp}, and
309 * {@link android.content.pm.ApplicationInfo#largestWidthLimitDp} is
310 * preferred over the older screen size buckets and for older devices
311 * the appropriate buckets will be inferred from them.</p>
312 *
Dianne Hackborn81e92762011-10-09 16:00:21 -0700313 * <p>Applications targeting this or a later release will get these
314 * new changes in behavior:</p>
315 * <ul>
316 * <li><p>New {@link android.content.pm.PackageManager#FEATURE_SCREEN_PORTRAIT}
Dianne Hackborne289bff2011-06-13 19:33:22 -0700317 * and {@link android.content.pm.PackageManager#FEATURE_SCREEN_LANDSCAPE}
Dianne Hackborn81e92762011-10-09 16:00:21 -0700318 * features were introduced in this release. Applications that target
Dianne Hackborne289bff2011-06-13 19:33:22 -0700319 * previous platform versions are assumed to require both portrait and
320 * landscape support in the device; when targeting Honeycomb MR1 or
321 * greater the application is responsible for specifying any specific
322 * orientation it requires.</p>
Dianne Hackborn81e92762011-10-09 16:00:21 -0700323 * <li><p>{@link android.os.AsyncTask} will use the serial executor
324 * by default when calling {@link android.os.AsyncTask#execute}.</p>
325 * <li><p>{@link android.content.pm.ActivityInfo#configChanges
326 * ActivityInfo.configChanges} will have the
327 * {@link android.content.pm.ActivityInfo#CONFIG_SCREEN_SIZE} and
328 * {@link android.content.pm.ActivityInfo#CONFIG_SMALLEST_SCREEN_SIZE}
329 * bits set; these need to be cleared for older applications because
330 * some developers have done absolute comparisons against this value
331 * instead of correctly masking the bits they are interested in.
332 * </ul>
Dianne Hackborna8138732011-05-12 15:45:21 -0700333 */
Dianne Hackborn426431a2011-06-09 11:29:08 -0700334 public static final int HONEYCOMB_MR2 = 13;
Dianne Hackborn3fc982f2011-03-30 16:20:26 -0700335
336 /**
Dianne Hackbornf35fe232011-11-01 19:25:20 -0700337 * October 2011: Android 4.0.
Dianne Hackborn2d6833b2011-06-24 16:04:19 -0700338 *
339 * <p>Applications targeting this or a later release will get these
340 * new changes in behavior:</p>
341 * <ul>
Dianne Hackborn9d0e37e2011-09-22 12:58:54 -0700342 * <li> For devices without a dedicated menu key, the software compatibility
343 * menu key will not be shown even on phones. By targeting Ice Cream Sandwich
344 * or later, your UI must always have its own menu UI affordance if needed,
345 * on both tablets and phones. The ActionBar will take care of this for you.
Dianne Hackborn2d6833b2011-06-24 16:04:19 -0700346 * <li> 2d drawing hardware acceleration is now turned on by default.
347 * You can use
348 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
349 * to turn it off if needed, although this is strongly discouraged since
350 * it will result in poor performance on larger screen devices.
Adam Powell6e90a362011-08-14 16:48:32 -0700351 * <li> The default theme for applications is now the "device default" theme:
352 * {@link android.R.style#Theme_DeviceDefault}. This may be the
353 * holo dark theme or a different dark theme defined by the specific device.
354 * The {@link android.R.style#Theme_Holo} family must not be modified
355 * for a device to be considered compatible. Applications that explicitly
356 * request a theme from the Holo family will be guaranteed that these themes
357 * will not change character within the same platform version. Applications
358 * that wish to blend in with the device should use a theme from the
359 * {@link android.R.style#Theme_DeviceDefault} family.
Dianne Hackborn9d0e37e2011-09-22 12:58:54 -0700360 * <li> Managed cursors can now throw an exception if you directly close
361 * the cursor yourself without stopping the management of it; previously failures
362 * would be silently ignored.
363 * <li> The fadingEdge attribute on views will be ignored (fading edges is no
364 * longer a standard part of the UI). A new requiresFadingEdge attribute allows
365 * applications to still force fading edges on for special cases.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700366 * <li> {@link android.content.Context#bindService Context.bindService()}
367 * will not automatically add in {@link android.content.Context#BIND_WAIVE_PRIORITY}.
368 * <li> App Widgets will have standard padding automatically added around
369 * them, rather than relying on the padding being baked into the widget itself.
370 * <li> An exception will be thrown if you try to change the type of a
371 * window after it has been added to the window manager. Previously this
372 * would result in random incorrect behavior.
373 * <li> {@link android.view.animation.AnimationSet} will parse out
374 * the duration, fillBefore, fillAfter, repeatMode, and startOffset
375 * XML attributes that are defined.
376 * <li> {@link android.app.ActionBar#setHomeButtonEnabled
377 * ActionBar.setHomeButtonEnabled()} is false by default.
Dianne Hackborn2d6833b2011-06-24 16:04:19 -0700378 * </ul>
Dianne Hackborn3fc982f2011-03-30 16:20:26 -0700379 */
Dianne Hackborn0784cfb2011-09-14 13:48:15 -0700380 public static final int ICE_CREAM_SANDWICH = 14;
Dianne Hackbornf35fe232011-11-01 19:25:20 -0700381
382 /**
Dianne Hackborn81e92762011-10-09 16:00:21 -0700383 * December 2011: Android 4.0.3.
Dianne Hackbornf35fe232011-11-01 19:25:20 -0700384 */
385 public static final int ICE_CREAM_SANDWICH_MR1 = 15;
Dianne Hackborn81e92762011-10-09 16:00:21 -0700386
387 /**
Dianne Hackborn435cdb42012-07-30 17:36:43 -0700388 * June 2012: Android 4.1.
Dianne Hackborn65696252012-03-05 18:49:21 -0800389 *
390 * <p>Applications targeting this or a later release will get these
391 * new changes in behavior:</p>
392 * <ul>
Dianne Hackborn636fd522012-06-05 17:38:50 -0700393 * <li> You must explicitly request the {@link android.Manifest.permission#READ_CALL_LOG}
394 * and/or {@link android.Manifest.permission#WRITE_CALL_LOG} permissions;
395 * access to the call log is no longer implicitly provided through
396 * {@link android.Manifest.permission#READ_CONTACTS} and
397 * {@link android.Manifest.permission#WRITE_CONTACTS}.
398 * <li> {@link android.widget.RemoteViews} will throw an exception if
399 * setting an onClick handler for views being generated by a
400 * {@link android.widget.RemoteViewsService} for a collection container;
401 * previously this just resulted in a warning log message.
402 * <li> New {@link android.app.ActionBar} policy for embedded tabs:
403 * embedded tabs are now always stacked in the action bar when in portrait
404 * mode, regardless of the size of the screen.
405 * <li> {@link android.webkit.WebSettings#setAllowFileAccessFromFileURLs(boolean)
406 * WebSettings.setAllowFileAccessFromFileURLs} and
407 * {@link android.webkit.WebSettings#setAllowUniversalAccessFromFileURLs(boolean)
408 * WebSettings.setAllowUniversalAccessFromFileURLs} default to false.
Dianne Hackborn65696252012-03-05 18:49:21 -0800409 * <li> Calls to {@link android.content.pm.PackageManager#setComponentEnabledSetting
410 * PackageManager.setComponentEnabledSetting} will now throw an
411 * IllegalArgumentException if the given component class name does not
412 * exist in the application's manifest.
Dianne Hackborn636fd522012-06-05 17:38:50 -0700413 * <li> {@link android.nfc.NfcAdapter#setNdefPushMessage
414 * NfcAdapter.setNdefPushMessage},
415 * {@link android.nfc.NfcAdapter#setNdefPushMessageCallback
416 * NfcAdapter.setNdefPushMessageCallback} and
417 * {@link android.nfc.NfcAdapter#setOnNdefPushCompleteCallback
418 * NfcAdapter.setOnNdefPushCompleteCallback} will throw
419 * IllegalStateException if called after the Activity has been destroyed.
420 * <li> Accessibility services must require the new
421 * {@link android.Manifest.permission#BIND_ACCESSIBILITY_SERVICE} permission or
422 * they will not be available for use.
423 * <li> {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_INCLUDE_NOT_IMPORTANT_VIEWS
424 * AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS} must be set
425 * for unimportant views to be included in queries.
Dianne Hackborn65696252012-03-05 18:49:21 -0800426 * </ul>
Dianne Hackborn81e92762011-10-09 16:00:21 -0700427 */
Dianne Hackbornfa61f0b2012-05-09 21:49:38 -0700428 public static final int JELLY_BEAN = 16;
Dianne Hackborn435cdb42012-07-30 17:36:43 -0700429
430 /**
Dianne Hackbornfc494742012-09-27 16:15:42 -0700431 * Android 4.2: Moar jelly beans!
Nick Kralevichf097b162012-07-28 12:43:48 -0700432 *
433 * <p>Applications targeting this or a later release will get these
434 * new changes in behavior:</p>
435 * <ul>
436 * <li>Content Providers: The default value of {@code android:exported} is now
437 * {@code false}. See
Nick Kralevich2caec6c2012-08-08 11:33:17 -0700438 * <a href="{@docRoot}guide/topics/manifest/provider-element.html#exported">
Nick Kralevichf097b162012-07-28 12:43:48 -0700439 * the android:exported section</a> in the provider documentation for more details.</li>
Dianne Hackbornfc494742012-09-27 16:15:42 -0700440 * <li>{@link android.view.View#getLayoutDirection() View.getLayoutDirection()}
441 * can return different values than {@link android.view.View#LAYOUT_DIRECTION_LTR}
442 * based on the locale etc.
443 * <li> {@link android.webkit.WebView#addJavascriptInterface(Object, String)
444 * WebView.addJavascriptInterface} requires explicit annotations on methods
445 * for them to be accessible from Javascript.
Nick Kralevichf097b162012-07-28 12:43:48 -0700446 * </ul>
Dianne Hackborn435cdb42012-07-30 17:36:43 -0700447 */
448 public static final int JELLY_BEAN_MR1 = 17;
Nick Kralevicha985c3b2013-01-09 16:03:14 -0800449
450 /**
Dianne Hackbornd2eeed62013-04-22 13:04:28 -0700451 * Android 4.3: Jelly Bean MR2, the revenge of the beans.
Nick Kralevicha985c3b2013-01-09 16:03:14 -0800452 */
Dianne Hackbornd2eeed62013-04-22 13:04:28 -0700453 public static final int JELLY_BEAN_MR2 = 18;
Dianne Hackborn5d2bfa12013-03-05 10:28:34 -0800454
455 /**
Dianne Hackborn6bc37892013-10-03 11:05:14 -0700456 * Android 4.4: KitKat, another tasty treat.
Dianne Hackborn221ea892013-08-04 16:50:16 -0700457 *
458 * <p>Applications targeting this or a later release will get these
459 * new changes in behavior:</p>
460 * <ul>
Dianne Hackborn6bc37892013-10-03 11:05:14 -0700461 * <li> The default result of {android.preference.PreferenceActivity#isValidFragment
462 * PreferenceActivity.isValueFragment} becomes false instead of true.</li>
463 * <li> In {@link android.webkit.WebView}, apps targeting earlier versions will have
464 * JS URLs evaluated directly and any result of the evaluation will not replace
465 * the current page content. Apps targetting KITKAT or later that load a JS URL will
466 * have the result of that URL replace the content of the current page</li>
467 * <li> {@link android.app.AlarmManager#set AlarmManager.set} becomes interpreted as
468 * an inexact value, to give the system more flexibility in scheduling alarms.</li>
469 * <li> {@link android.content.Context#getSharedPreferences(String, int)
470 * Context.getSharedPreferences} no longer allows a null name.</li>
471 * <li> {@link android.widget.RelativeLayout} changes to compute wrapped content
472 * margins correctly.</li>
473 * <li> {@link android.app.ActionBar}'s window content overlay is allowed to be
474 * drawn.</li>
Jeff Sharkey3ec2f602013-10-29 12:21:23 -0700475 * <li>The {@link android.Manifest.permission#READ_EXTERNAL_STORAGE}
476 * permission is now always enforced.</li>
477 * <li>Access to package-specific external storage directories belonging
478 * to the calling app no longer requires the
479 * {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} or
480 * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE}
481 * permissions.</li>
Dianne Hackborn221ea892013-08-04 16:50:16 -0700482 * </ul>
Dianne Hackborn5d2bfa12013-03-05 10:28:34 -0800483 */
Dianne Hackborn6bc37892013-10-03 11:05:14 -0700484 public static final int KITKAT = 19;
Dianne Hackborn10ad9822014-03-17 11:28:36 -0700485
486 /**
Jeff Brown1c3f3322014-04-16 13:15:22 -0700487 * Android 4.5: KitKat for watches, snacks on the run.
488 */
489 public static final int KITKAT_WATCH = CUR_DEVELOPMENT; // STOPSHIP: update API level
Jeff Brown047f3c72014-04-16 14:18:49 -0700490
491 /**
Dianne Hackborn10ad9822014-03-17 11:28:36 -0700492 * L!
493 *
494 * <p>Applications targeting this or a later release will get these
495 * new changes in behavior:</p>
496 * <ul>
497 * <li> {@link android.content.Context#bindService Context.bindService} now
Michael Wright5b5def52014-04-11 13:37:50 -0700498 * requires an explicit Intent, and will throw an exception if given an implicit
Dianne Hackborn10ad9822014-03-17 11:28:36 -0700499 * Intent.</li>
500 * </ul>
501 */
502 public static final int L = CUR_DEVELOPMENT;
Dianne Hackborn851a5412009-05-08 12:06:44 -0700503 }
504
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800505 /** The type of build, like "user" or "eng". */
506 public static final String TYPE = getString("ro.build.type");
507
508 /** Comma-separated tags describing the build, like "unsigned,debug". */
509 public static final String TAGS = getString("ro.build.tags");
510
511 /** A string that uniquely identifies this build. Do not attempt to parse this value. */
512 public static final String FINGERPRINT = getString("ro.build.fingerprint");
513
514 // The following properties only make sense for internal engineering builds.
515 public static final long TIME = getLong("ro.build.date.utc") * 1000;
516 public static final String USER = getString("ro.build.user");
517 public static final String HOST = getString("ro.build.host");
518
Doug Zongkerad2171a2011-06-14 11:07:24 -0700519 /**
Jeff Brown89101cd92011-10-27 21:24:54 -0700520 * Returns true if we are running a debug build such as "user-debug" or "eng".
521 * @hide
522 */
523 public static final boolean IS_DEBUGGABLE =
524 SystemProperties.getInt("ro.debuggable", 0) == 1;
525
526 /**
Doug Zongkerad2171a2011-06-14 11:07:24 -0700527 * Returns the version string for the radio firmware. May return
528 * null (if, for instance, the radio is not currently on).
529 */
530 public static String getRadioVersion() {
531 return SystemProperties.get(TelephonyProperties.PROPERTY_BASEBAND_VERSION, null);
532 }
533
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800534 private static String getString(String property) {
535 return SystemProperties.get(property, UNKNOWN);
536 }
537
538 private static long getLong(String property) {
539 try {
540 return Long.parseLong(SystemProperties.get(property));
541 } catch (NumberFormatException e) {
542 return -1;
543 }
544 }
545}