The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package android.os; |
| 18 | |
Doug Zongker | ad2171a | 2011-06-14 11:07:24 -0700 | [diff] [blame] | 19 | import com.android.internal.telephony.TelephonyProperties; |
| 20 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 21 | /** |
| 22 | * Information about the current build, extracted from system properties. |
| 23 | */ |
| 24 | public class Build { |
| 25 | /** Value used for when a build property is unknown. */ |
Ficus Kirkpatrick | 71de785 | 2010-01-08 13:10:51 -0800 | [diff] [blame] | 26 | public static final String UNKNOWN = "unknown"; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 27 | |
| 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 Hackborn | b181118 | 2009-05-21 15:45:42 -0700 | [diff] [blame] | 43 | /** 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 Kirkpatrick | fa9cafa | 2010-01-06 17:37:13 -0800 | [diff] [blame] | 46 | /** 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 Hackborn | d62ad4f | 2009-05-19 19:06:25 -0700 | [diff] [blame] | 49 | /** The manufacturer of the product/hardware. */ |
| 50 | public static final String MANUFACTURER = getString("ro.product.manufacturer"); |
| 51 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 52 | /** The brand (e.g., carrier) the software is customized for, if any. */ |
| 53 | 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 Zongker | 74885ef | 2010-02-02 17:39:26 -0800 | [diff] [blame] | 58 | /** The system bootloader version number. */ |
Dan Egnor | 42471dd | 2010-01-07 17:25:22 -0800 | [diff] [blame] | 59 | public static final String BOOTLOADER = getString("ro.bootloader"); |
| 60 | |
Doug Zongker | ad2171a | 2011-06-14 11:07:24 -0700 | [diff] [blame] | 61 | /** |
| 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 Egnor | 42471dd | 2010-01-07 17:25:22 -0800 | [diff] [blame] | 71 | |
Doug Zongker | 74885ef | 2010-02-02 17:39:26 -0800 | [diff] [blame] | 72 | /** The name of the hardware (from the kernel command line or /proc). */ |
| 73 | public static final String HARDWARE = getString("ro.hardware"); |
Dan Egnor | 42471dd | 2010-01-07 17:25:22 -0800 | [diff] [blame] | 74 | |
Doug Zongker | 7d2e3df | 2010-08-11 16:58:04 -0700 | [diff] [blame] | 75 | /** A hardware serial number, if available. Alphanumeric only, case-insensitive. */ |
| 76 | public static final String SERIAL = getString("ro.serialno"); |
| 77 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 78 | /** Various version strings. */ |
| 79 | public static class VERSION { |
| 80 | /** |
| 81 | * The internal value used by the underlying source control to |
| 82 | * represent this build. E.g., a perforce changelist number |
| 83 | * or a git hash. |
| 84 | */ |
| 85 | public static final String INCREMENTAL = getString("ro.build.version.incremental"); |
| 86 | |
| 87 | /** |
| 88 | * The user-visible version string. E.g., "1.0" or "3.4b5". |
| 89 | */ |
| 90 | public static final String RELEASE = getString("ro.build.version.release"); |
| 91 | |
| 92 | /** |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 93 | * The user-visible SDK version of the framework in its raw String |
| 94 | * representation; use {@link #SDK_INT} instead. |
| 95 | * |
| 96 | * @deprecated Use {@link #SDK_INT} to easily get this as an integer. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 97 | */ |
Dianne Hackborn | 4a51c20 | 2009-08-21 15:14:02 -0700 | [diff] [blame] | 98 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 99 | public static final String SDK = getString("ro.build.version.sdk"); |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 100 | |
| 101 | /** |
| 102 | * The user-visible SDK version of the framework; its possible |
| 103 | * values are defined in {@link Build.VERSION_CODES}. |
| 104 | */ |
| 105 | public static final int SDK_INT = SystemProperties.getInt( |
| 106 | "ro.build.version.sdk", 0); |
| 107 | |
| 108 | /** |
| 109 | * The current development codename, or the string "REL" if this is |
| 110 | * a release build. |
| 111 | */ |
| 112 | public static final String CODENAME = getString("ro.build.version.codename"); |
Dianne Hackborn | 3b81bc1 | 2011-01-15 11:50:52 -0800 | [diff] [blame] | 113 | |
| 114 | /** |
| 115 | * The SDK version to use when accessing resources. |
| 116 | * Use the current SDK version code. If we are a development build, |
| 117 | * also allow the previous SDK version + 1. |
| 118 | * @hide |
| 119 | */ |
| 120 | public static final int RESOURCES_SDK_INT = SDK_INT |
| 121 | + ("REL".equals(CODENAME) ? 0 : 1); |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 122 | } |
| 123 | |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 124 | /** |
| 125 | * Enumeration of the currently known SDK version codes. These are the |
| 126 | * values that can be found in {@link VERSION#SDK}. Version numbers |
| 127 | * increment monotonically with each official platform release. |
| 128 | */ |
| 129 | public static class VERSION_CODES { |
| 130 | /** |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 131 | * Magic version number for a current development build, which has |
| 132 | * not yet turned into an official release. |
| 133 | */ |
| 134 | public static final int CUR_DEVELOPMENT = 10000; |
| 135 | |
| 136 | /** |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 137 | * October 2008: The original, first, version of Android. Yay! |
| 138 | */ |
| 139 | public static final int BASE = 1; |
Dianne Hackborn | 0fa3591 | 2009-10-23 12:32:45 -0700 | [diff] [blame] | 140 | |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 141 | /** |
| 142 | * February 2009: First Android update, officially called 1.1. |
| 143 | */ |
| 144 | public static final int BASE_1_1 = 2; |
Dianne Hackborn | 0fa3591 | 2009-10-23 12:32:45 -0700 | [diff] [blame] | 145 | |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 146 | /** |
| 147 | * May 2009: Android 1.5. |
| 148 | */ |
| 149 | public static final int CUPCAKE = 3; |
Dianne Hackborn | 0fa3591 | 2009-10-23 12:32:45 -0700 | [diff] [blame] | 150 | |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 151 | /** |
Dianne Hackborn | 0fa3591 | 2009-10-23 12:32:45 -0700 | [diff] [blame] | 152 | * September 2009: Android 1.6. |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 153 | * |
| 154 | * <p>Applications targeting this or a later release will get these |
| 155 | * new changes in behavior:</p> |
| 156 | * <ul> |
| 157 | * <li> They must explicitly request the |
San Mehat | 5a3a77d | 2009-06-01 09:25:28 -0700 | [diff] [blame] | 158 | * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission to be |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 159 | * able to modify the contents of the SD card. (Apps targeting |
| 160 | * earlier versions will always request the permission.) |
Dianne Hackborn | fe77ec8 | 2009-08-12 16:53:56 -0700 | [diff] [blame] | 161 | * <li> They must explicitly request the |
| 162 | * {@link android.Manifest.permission#READ_PHONE_STATE} permission to be |
| 163 | * able to be able to retrieve phone state info. (Apps targeting |
| 164 | * earlier versions will always request the permission.) |
| 165 | * <li> They are assumed to support different screen densities and |
| 166 | * sizes. (Apps targeting earlier versions are assumed to only support |
| 167 | * medium density normal size screens unless otherwise indicated). |
| 168 | * They can still explicitly specify screen support either way with the |
| 169 | * supports-screens manifest tag. |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 170 | * <li> {@link android.widget.TabHost} will use the new dark tab |
| 171 | * background design. |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 172 | * </ul> |
| 173 | */ |
Dianne Hackborn | fe77ec8 | 2009-08-12 16:53:56 -0700 | [diff] [blame] | 174 | public static final int DONUT = 4; |
Dianne Hackborn | 0fa3591 | 2009-10-23 12:32:45 -0700 | [diff] [blame] | 175 | |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 176 | /** |
Dianne Hackborn | 0fa3591 | 2009-10-23 12:32:45 -0700 | [diff] [blame] | 177 | * November 2009: Android 2.0 |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 178 | * |
| 179 | * <p>Applications targeting this or a later release will get these |
| 180 | * new changes in behavior:</p> |
| 181 | * <ul> |
| 182 | * <li> The {@link android.app.Service#onStartCommand |
| 183 | * Service.onStartCommand} function will return the new |
| 184 | * {@link android.app.Service#START_STICKY} behavior instead of the |
| 185 | * old compatibility {@link android.app.Service#START_STICKY_COMPATIBILITY}. |
Dianne Hackborn | 8d37426 | 2009-09-14 21:21:52 -0700 | [diff] [blame] | 186 | * <li> The {@link android.app.Activity} class will now execute back |
| 187 | * key presses on the key up instead of key down, to be able to detect |
| 188 | * canceled presses from virtual keys. |
Mike Cleron | 7609764 | 2009-09-25 17:53:56 -0700 | [diff] [blame] | 189 | * <li> The {@link android.widget.TabWidget} class will use a new color scheme |
| 190 | * for tabs. In the new scheme, the foreground tab has a medium gray background |
| 191 | * the background tabs have a dark gray background. |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 192 | * </ul> |
| 193 | */ |
Jeff Hamilton | 6dc3f4e | 2009-10-10 12:06:19 -0500 | [diff] [blame] | 194 | public static final int ECLAIR = 5; |
Dianne Hackborn | 0fa3591 | 2009-10-23 12:32:45 -0700 | [diff] [blame] | 195 | |
| 196 | /** |
Dianne Hackborn | 1778776 | 2009-11-12 16:11:36 -0800 | [diff] [blame] | 197 | * December 2009: Android 2.0.1 |
Dianne Hackborn | 0fa3591 | 2009-10-23 12:32:45 -0700 | [diff] [blame] | 198 | */ |
Dianne Hackborn | 1778776 | 2009-11-12 16:11:36 -0800 | [diff] [blame] | 199 | public static final int ECLAIR_0_1 = 6; |
Dianne Hackborn | 23ef7b4 | 2009-11-18 18:20:39 -0800 | [diff] [blame] | 200 | |
| 201 | /** |
| 202 | * January 2010: Android 2.1 |
| 203 | */ |
| 204 | public static final int ECLAIR_MR1 = 7; |
Adam Powell | 216bccf | 2010-02-01 15:03:17 -0800 | [diff] [blame] | 205 | |
Dianne Hackborn | 3e03cfa | 2010-06-13 12:07:00 -0700 | [diff] [blame] | 206 | /** |
| 207 | * June 2010: Android 2.2 |
| 208 | */ |
Adam Powell | 216bccf | 2010-02-01 15:03:17 -0800 | [diff] [blame] | 209 | public static final int FROYO = 8; |
Dianne Hackborn | 14cee9f | 2010-04-23 17:51:26 -0700 | [diff] [blame] | 210 | |
Dianne Hackborn | 3e03cfa | 2010-06-13 12:07:00 -0700 | [diff] [blame] | 211 | /** |
Dianne Hackborn | 9d97b63 | 2011-01-23 14:56:39 -0800 | [diff] [blame] | 212 | * November 2010: Android 2.3 |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 213 | * |
| 214 | * <p>Applications targeting this or a later release will get these |
| 215 | * new changes in behavior:</p> |
| 216 | * <ul> |
| 217 | * <li> The application's notification icons will be shown on the new |
| 218 | * dark status bar background, so must be visible in this situation. |
| 219 | * </ul> |
Dianne Hackborn | 3e03cfa | 2010-06-13 12:07:00 -0700 | [diff] [blame] | 220 | */ |
Dianne Hackborn | 4fa1a22 | 2010-10-18 13:10:49 -0700 | [diff] [blame] | 221 | public static final int GINGERBREAD = 9; |
Dianne Hackborn | 9d97b63 | 2011-01-23 14:56:39 -0800 | [diff] [blame] | 222 | |
| 223 | /** |
Dianne Hackborn | edf1fc6 | 2011-03-17 18:34:48 -0700 | [diff] [blame] | 224 | * February 2011: Android 2.3.3. |
Dianne Hackborn | 9d97b63 | 2011-01-23 14:56:39 -0800 | [diff] [blame] | 225 | */ |
| 226 | public static final int GINGERBREAD_MR1 = 10; |
Dianne Hackborn | b1ad597 | 2010-08-02 17:30:33 -0700 | [diff] [blame] | 227 | |
| 228 | /** |
Dianne Hackborn | edf1fc6 | 2011-03-17 18:34:48 -0700 | [diff] [blame] | 229 | * February 2011: Android 3.0. |
Dianne Hackborn | b1ad597 | 2010-08-02 17:30:33 -0700 | [diff] [blame] | 230 | * |
| 231 | * <p>Applications targeting this or a later release will get these |
| 232 | * new changes in behavior:</p> |
| 233 | * <ul> |
Dianne Hackborn | 3e6d50c | 2010-08-23 18:30:44 -0700 | [diff] [blame] | 234 | * <li> The default theme for applications is now dark holographic: |
| 235 | * {@link android.R.style#Theme_Holo}. |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 236 | * <li> On large screen devices that do not have a physical menu |
| 237 | * button, the soft (compatibility) menu is disabled. |
Dianne Hackborn | 0aae2d4 | 2010-12-07 23:51:29 -0800 | [diff] [blame] | 238 | * <li> The activity lifecycle has changed slightly as per |
| 239 | * {@link android.app.Activity}. |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 240 | * <li> An application will crash if it does not call through |
| 241 | * to the super implementation of its |
| 242 | * {@link android.app.Activity#onPause Activity.onPause()} method. |
Dianne Hackborn | 9d97b63 | 2011-01-23 14:56:39 -0800 | [diff] [blame] | 243 | * <li> When an application requires a permission to access one of |
Dianne Hackborn | 6c2c5fc | 2011-01-18 17:02:33 -0800 | [diff] [blame] | 244 | * its components (activity, receiver, service, provider), this |
| 245 | * permission is no longer enforced when the application wants to |
| 246 | * access its own component. This means it can require a permission |
| 247 | * on a component that it does not itself hold and still access that |
| 248 | * component. |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 249 | * <li> {@link android.content.Context#getSharedPreferences |
| 250 | * Context.getSharedPreferences()} will not automatically reload |
| 251 | * the preferences if they have changed on storage, unless |
| 252 | * {@link android.content.Context#MODE_MULTI_PROCESS} is used. |
| 253 | * <li> {@link android.view.ViewGroup#setMotionEventSplittingEnabled} |
| 254 | * will default to true. |
| 255 | * <li> {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH} |
| 256 | * is enabled by default on windows. |
| 257 | * <li> {@link android.widget.PopupWindow#isSplitTouchEnabled() |
| 258 | * PopupWindow.isSplitTouchEnabled()} will return true by default. |
| 259 | * <li> {@link android.widget.GridView} and {@link android.widget.ListView} |
| 260 | * will use {@link android.view.View#setActivated View.setActivated} |
| 261 | * for selected items if they do not implement {@link android.widget.Checkable}. |
| 262 | * <li> {@link android.widget.Scroller} will be constructed with |
| 263 | * "flywheel" behavior enabled by default. |
Dianne Hackborn | b1ad597 | 2010-08-02 17:30:33 -0700 | [diff] [blame] | 264 | * </ul> |
| 265 | */ |
Dianne Hackborn | 9d97b63 | 2011-01-23 14:56:39 -0800 | [diff] [blame] | 266 | public static final int HONEYCOMB = 11; |
Dianne Hackborn | edf1fc6 | 2011-03-17 18:34:48 -0700 | [diff] [blame] | 267 | |
| 268 | /** |
Dianne Hackborn | a813873 | 2011-05-12 15:45:21 -0700 | [diff] [blame] | 269 | * May 2011: Android 3.1. |
Dianne Hackborn | edf1fc6 | 2011-03-17 18:34:48 -0700 | [diff] [blame] | 270 | */ |
| 271 | public static final int HONEYCOMB_MR1 = 12; |
Dianne Hackborn | a813873 | 2011-05-12 15:45:21 -0700 | [diff] [blame] | 272 | |
| 273 | /** |
Dianne Hackborn | 426431a | 2011-06-09 11:29:08 -0700 | [diff] [blame] | 274 | * June 2011: Android 3.2. |
Dianne Hackborn | e667635 | 2011-06-01 16:51:20 -0700 | [diff] [blame] | 275 | * |
| 276 | * <p>Update to Honeycomb MR1 to support 7 inch tablets, improve |
| 277 | * screen compatibility mode, etc.</p> |
| 278 | * |
| 279 | * <p>As of this version, applications that don't say whether they |
| 280 | * support XLARGE screens will be assumed to do so only if they target |
| 281 | * {@link #HONEYCOMB} or later; it had been {@link #GINGERBREAD} or |
| 282 | * later. Applications that don't support a screen size at least as |
| 283 | * large as the current screen will provide the user with a UI to |
| 284 | * switch them in to screen size compatibility mode.</p> |
Dianne Hackborn | e289bff | 2011-06-13 19:33:22 -0700 | [diff] [blame] | 285 | * |
| 286 | * <p>This version introduces new screen size resource qualifiers |
| 287 | * based on the screen size in dp: see |
| 288 | * {@link android.content.res.Configuration#screenWidthDp}, |
| 289 | * {@link android.content.res.Configuration#screenHeightDp}, and |
| 290 | * {@link android.content.res.Configuration#smallestScreenWidthDp}. |
| 291 | * Supplying these in <supports-screens> as per |
| 292 | * {@link android.content.pm.ApplicationInfo#requiresSmallestWidthDp}, |
| 293 | * {@link android.content.pm.ApplicationInfo#compatibleWidthLimitDp}, and |
| 294 | * {@link android.content.pm.ApplicationInfo#largestWidthLimitDp} is |
| 295 | * preferred over the older screen size buckets and for older devices |
| 296 | * the appropriate buckets will be inferred from them.</p> |
| 297 | * |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 298 | * <p>Applications targeting this or a later release will get these |
| 299 | * new changes in behavior:</p> |
| 300 | * <ul> |
| 301 | * <li><p>New {@link android.content.pm.PackageManager#FEATURE_SCREEN_PORTRAIT} |
Dianne Hackborn | e289bff | 2011-06-13 19:33:22 -0700 | [diff] [blame] | 302 | * and {@link android.content.pm.PackageManager#FEATURE_SCREEN_LANDSCAPE} |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 303 | * features were introduced in this release. Applications that target |
Dianne Hackborn | e289bff | 2011-06-13 19:33:22 -0700 | [diff] [blame] | 304 | * previous platform versions are assumed to require both portrait and |
| 305 | * landscape support in the device; when targeting Honeycomb MR1 or |
| 306 | * greater the application is responsible for specifying any specific |
| 307 | * orientation it requires.</p> |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 308 | * <li><p>{@link android.os.AsyncTask} will use the serial executor |
| 309 | * by default when calling {@link android.os.AsyncTask#execute}.</p> |
| 310 | * <li><p>{@link android.content.pm.ActivityInfo#configChanges |
| 311 | * ActivityInfo.configChanges} will have the |
| 312 | * {@link android.content.pm.ActivityInfo#CONFIG_SCREEN_SIZE} and |
| 313 | * {@link android.content.pm.ActivityInfo#CONFIG_SMALLEST_SCREEN_SIZE} |
| 314 | * bits set; these need to be cleared for older applications because |
| 315 | * some developers have done absolute comparisons against this value |
| 316 | * instead of correctly masking the bits they are interested in. |
| 317 | * </ul> |
Dianne Hackborn | a813873 | 2011-05-12 15:45:21 -0700 | [diff] [blame] | 318 | */ |
Dianne Hackborn | 426431a | 2011-06-09 11:29:08 -0700 | [diff] [blame] | 319 | public static final int HONEYCOMB_MR2 = 13; |
Dianne Hackborn | 3fc982f | 2011-03-30 16:20:26 -0700 | [diff] [blame] | 320 | |
| 321 | /** |
Dianne Hackborn | f35fe23 | 2011-11-01 19:25:20 -0700 | [diff] [blame] | 322 | * October 2011: Android 4.0. |
Dianne Hackborn | 2d6833b | 2011-06-24 16:04:19 -0700 | [diff] [blame] | 323 | * |
| 324 | * <p>Applications targeting this or a later release will get these |
| 325 | * new changes in behavior:</p> |
| 326 | * <ul> |
Dianne Hackborn | 9d0e37e | 2011-09-22 12:58:54 -0700 | [diff] [blame] | 327 | * <li> For devices without a dedicated menu key, the software compatibility |
| 328 | * menu key will not be shown even on phones. By targeting Ice Cream Sandwich |
| 329 | * or later, your UI must always have its own menu UI affordance if needed, |
| 330 | * on both tablets and phones. The ActionBar will take care of this for you. |
Dianne Hackborn | 2d6833b | 2011-06-24 16:04:19 -0700 | [diff] [blame] | 331 | * <li> 2d drawing hardware acceleration is now turned on by default. |
| 332 | * You can use |
| 333 | * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated} |
| 334 | * to turn it off if needed, although this is strongly discouraged since |
| 335 | * it will result in poor performance on larger screen devices. |
Adam Powell | 6e90a36 | 2011-08-14 16:48:32 -0700 | [diff] [blame] | 336 | * <li> The default theme for applications is now the "device default" theme: |
| 337 | * {@link android.R.style#Theme_DeviceDefault}. This may be the |
| 338 | * holo dark theme or a different dark theme defined by the specific device. |
| 339 | * The {@link android.R.style#Theme_Holo} family must not be modified |
| 340 | * for a device to be considered compatible. Applications that explicitly |
| 341 | * request a theme from the Holo family will be guaranteed that these themes |
| 342 | * will not change character within the same platform version. Applications |
| 343 | * that wish to blend in with the device should use a theme from the |
| 344 | * {@link android.R.style#Theme_DeviceDefault} family. |
Dianne Hackborn | 9d0e37e | 2011-09-22 12:58:54 -0700 | [diff] [blame] | 345 | * <li> Managed cursors can now throw an exception if you directly close |
| 346 | * the cursor yourself without stopping the management of it; previously failures |
| 347 | * would be silently ignored. |
| 348 | * <li> The fadingEdge attribute on views will be ignored (fading edges is no |
| 349 | * longer a standard part of the UI). A new requiresFadingEdge attribute allows |
| 350 | * applications to still force fading edges on for special cases. |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 351 | * <li> {@link android.content.Context#bindService Context.bindService()} |
| 352 | * will not automatically add in {@link android.content.Context#BIND_WAIVE_PRIORITY}. |
| 353 | * <li> App Widgets will have standard padding automatically added around |
| 354 | * them, rather than relying on the padding being baked into the widget itself. |
| 355 | * <li> An exception will be thrown if you try to change the type of a |
| 356 | * window after it has been added to the window manager. Previously this |
| 357 | * would result in random incorrect behavior. |
| 358 | * <li> {@link android.view.animation.AnimationSet} will parse out |
| 359 | * the duration, fillBefore, fillAfter, repeatMode, and startOffset |
| 360 | * XML attributes that are defined. |
| 361 | * <li> {@link android.app.ActionBar#setHomeButtonEnabled |
| 362 | * ActionBar.setHomeButtonEnabled()} is false by default. |
Dianne Hackborn | 2d6833b | 2011-06-24 16:04:19 -0700 | [diff] [blame] | 363 | * </ul> |
Dianne Hackborn | 3fc982f | 2011-03-30 16:20:26 -0700 | [diff] [blame] | 364 | */ |
Dianne Hackborn | 0784cfb | 2011-09-14 13:48:15 -0700 | [diff] [blame] | 365 | public static final int ICE_CREAM_SANDWICH = 14; |
Dianne Hackborn | f35fe23 | 2011-11-01 19:25:20 -0700 | [diff] [blame] | 366 | |
| 367 | /** |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 368 | * December 2011: Android 4.0.3. |
Dianne Hackborn | f35fe23 | 2011-11-01 19:25:20 -0700 | [diff] [blame] | 369 | */ |
| 370 | public static final int ICE_CREAM_SANDWICH_MR1 = 15; |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 371 | |
| 372 | /** |
Dianne Hackborn | 435cdb4 | 2012-07-30 17:36:43 -0700 | [diff] [blame] | 373 | * June 2012: Android 4.1. |
Dianne Hackborn | 6569625 | 2012-03-05 18:49:21 -0800 | [diff] [blame] | 374 | * |
| 375 | * <p>Applications targeting this or a later release will get these |
| 376 | * new changes in behavior:</p> |
| 377 | * <ul> |
Dianne Hackborn | 636fd52 | 2012-06-05 17:38:50 -0700 | [diff] [blame] | 378 | * <li> You must explicitly request the {@link android.Manifest.permission#READ_CALL_LOG} |
| 379 | * and/or {@link android.Manifest.permission#WRITE_CALL_LOG} permissions; |
| 380 | * access to the call log is no longer implicitly provided through |
| 381 | * {@link android.Manifest.permission#READ_CONTACTS} and |
| 382 | * {@link android.Manifest.permission#WRITE_CONTACTS}. |
| 383 | * <li> {@link android.widget.RemoteViews} will throw an exception if |
| 384 | * setting an onClick handler for views being generated by a |
| 385 | * {@link android.widget.RemoteViewsService} for a collection container; |
| 386 | * previously this just resulted in a warning log message. |
| 387 | * <li> New {@link android.app.ActionBar} policy for embedded tabs: |
| 388 | * embedded tabs are now always stacked in the action bar when in portrait |
| 389 | * mode, regardless of the size of the screen. |
| 390 | * <li> {@link android.webkit.WebSettings#setAllowFileAccessFromFileURLs(boolean) |
| 391 | * WebSettings.setAllowFileAccessFromFileURLs} and |
| 392 | * {@link android.webkit.WebSettings#setAllowUniversalAccessFromFileURLs(boolean) |
| 393 | * WebSettings.setAllowUniversalAccessFromFileURLs} default to false. |
Dianne Hackborn | 6569625 | 2012-03-05 18:49:21 -0800 | [diff] [blame] | 394 | * <li> Calls to {@link android.content.pm.PackageManager#setComponentEnabledSetting |
| 395 | * PackageManager.setComponentEnabledSetting} will now throw an |
| 396 | * IllegalArgumentException if the given component class name does not |
| 397 | * exist in the application's manifest. |
Dianne Hackborn | 636fd52 | 2012-06-05 17:38:50 -0700 | [diff] [blame] | 398 | * <li> {@link android.nfc.NfcAdapter#setNdefPushMessage |
| 399 | * NfcAdapter.setNdefPushMessage}, |
| 400 | * {@link android.nfc.NfcAdapter#setNdefPushMessageCallback |
| 401 | * NfcAdapter.setNdefPushMessageCallback} and |
| 402 | * {@link android.nfc.NfcAdapter#setOnNdefPushCompleteCallback |
| 403 | * NfcAdapter.setOnNdefPushCompleteCallback} will throw |
| 404 | * IllegalStateException if called after the Activity has been destroyed. |
| 405 | * <li> Accessibility services must require the new |
| 406 | * {@link android.Manifest.permission#BIND_ACCESSIBILITY_SERVICE} permission or |
| 407 | * they will not be available for use. |
| 408 | * <li> {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_INCLUDE_NOT_IMPORTANT_VIEWS |
| 409 | * AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS} must be set |
| 410 | * for unimportant views to be included in queries. |
Dianne Hackborn | 6569625 | 2012-03-05 18:49:21 -0800 | [diff] [blame] | 411 | * </ul> |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 412 | */ |
Dianne Hackborn | fa61f0b | 2012-05-09 21:49:38 -0700 | [diff] [blame] | 413 | public static final int JELLY_BEAN = 16; |
Dianne Hackborn | 435cdb4 | 2012-07-30 17:36:43 -0700 | [diff] [blame] | 414 | |
| 415 | /** |
Dianne Hackborn | fc49474 | 2012-09-27 16:15:42 -0700 | [diff] [blame] | 416 | * Android 4.2: Moar jelly beans! |
Nick Kralevich | f097b16 | 2012-07-28 12:43:48 -0700 | [diff] [blame] | 417 | * |
| 418 | * <p>Applications targeting this or a later release will get these |
| 419 | * new changes in behavior:</p> |
| 420 | * <ul> |
| 421 | * <li>Content Providers: The default value of {@code android:exported} is now |
| 422 | * {@code false}. See |
Nick Kralevich | 2caec6c | 2012-08-08 11:33:17 -0700 | [diff] [blame] | 423 | * <a href="{@docRoot}guide/topics/manifest/provider-element.html#exported"> |
Nick Kralevich | f097b16 | 2012-07-28 12:43:48 -0700 | [diff] [blame] | 424 | * the android:exported section</a> in the provider documentation for more details.</li> |
Dianne Hackborn | fc49474 | 2012-09-27 16:15:42 -0700 | [diff] [blame] | 425 | * <li>{@link android.view.View#getLayoutDirection() View.getLayoutDirection()} |
| 426 | * can return different values than {@link android.view.View#LAYOUT_DIRECTION_LTR} |
| 427 | * based on the locale etc. |
| 428 | * <li> {@link android.webkit.WebView#addJavascriptInterface(Object, String) |
| 429 | * WebView.addJavascriptInterface} requires explicit annotations on methods |
| 430 | * for them to be accessible from Javascript. |
Nick Kralevich | f097b16 | 2012-07-28 12:43:48 -0700 | [diff] [blame] | 431 | * </ul> |
Dianne Hackborn | 435cdb4 | 2012-07-30 17:36:43 -0700 | [diff] [blame] | 432 | */ |
| 433 | public static final int JELLY_BEAN_MR1 = 17; |
Nick Kralevich | a985c3b | 2013-01-09 16:03:14 -0800 | [diff] [blame] | 434 | |
| 435 | /** |
Dianne Hackborn | 45e9ede | 2013-02-25 15:55:37 -0800 | [diff] [blame] | 436 | * Android 4.X: Jelly Bean MR2, the revenge of the beans. |
Nick Kralevich | a985c3b | 2013-01-09 16:03:14 -0800 | [diff] [blame] | 437 | */ |
Dianne Hackborn | 45e9ede | 2013-02-25 15:55:37 -0800 | [diff] [blame] | 438 | public static final int JELLY_BEAN_MR2 = CUR_DEVELOPMENT; |
Dianne Hackborn | 5d2bfa1 | 2013-03-05 10:28:34 -0800 | [diff] [blame^] | 439 | |
| 440 | /** |
| 441 | * Android X.X: Key Lime Pie, another tasty treat. |
| 442 | */ |
| 443 | public static final int KEY_LIME_PIE = CUR_DEVELOPMENT; |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 444 | } |
| 445 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 446 | /** The type of build, like "user" or "eng". */ |
| 447 | public static final String TYPE = getString("ro.build.type"); |
| 448 | |
| 449 | /** Comma-separated tags describing the build, like "unsigned,debug". */ |
| 450 | public static final String TAGS = getString("ro.build.tags"); |
| 451 | |
| 452 | /** A string that uniquely identifies this build. Do not attempt to parse this value. */ |
| 453 | public static final String FINGERPRINT = getString("ro.build.fingerprint"); |
| 454 | |
| 455 | // The following properties only make sense for internal engineering builds. |
| 456 | public static final long TIME = getLong("ro.build.date.utc") * 1000; |
| 457 | public static final String USER = getString("ro.build.user"); |
| 458 | public static final String HOST = getString("ro.build.host"); |
| 459 | |
Doug Zongker | ad2171a | 2011-06-14 11:07:24 -0700 | [diff] [blame] | 460 | /** |
Jeff Brown | 89101cd9 | 2011-10-27 21:24:54 -0700 | [diff] [blame] | 461 | * Returns true if we are running a debug build such as "user-debug" or "eng". |
| 462 | * @hide |
| 463 | */ |
| 464 | public static final boolean IS_DEBUGGABLE = |
| 465 | SystemProperties.getInt("ro.debuggable", 0) == 1; |
| 466 | |
| 467 | /** |
Doug Zongker | ad2171a | 2011-06-14 11:07:24 -0700 | [diff] [blame] | 468 | * Returns the version string for the radio firmware. May return |
| 469 | * null (if, for instance, the radio is not currently on). |
| 470 | */ |
| 471 | public static String getRadioVersion() { |
| 472 | return SystemProperties.get(TelephonyProperties.PROPERTY_BASEBAND_VERSION, null); |
| 473 | } |
| 474 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 475 | private static String getString(String property) { |
| 476 | return SystemProperties.get(property, UNKNOWN); |
| 477 | } |
| 478 | |
| 479 | private static long getLong(String property) { |
| 480 | try { |
| 481 | return Long.parseLong(SystemProperties.get(property)); |
| 482 | } catch (NumberFormatException e) { |
| 483 | return -1; |
| 484 | } |
| 485 | } |
| 486 | } |