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 | |
Svet Ganov | 37e4327 | 2016-09-09 16:01:32 -0700 | [diff] [blame] | 19 | import android.Manifest; |
| 20 | import android.annotation.RequiresPermission; |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 21 | import android.annotation.SystemApi; |
Svet Ganov | 37e4327 | 2016-09-09 16:01:32 -0700 | [diff] [blame] | 22 | import android.content.Context; |
Jeff Sharkey | 5568772 | 2014-04-09 18:07:19 -0700 | [diff] [blame] | 23 | import android.text.TextUtils; |
Jeff Sharkey | bdd4491 | 2014-04-11 16:30:14 -0700 | [diff] [blame] | 24 | import android.util.Slog; |
Jeff Sharkey | 5568772 | 2014-04-09 18:07:19 -0700 | [diff] [blame] | 25 | |
Doug Zongker | ad2171a | 2011-06-14 11:07:24 -0700 | [diff] [blame] | 26 | import com.android.internal.telephony.TelephonyProperties; |
Jeff Sharkey | 2cffc7d | 2014-11-14 13:57:53 -0800 | [diff] [blame] | 27 | |
Narayan Kamath | eff258c | 2014-09-30 13:20:57 +0100 | [diff] [blame] | 28 | import dalvik.system.VMRuntime; |
Doug Zongker | ad2171a | 2011-06-14 11:07:24 -0700 | [diff] [blame] | 29 | |
Jeff Sharkey | 2cffc7d | 2014-11-14 13:57:53 -0800 | [diff] [blame] | 30 | import java.util.Objects; |
| 31 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 32 | /** |
| 33 | * Information about the current build, extracted from system properties. |
| 34 | */ |
| 35 | public class Build { |
Jeff Sharkey | bdd4491 | 2014-04-11 16:30:14 -0700 | [diff] [blame] | 36 | private static final String TAG = "Build"; |
| 37 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 38 | /** Value used for when a build property is unknown. */ |
Ficus Kirkpatrick | 71de785 | 2010-01-08 13:10:51 -0800 | [diff] [blame] | 39 | public static final String UNKNOWN = "unknown"; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 40 | |
| 41 | /** Either a changelist number, or a label like "M4-rc20". */ |
| 42 | public static final String ID = getString("ro.build.id"); |
| 43 | |
| 44 | /** A build ID string meant for displaying to the user */ |
| 45 | public static final String DISPLAY = getString("ro.build.display.id"); |
| 46 | |
| 47 | /** The name of the overall product. */ |
| 48 | public static final String PRODUCT = getString("ro.product.name"); |
| 49 | |
| 50 | /** The name of the industrial design. */ |
| 51 | public static final String DEVICE = getString("ro.product.device"); |
| 52 | |
| 53 | /** The name of the underlying board, like "goldfish". */ |
| 54 | public static final String BOARD = getString("ro.product.board"); |
| 55 | |
Narayan Kamath | 1adf400 | 2014-07-12 11:46:37 +0100 | [diff] [blame] | 56 | /** |
| 57 | * The name of the instruction set (CPU type + ABI convention) of native code. |
| 58 | * |
| 59 | * @deprecated Use {@link #SUPPORTED_ABIS} instead. |
| 60 | */ |
| 61 | @Deprecated |
Narayan Kamath | eff258c | 2014-09-30 13:20:57 +0100 | [diff] [blame] | 62 | public static final String CPU_ABI; |
Dianne Hackborn | b181118 | 2009-05-21 15:45:42 -0700 | [diff] [blame] | 63 | |
Narayan Kamath | 1adf400 | 2014-07-12 11:46:37 +0100 | [diff] [blame] | 64 | /** |
| 65 | * The name of the second instruction set (CPU type + ABI convention) of native code. |
| 66 | * |
| 67 | * @deprecated Use {@link #SUPPORTED_ABIS} instead. |
| 68 | */ |
| 69 | @Deprecated |
Narayan Kamath | eff258c | 2014-09-30 13:20:57 +0100 | [diff] [blame] | 70 | public static final String CPU_ABI2; |
Ficus Kirkpatrick | fa9cafa | 2010-01-06 17:37:13 -0800 | [diff] [blame] | 71 | |
Dianne Hackborn | d62ad4f | 2009-05-19 19:06:25 -0700 | [diff] [blame] | 72 | /** The manufacturer of the product/hardware. */ |
| 73 | public static final String MANUFACTURER = getString("ro.product.manufacturer"); |
| 74 | |
Dirk Dougherty | 491b40d | 2013-10-29 18:33:29 -0700 | [diff] [blame] | 75 | /** The consumer-visible brand with which the product/hardware will be associated, if any. */ |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 76 | public static final String BRAND = getString("ro.product.brand"); |
| 77 | |
| 78 | /** The end-user-visible name for the end product. */ |
| 79 | public static final String MODEL = getString("ro.product.model"); |
| 80 | |
Doug Zongker | 74885ef | 2010-02-02 17:39:26 -0800 | [diff] [blame] | 81 | /** The system bootloader version number. */ |
Dan Egnor | 42471dd | 2010-01-07 17:25:22 -0800 | [diff] [blame] | 82 | public static final String BOOTLOADER = getString("ro.bootloader"); |
| 83 | |
Doug Zongker | ad2171a | 2011-06-14 11:07:24 -0700 | [diff] [blame] | 84 | /** |
| 85 | * The radio firmware version number. |
| 86 | * |
| 87 | * @deprecated The radio firmware version is frequently not |
| 88 | * available when this class is initialized, leading to a blank or |
| 89 | * "unknown" value for this string. Use |
| 90 | * {@link #getRadioVersion} instead. |
| 91 | */ |
| 92 | @Deprecated |
| 93 | public static final String RADIO = getString(TelephonyProperties.PROPERTY_BASEBAND_VERSION); |
Dan Egnor | 42471dd | 2010-01-07 17:25:22 -0800 | [diff] [blame] | 94 | |
Doug Zongker | 74885ef | 2010-02-02 17:39:26 -0800 | [diff] [blame] | 95 | /** The name of the hardware (from the kernel command line or /proc). */ |
| 96 | public static final String HARDWARE = getString("ro.hardware"); |
Dan Egnor | 42471dd | 2010-01-07 17:25:22 -0800 | [diff] [blame] | 97 | |
Griff Hazen | d3c454d | 2016-03-25 07:30:34 -0700 | [diff] [blame] | 98 | /** |
| 99 | * Whether this build was for an emulator device. |
| 100 | * @hide |
| 101 | */ |
| 102 | public static final boolean IS_EMULATOR = getString("ro.kernel.qemu").equals("1"); |
| 103 | |
Svet Ganov | 37e4327 | 2016-09-09 16:01:32 -0700 | [diff] [blame] | 104 | /** |
| 105 | * A hardware serial number, if available. Alphanumeric only, case-insensitive. |
| 106 | * For apps targeting SDK higher than {@link Build.VERSION_CODES#N_MR1} this |
| 107 | * field is set to {@link Build#UNKNOWN}. |
| 108 | * |
| 109 | * @deprecated Use {@link #getSerial()} instead. |
| 110 | **/ |
| 111 | @Deprecated |
| 112 | // IMPORTANT: This field should be initialized via a function call to |
| 113 | // prevent its value being inlined in the app during compilation because |
| 114 | // we will later set it to the value based on the app's target SDK. |
| 115 | public static final String SERIAL = getString("no.such.thing"); |
| 116 | |
| 117 | /** |
| 118 | * Gets the hardware serial, if available. Requires holding the {@link |
| 119 | * android.Manifest.permission#READ_PHONE_STATE} permission. |
| 120 | * @return The serial if specified. |
| 121 | */ |
| 122 | @RequiresPermission(Manifest.permission.READ_PHONE_STATE) |
| 123 | public static String getSerial() { |
| 124 | IDeviceIdentifiersPolicyService service = IDeviceIdentifiersPolicyService.Stub |
| 125 | .asInterface(ServiceManager.getService(Context.DEVICE_IDENTIFIERS_SERVICE)); |
| 126 | try { |
| 127 | return service.getSerial(); |
| 128 | } catch (RemoteException e) { |
| 129 | e.rethrowFromSystemServer(); |
| 130 | } |
| 131 | return UNKNOWN; |
| 132 | } |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 133 | |
| 134 | /** |
Narayan Kamath | 0f206a1 | 2014-04-12 11:41:13 +0100 | [diff] [blame] | 135 | * An ordered list of ABIs supported by this device. The most preferred ABI is the first |
| 136 | * element in the list. |
| 137 | * |
| 138 | * See {@link #SUPPORTED_32_BIT_ABIS} and {@link #SUPPORTED_64_BIT_ABIS}. |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 139 | */ |
Torne (Richard Coles) | ff701a6 | 2014-07-30 12:11:15 +0100 | [diff] [blame] | 140 | public static final String[] SUPPORTED_ABIS = getStringList("ro.product.cpu.abilist", ","); |
Ramin Zaghi | 1378aba | 2014-02-28 15:03:19 +0000 | [diff] [blame] | 141 | |
Narayan Kamath | 0f206a1 | 2014-04-12 11:41:13 +0100 | [diff] [blame] | 142 | /** |
| 143 | * An ordered list of <b>32 bit</b> ABIs supported by this device. The most preferred ABI |
| 144 | * is the first element in the list. |
| 145 | * |
| 146 | * See {@link #SUPPORTED_ABIS} and {@link #SUPPORTED_64_BIT_ABIS}. |
Narayan Kamath | 0f206a1 | 2014-04-12 11:41:13 +0100 | [diff] [blame] | 147 | */ |
Torne (Richard Coles) | da8c037 | 2014-05-14 16:17:26 +0100 | [diff] [blame] | 148 | public static final String[] SUPPORTED_32_BIT_ABIS = |
Torne (Richard Coles) | ff701a6 | 2014-07-30 12:11:15 +0100 | [diff] [blame] | 149 | getStringList("ro.product.cpu.abilist32", ","); |
Narayan Kamath | 0f206a1 | 2014-04-12 11:41:13 +0100 | [diff] [blame] | 150 | |
| 151 | /** |
| 152 | * An ordered list of <b>64 bit</b> ABIs supported by this device. The most preferred ABI |
| 153 | * is the first element in the list. |
| 154 | * |
| 155 | * See {@link #SUPPORTED_ABIS} and {@link #SUPPORTED_32_BIT_ABIS}. |
Narayan Kamath | 0f206a1 | 2014-04-12 11:41:13 +0100 | [diff] [blame] | 156 | */ |
Torne (Richard Coles) | da8c037 | 2014-05-14 16:17:26 +0100 | [diff] [blame] | 157 | public static final String[] SUPPORTED_64_BIT_ABIS = |
Torne (Richard Coles) | ff701a6 | 2014-07-30 12:11:15 +0100 | [diff] [blame] | 158 | getStringList("ro.product.cpu.abilist64", ","); |
Narayan Kamath | 0f206a1 | 2014-04-12 11:41:13 +0100 | [diff] [blame] | 159 | |
| 160 | |
Narayan Kamath | eff258c | 2014-09-30 13:20:57 +0100 | [diff] [blame] | 161 | static { |
| 162 | /* |
| 163 | * Adjusts CPU_ABI and CPU_ABI2 depending on whether or not a given process is 64 bit. |
| 164 | * 32 bit processes will always see 32 bit ABIs in these fields for backward |
| 165 | * compatibility. |
| 166 | */ |
| 167 | final String[] abiList; |
| 168 | if (VMRuntime.getRuntime().is64Bit()) { |
| 169 | abiList = SUPPORTED_64_BIT_ABIS; |
| 170 | } else { |
| 171 | abiList = SUPPORTED_32_BIT_ABIS; |
| 172 | } |
| 173 | |
| 174 | CPU_ABI = abiList[0]; |
| 175 | if (abiList.length > 1) { |
| 176 | CPU_ABI2 = abiList[1]; |
| 177 | } else { |
| 178 | CPU_ABI2 = ""; |
| 179 | } |
| 180 | } |
| 181 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 182 | /** Various version strings. */ |
| 183 | public static class VERSION { |
| 184 | /** |
| 185 | * The internal value used by the underlying source control to |
| 186 | * represent this build. E.g., a perforce changelist number |
| 187 | * or a git hash. |
| 188 | */ |
| 189 | public static final String INCREMENTAL = getString("ro.build.version.incremental"); |
| 190 | |
| 191 | /** |
| 192 | * The user-visible version string. E.g., "1.0" or "3.4b5". |
| 193 | */ |
| 194 | public static final String RELEASE = getString("ro.build.version.release"); |
| 195 | |
| 196 | /** |
Dianne Hackborn | c3f7449 | 2015-08-12 16:10:58 -0700 | [diff] [blame] | 197 | * The base OS build the product is based on. |
| 198 | */ |
| 199 | public static final String BASE_OS = SystemProperties.get("ro.build.version.base_os", ""); |
| 200 | |
| 201 | /** |
| 202 | * The user-visible security patch level. |
| 203 | */ |
| 204 | public static final String SECURITY_PATCH = SystemProperties.get( |
| 205 | "ro.build.version.security_patch", ""); |
| 206 | |
| 207 | /** |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 208 | * The user-visible SDK version of the framework in its raw String |
| 209 | * representation; use {@link #SDK_INT} instead. |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 210 | * |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 211 | * @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] | 212 | */ |
Dianne Hackborn | 4a51c20 | 2009-08-21 15:14:02 -0700 | [diff] [blame] | 213 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 214 | public static final String SDK = getString("ro.build.version.sdk"); |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 215 | |
| 216 | /** |
| 217 | * The user-visible SDK version of the framework; its possible |
| 218 | * values are defined in {@link Build.VERSION_CODES}. |
| 219 | */ |
| 220 | public static final int SDK_INT = SystemProperties.getInt( |
| 221 | "ro.build.version.sdk", 0); |
| 222 | |
| 223 | /** |
Adam Powell | e960030 | 2015-05-06 18:13:09 -0700 | [diff] [blame] | 224 | * The developer preview revision of a prerelease SDK. This value will always |
| 225 | * be <code>0</code> on production platform builds/devices. |
| 226 | * |
| 227 | * <p>When this value is nonzero, any new API added since the last |
| 228 | * officially published {@link #SDK_INT API level} is only guaranteed to be present |
| 229 | * on that specific preview revision. For example, an API <code>Activity.fooBar()</code> |
| 230 | * might be present in preview revision 1 but renamed or removed entirely in |
| 231 | * preview revision 2, which may cause an app attempting to call it to crash |
| 232 | * at runtime.</p> |
| 233 | * |
| 234 | * <p>Experimental apps targeting preview APIs should check this value for |
| 235 | * equality (<code>==</code>) with the preview SDK revision they were built for |
| 236 | * before using any prerelease platform APIs. Apps that detect a preview SDK revision |
| 237 | * other than the specific one they expect should fall back to using APIs from |
| 238 | * the previously published API level only to avoid unwanted runtime exceptions. |
| 239 | * </p> |
| 240 | */ |
| 241 | public static final int PREVIEW_SDK_INT = SystemProperties.getInt( |
| 242 | "ro.build.version.preview_sdk", 0); |
| 243 | |
| 244 | /** |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 245 | * The current development codename, or the string "REL" if this is |
| 246 | * a release build. |
| 247 | */ |
| 248 | public static final String CODENAME = getString("ro.build.version.codename"); |
Dianne Hackborn | 3b81bc1 | 2011-01-15 11:50:52 -0800 | [diff] [blame] | 249 | |
Dianne Hackborn | ffcda10 | 2014-04-24 13:06:27 -0700 | [diff] [blame] | 250 | private static final String[] ALL_CODENAMES |
Torne (Richard Coles) | ff701a6 | 2014-07-30 12:11:15 +0100 | [diff] [blame] | 251 | = getStringList("ro.build.version.all_codenames", ","); |
Dianne Hackborn | ffcda10 | 2014-04-24 13:06:27 -0700 | [diff] [blame] | 252 | |
Dianne Hackborn | 3b81bc1 | 2011-01-15 11:50:52 -0800 | [diff] [blame] | 253 | /** |
Dianne Hackborn | 3b81bc1 | 2011-01-15 11:50:52 -0800 | [diff] [blame] | 254 | * @hide |
| 255 | */ |
Dianne Hackborn | ffcda10 | 2014-04-24 13:06:27 -0700 | [diff] [blame] | 256 | public static final String[] ACTIVE_CODENAMES = "REL".equals(ALL_CODENAMES[0]) |
| 257 | ? new String[0] : ALL_CODENAMES; |
| 258 | |
| 259 | /** |
| 260 | * The SDK version to use when accessing resources. |
| 261 | * Use the current SDK version code. For every active development codename |
| 262 | * we are operating under, we bump the assumed resource platform version by 1. |
| 263 | * @hide |
| 264 | */ |
| 265 | public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 266 | } |
| 267 | |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 268 | /** |
| 269 | * Enumeration of the currently known SDK version codes. These are the |
| 270 | * values that can be found in {@link VERSION#SDK}. Version numbers |
| 271 | * increment monotonically with each official platform release. |
| 272 | */ |
| 273 | public static class VERSION_CODES { |
| 274 | /** |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 275 | * Magic version number for a current development build, which has |
| 276 | * not yet turned into an official release. |
| 277 | */ |
| 278 | public static final int CUR_DEVELOPMENT = 10000; |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 279 | |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 280 | /** |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 281 | * October 2008: The original, first, version of Android. Yay! |
| 282 | */ |
| 283 | public static final int BASE = 1; |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 284 | |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 285 | /** |
| 286 | * February 2009: First Android update, officially called 1.1. |
| 287 | */ |
| 288 | public static final int BASE_1_1 = 2; |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 289 | |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 290 | /** |
| 291 | * May 2009: Android 1.5. |
| 292 | */ |
| 293 | public static final int CUPCAKE = 3; |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 294 | |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 295 | /** |
Dianne Hackborn | 0fa3591 | 2009-10-23 12:32:45 -0700 | [diff] [blame] | 296 | * September 2009: Android 1.6. |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 297 | * |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -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> They must explicitly request the |
San Mehat | 5a3a77d | 2009-06-01 09:25:28 -0700 | [diff] [blame] | 302 | * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission to be |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 303 | * able to modify the contents of the SD card. (Apps targeting |
| 304 | * earlier versions will always request the permission.) |
Dianne Hackborn | fe77ec8 | 2009-08-12 16:53:56 -0700 | [diff] [blame] | 305 | * <li> They must explicitly request the |
| 306 | * {@link android.Manifest.permission#READ_PHONE_STATE} permission to be |
| 307 | * able to be able to retrieve phone state info. (Apps targeting |
| 308 | * earlier versions will always request the permission.) |
| 309 | * <li> They are assumed to support different screen densities and |
| 310 | * sizes. (Apps targeting earlier versions are assumed to only support |
| 311 | * medium density normal size screens unless otherwise indicated). |
| 312 | * They can still explicitly specify screen support either way with the |
| 313 | * supports-screens manifest tag. |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 314 | * <li> {@link android.widget.TabHost} will use the new dark tab |
| 315 | * background design. |
Dianne Hackborn | a96cbb4 | 2009-05-13 15:06:13 -0700 | [diff] [blame] | 316 | * </ul> |
| 317 | */ |
Dianne Hackborn | fe77ec8 | 2009-08-12 16:53:56 -0700 | [diff] [blame] | 318 | public static final int DONUT = 4; |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 319 | |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 320 | /** |
Dianne Hackborn | 0fa3591 | 2009-10-23 12:32:45 -0700 | [diff] [blame] | 321 | * November 2009: Android 2.0 |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 322 | * |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 323 | * <p>Applications targeting this or a later release will get these |
| 324 | * new changes in behavior:</p> |
| 325 | * <ul> |
| 326 | * <li> The {@link android.app.Service#onStartCommand |
| 327 | * Service.onStartCommand} function will return the new |
| 328 | * {@link android.app.Service#START_STICKY} behavior instead of the |
| 329 | * old compatibility {@link android.app.Service#START_STICKY_COMPATIBILITY}. |
Dianne Hackborn | 8d37426 | 2009-09-14 21:21:52 -0700 | [diff] [blame] | 330 | * <li> The {@link android.app.Activity} class will now execute back |
| 331 | * key presses on the key up instead of key down, to be able to detect |
| 332 | * canceled presses from virtual keys. |
Mike Cleron | 7609764 | 2009-09-25 17:53:56 -0700 | [diff] [blame] | 333 | * <li> The {@link android.widget.TabWidget} class will use a new color scheme |
| 334 | * for tabs. In the new scheme, the foreground tab has a medium gray background |
| 335 | * the background tabs have a dark gray background. |
Dianne Hackborn | f6f9f2d | 2009-08-21 16:26:03 -0700 | [diff] [blame] | 336 | * </ul> |
| 337 | */ |
Jeff Hamilton | 6dc3f4e | 2009-10-10 12:06:19 -0500 | [diff] [blame] | 338 | public static final int ECLAIR = 5; |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 339 | |
Dianne Hackborn | 0fa3591 | 2009-10-23 12:32:45 -0700 | [diff] [blame] | 340 | /** |
Dianne Hackborn | 1778776 | 2009-11-12 16:11:36 -0800 | [diff] [blame] | 341 | * December 2009: Android 2.0.1 |
Dianne Hackborn | 0fa3591 | 2009-10-23 12:32:45 -0700 | [diff] [blame] | 342 | */ |
Dianne Hackborn | 1778776 | 2009-11-12 16:11:36 -0800 | [diff] [blame] | 343 | public static final int ECLAIR_0_1 = 6; |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 344 | |
Dianne Hackborn | 23ef7b4 | 2009-11-18 18:20:39 -0800 | [diff] [blame] | 345 | /** |
| 346 | * January 2010: Android 2.1 |
| 347 | */ |
| 348 | public static final int ECLAIR_MR1 = 7; |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 349 | |
Dianne Hackborn | 3e03cfa | 2010-06-13 12:07:00 -0700 | [diff] [blame] | 350 | /** |
| 351 | * June 2010: Android 2.2 |
| 352 | */ |
Adam Powell | 216bccf | 2010-02-01 15:03:17 -0800 | [diff] [blame] | 353 | public static final int FROYO = 8; |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 354 | |
Dianne Hackborn | 3e03cfa | 2010-06-13 12:07:00 -0700 | [diff] [blame] | 355 | /** |
Dianne Hackborn | 9d97b63 | 2011-01-23 14:56:39 -0800 | [diff] [blame] | 356 | * November 2010: Android 2.3 |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 357 | * |
| 358 | * <p>Applications targeting this or a later release will get these |
| 359 | * new changes in behavior:</p> |
| 360 | * <ul> |
| 361 | * <li> The application's notification icons will be shown on the new |
| 362 | * dark status bar background, so must be visible in this situation. |
| 363 | * </ul> |
Dianne Hackborn | 3e03cfa | 2010-06-13 12:07:00 -0700 | [diff] [blame] | 364 | */ |
Dianne Hackborn | 4fa1a22 | 2010-10-18 13:10:49 -0700 | [diff] [blame] | 365 | public static final int GINGERBREAD = 9; |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 366 | |
Dianne Hackborn | 9d97b63 | 2011-01-23 14:56:39 -0800 | [diff] [blame] | 367 | /** |
Dianne Hackborn | edf1fc6 | 2011-03-17 18:34:48 -0700 | [diff] [blame] | 368 | * February 2011: Android 2.3.3. |
Dianne Hackborn | 9d97b63 | 2011-01-23 14:56:39 -0800 | [diff] [blame] | 369 | */ |
| 370 | public static final int GINGERBREAD_MR1 = 10; |
Dianne Hackborn | b1ad597 | 2010-08-02 17:30:33 -0700 | [diff] [blame] | 371 | |
| 372 | /** |
Dianne Hackborn | edf1fc6 | 2011-03-17 18:34:48 -0700 | [diff] [blame] | 373 | * February 2011: Android 3.0. |
Dianne Hackborn | b1ad597 | 2010-08-02 17:30:33 -0700 | [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 | 3e6d50c | 2010-08-23 18:30:44 -0700 | [diff] [blame] | 378 | * <li> The default theme for applications is now dark holographic: |
| 379 | * {@link android.R.style#Theme_Holo}. |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 380 | * <li> On large screen devices that do not have a physical menu |
| 381 | * button, the soft (compatibility) menu is disabled. |
Dianne Hackborn | 0aae2d4 | 2010-12-07 23:51:29 -0800 | [diff] [blame] | 382 | * <li> The activity lifecycle has changed slightly as per |
| 383 | * {@link android.app.Activity}. |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 384 | * <li> An application will crash if it does not call through |
| 385 | * to the super implementation of its |
| 386 | * {@link android.app.Activity#onPause Activity.onPause()} method. |
Dianne Hackborn | 9d97b63 | 2011-01-23 14:56:39 -0800 | [diff] [blame] | 387 | * <li> When an application requires a permission to access one of |
Dianne Hackborn | 6c2c5fc | 2011-01-18 17:02:33 -0800 | [diff] [blame] | 388 | * its components (activity, receiver, service, provider), this |
| 389 | * permission is no longer enforced when the application wants to |
| 390 | * access its own component. This means it can require a permission |
| 391 | * on a component that it does not itself hold and still access that |
| 392 | * component. |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 393 | * <li> {@link android.content.Context#getSharedPreferences |
| 394 | * Context.getSharedPreferences()} will not automatically reload |
| 395 | * the preferences if they have changed on storage, unless |
| 396 | * {@link android.content.Context#MODE_MULTI_PROCESS} is used. |
| 397 | * <li> {@link android.view.ViewGroup#setMotionEventSplittingEnabled} |
| 398 | * will default to true. |
| 399 | * <li> {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH} |
| 400 | * is enabled by default on windows. |
| 401 | * <li> {@link android.widget.PopupWindow#isSplitTouchEnabled() |
| 402 | * PopupWindow.isSplitTouchEnabled()} will return true by default. |
| 403 | * <li> {@link android.widget.GridView} and {@link android.widget.ListView} |
| 404 | * will use {@link android.view.View#setActivated View.setActivated} |
| 405 | * for selected items if they do not implement {@link android.widget.Checkable}. |
| 406 | * <li> {@link android.widget.Scroller} will be constructed with |
| 407 | * "flywheel" behavior enabled by default. |
Dianne Hackborn | b1ad597 | 2010-08-02 17:30:33 -0700 | [diff] [blame] | 408 | * </ul> |
| 409 | */ |
Dianne Hackborn | 9d97b63 | 2011-01-23 14:56:39 -0800 | [diff] [blame] | 410 | public static final int HONEYCOMB = 11; |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 411 | |
Dianne Hackborn | edf1fc6 | 2011-03-17 18:34:48 -0700 | [diff] [blame] | 412 | /** |
Dianne Hackborn | a813873 | 2011-05-12 15:45:21 -0700 | [diff] [blame] | 413 | * May 2011: Android 3.1. |
Dianne Hackborn | edf1fc6 | 2011-03-17 18:34:48 -0700 | [diff] [blame] | 414 | */ |
| 415 | public static final int HONEYCOMB_MR1 = 12; |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 416 | |
Dianne Hackborn | a813873 | 2011-05-12 15:45:21 -0700 | [diff] [blame] | 417 | /** |
Dianne Hackborn | 426431a | 2011-06-09 11:29:08 -0700 | [diff] [blame] | 418 | * June 2011: Android 3.2. |
Dianne Hackborn | e667635 | 2011-06-01 16:51:20 -0700 | [diff] [blame] | 419 | * |
| 420 | * <p>Update to Honeycomb MR1 to support 7 inch tablets, improve |
| 421 | * screen compatibility mode, etc.</p> |
| 422 | * |
| 423 | * <p>As of this version, applications that don't say whether they |
| 424 | * support XLARGE screens will be assumed to do so only if they target |
| 425 | * {@link #HONEYCOMB} or later; it had been {@link #GINGERBREAD} or |
| 426 | * later. Applications that don't support a screen size at least as |
| 427 | * large as the current screen will provide the user with a UI to |
| 428 | * switch them in to screen size compatibility mode.</p> |
Dianne Hackborn | e289bff | 2011-06-13 19:33:22 -0700 | [diff] [blame] | 429 | * |
| 430 | * <p>This version introduces new screen size resource qualifiers |
| 431 | * based on the screen size in dp: see |
| 432 | * {@link android.content.res.Configuration#screenWidthDp}, |
| 433 | * {@link android.content.res.Configuration#screenHeightDp}, and |
| 434 | * {@link android.content.res.Configuration#smallestScreenWidthDp}. |
| 435 | * Supplying these in <supports-screens> as per |
| 436 | * {@link android.content.pm.ApplicationInfo#requiresSmallestWidthDp}, |
| 437 | * {@link android.content.pm.ApplicationInfo#compatibleWidthLimitDp}, and |
| 438 | * {@link android.content.pm.ApplicationInfo#largestWidthLimitDp} is |
| 439 | * preferred over the older screen size buckets and for older devices |
| 440 | * the appropriate buckets will be inferred from them.</p> |
| 441 | * |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 442 | * <p>Applications targeting this or a later release will get these |
| 443 | * new changes in behavior:</p> |
| 444 | * <ul> |
| 445 | * <li><p>New {@link android.content.pm.PackageManager#FEATURE_SCREEN_PORTRAIT} |
Dianne Hackborn | e289bff | 2011-06-13 19:33:22 -0700 | [diff] [blame] | 446 | * and {@link android.content.pm.PackageManager#FEATURE_SCREEN_LANDSCAPE} |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 447 | * features were introduced in this release. Applications that target |
Dianne Hackborn | e289bff | 2011-06-13 19:33:22 -0700 | [diff] [blame] | 448 | * previous platform versions are assumed to require both portrait and |
| 449 | * landscape support in the device; when targeting Honeycomb MR1 or |
| 450 | * greater the application is responsible for specifying any specific |
| 451 | * orientation it requires.</p> |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 452 | * <li><p>{@link android.os.AsyncTask} will use the serial executor |
| 453 | * by default when calling {@link android.os.AsyncTask#execute}.</p> |
| 454 | * <li><p>{@link android.content.pm.ActivityInfo#configChanges |
| 455 | * ActivityInfo.configChanges} will have the |
| 456 | * {@link android.content.pm.ActivityInfo#CONFIG_SCREEN_SIZE} and |
| 457 | * {@link android.content.pm.ActivityInfo#CONFIG_SMALLEST_SCREEN_SIZE} |
| 458 | * bits set; these need to be cleared for older applications because |
| 459 | * some developers have done absolute comparisons against this value |
| 460 | * instead of correctly masking the bits they are interested in. |
| 461 | * </ul> |
Dianne Hackborn | a813873 | 2011-05-12 15:45:21 -0700 | [diff] [blame] | 462 | */ |
Dianne Hackborn | 426431a | 2011-06-09 11:29:08 -0700 | [diff] [blame] | 463 | public static final int HONEYCOMB_MR2 = 13; |
Dianne Hackborn | 3fc982f | 2011-03-30 16:20:26 -0700 | [diff] [blame] | 464 | |
| 465 | /** |
Dianne Hackborn | f35fe23 | 2011-11-01 19:25:20 -0700 | [diff] [blame] | 466 | * October 2011: Android 4.0. |
Dianne Hackborn | 2d6833b | 2011-06-24 16:04:19 -0700 | [diff] [blame] | 467 | * |
| 468 | * <p>Applications targeting this or a later release will get these |
| 469 | * new changes in behavior:</p> |
| 470 | * <ul> |
Dianne Hackborn | 9d0e37e | 2011-09-22 12:58:54 -0700 | [diff] [blame] | 471 | * <li> For devices without a dedicated menu key, the software compatibility |
| 472 | * menu key will not be shown even on phones. By targeting Ice Cream Sandwich |
| 473 | * or later, your UI must always have its own menu UI affordance if needed, |
| 474 | * 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] | 475 | * <li> 2d drawing hardware acceleration is now turned on by default. |
| 476 | * You can use |
| 477 | * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated} |
| 478 | * to turn it off if needed, although this is strongly discouraged since |
| 479 | * it will result in poor performance on larger screen devices. |
Adam Powell | 6e90a36 | 2011-08-14 16:48:32 -0700 | [diff] [blame] | 480 | * <li> The default theme for applications is now the "device default" theme: |
| 481 | * {@link android.R.style#Theme_DeviceDefault}. This may be the |
| 482 | * holo dark theme or a different dark theme defined by the specific device. |
| 483 | * The {@link android.R.style#Theme_Holo} family must not be modified |
| 484 | * for a device to be considered compatible. Applications that explicitly |
| 485 | * request a theme from the Holo family will be guaranteed that these themes |
| 486 | * will not change character within the same platform version. Applications |
| 487 | * that wish to blend in with the device should use a theme from the |
| 488 | * {@link android.R.style#Theme_DeviceDefault} family. |
Dianne Hackborn | 9d0e37e | 2011-09-22 12:58:54 -0700 | [diff] [blame] | 489 | * <li> Managed cursors can now throw an exception if you directly close |
| 490 | * the cursor yourself without stopping the management of it; previously failures |
| 491 | * would be silently ignored. |
| 492 | * <li> The fadingEdge attribute on views will be ignored (fading edges is no |
| 493 | * longer a standard part of the UI). A new requiresFadingEdge attribute allows |
| 494 | * applications to still force fading edges on for special cases. |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 495 | * <li> {@link android.content.Context#bindService Context.bindService()} |
| 496 | * will not automatically add in {@link android.content.Context#BIND_WAIVE_PRIORITY}. |
| 497 | * <li> App Widgets will have standard padding automatically added around |
| 498 | * them, rather than relying on the padding being baked into the widget itself. |
| 499 | * <li> An exception will be thrown if you try to change the type of a |
| 500 | * window after it has been added to the window manager. Previously this |
| 501 | * would result in random incorrect behavior. |
| 502 | * <li> {@link android.view.animation.AnimationSet} will parse out |
| 503 | * the duration, fillBefore, fillAfter, repeatMode, and startOffset |
| 504 | * XML attributes that are defined. |
| 505 | * <li> {@link android.app.ActionBar#setHomeButtonEnabled |
| 506 | * ActionBar.setHomeButtonEnabled()} is false by default. |
Dianne Hackborn | 2d6833b | 2011-06-24 16:04:19 -0700 | [diff] [blame] | 507 | * </ul> |
Dianne Hackborn | 3fc982f | 2011-03-30 16:20:26 -0700 | [diff] [blame] | 508 | */ |
Dianne Hackborn | 0784cfb | 2011-09-14 13:48:15 -0700 | [diff] [blame] | 509 | public static final int ICE_CREAM_SANDWICH = 14; |
Dianne Hackborn | f35fe23 | 2011-11-01 19:25:20 -0700 | [diff] [blame] | 510 | |
| 511 | /** |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 512 | * December 2011: Android 4.0.3. |
Dianne Hackborn | f35fe23 | 2011-11-01 19:25:20 -0700 | [diff] [blame] | 513 | */ |
| 514 | public static final int ICE_CREAM_SANDWICH_MR1 = 15; |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 515 | |
| 516 | /** |
Dianne Hackborn | 435cdb4 | 2012-07-30 17:36:43 -0700 | [diff] [blame] | 517 | * June 2012: Android 4.1. |
Dianne Hackborn | 6569625 | 2012-03-05 18:49:21 -0800 | [diff] [blame] | 518 | * |
| 519 | * <p>Applications targeting this or a later release will get these |
| 520 | * new changes in behavior:</p> |
| 521 | * <ul> |
Dianne Hackborn | 636fd52 | 2012-06-05 17:38:50 -0700 | [diff] [blame] | 522 | * <li> You must explicitly request the {@link android.Manifest.permission#READ_CALL_LOG} |
| 523 | * and/or {@link android.Manifest.permission#WRITE_CALL_LOG} permissions; |
| 524 | * access to the call log is no longer implicitly provided through |
| 525 | * {@link android.Manifest.permission#READ_CONTACTS} and |
| 526 | * {@link android.Manifest.permission#WRITE_CONTACTS}. |
| 527 | * <li> {@link android.widget.RemoteViews} will throw an exception if |
| 528 | * setting an onClick handler for views being generated by a |
| 529 | * {@link android.widget.RemoteViewsService} for a collection container; |
| 530 | * previously this just resulted in a warning log message. |
| 531 | * <li> New {@link android.app.ActionBar} policy for embedded tabs: |
| 532 | * embedded tabs are now always stacked in the action bar when in portrait |
| 533 | * mode, regardless of the size of the screen. |
| 534 | * <li> {@link android.webkit.WebSettings#setAllowFileAccessFromFileURLs(boolean) |
| 535 | * WebSettings.setAllowFileAccessFromFileURLs} and |
| 536 | * {@link android.webkit.WebSettings#setAllowUniversalAccessFromFileURLs(boolean) |
| 537 | * WebSettings.setAllowUniversalAccessFromFileURLs} default to false. |
Dianne Hackborn | 6569625 | 2012-03-05 18:49:21 -0800 | [diff] [blame] | 538 | * <li> Calls to {@link android.content.pm.PackageManager#setComponentEnabledSetting |
| 539 | * PackageManager.setComponentEnabledSetting} will now throw an |
| 540 | * IllegalArgumentException if the given component class name does not |
| 541 | * exist in the application's manifest. |
Dianne Hackborn | 636fd52 | 2012-06-05 17:38:50 -0700 | [diff] [blame] | 542 | * <li> {@link android.nfc.NfcAdapter#setNdefPushMessage |
| 543 | * NfcAdapter.setNdefPushMessage}, |
| 544 | * {@link android.nfc.NfcAdapter#setNdefPushMessageCallback |
| 545 | * NfcAdapter.setNdefPushMessageCallback} and |
| 546 | * {@link android.nfc.NfcAdapter#setOnNdefPushCompleteCallback |
| 547 | * NfcAdapter.setOnNdefPushCompleteCallback} will throw |
| 548 | * IllegalStateException if called after the Activity has been destroyed. |
| 549 | * <li> Accessibility services must require the new |
| 550 | * {@link android.Manifest.permission#BIND_ACCESSIBILITY_SERVICE} permission or |
| 551 | * they will not be available for use. |
| 552 | * <li> {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_INCLUDE_NOT_IMPORTANT_VIEWS |
| 553 | * AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS} must be set |
| 554 | * for unimportant views to be included in queries. |
Dianne Hackborn | 6569625 | 2012-03-05 18:49:21 -0800 | [diff] [blame] | 555 | * </ul> |
Dianne Hackborn | 81e9276 | 2011-10-09 16:00:21 -0700 | [diff] [blame] | 556 | */ |
Dianne Hackborn | fa61f0b | 2012-05-09 21:49:38 -0700 | [diff] [blame] | 557 | public static final int JELLY_BEAN = 16; |
Dianne Hackborn | 435cdb4 | 2012-07-30 17:36:43 -0700 | [diff] [blame] | 558 | |
| 559 | /** |
Dianne Hackborn | 955d8d6 | 2014-10-07 20:17:19 -0700 | [diff] [blame] | 560 | * November 2012: Android 4.2, Moar jelly beans! |
Nick Kralevich | f097b16 | 2012-07-28 12:43:48 -0700 | [diff] [blame] | 561 | * |
| 562 | * <p>Applications targeting this or a later release will get these |
| 563 | * new changes in behavior:</p> |
| 564 | * <ul> |
| 565 | * <li>Content Providers: The default value of {@code android:exported} is now |
| 566 | * {@code false}. See |
Nick Kralevich | 2caec6c | 2012-08-08 11:33:17 -0700 | [diff] [blame] | 567 | * <a href="{@docRoot}guide/topics/manifest/provider-element.html#exported"> |
Nick Kralevich | f097b16 | 2012-07-28 12:43:48 -0700 | [diff] [blame] | 568 | * 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] | 569 | * <li>{@link android.view.View#getLayoutDirection() View.getLayoutDirection()} |
| 570 | * can return different values than {@link android.view.View#LAYOUT_DIRECTION_LTR} |
| 571 | * based on the locale etc. |
| 572 | * <li> {@link android.webkit.WebView#addJavascriptInterface(Object, String) |
| 573 | * WebView.addJavascriptInterface} requires explicit annotations on methods |
| 574 | * for them to be accessible from Javascript. |
Nick Kralevich | f097b16 | 2012-07-28 12:43:48 -0700 | [diff] [blame] | 575 | * </ul> |
Dianne Hackborn | 435cdb4 | 2012-07-30 17:36:43 -0700 | [diff] [blame] | 576 | */ |
| 577 | public static final int JELLY_BEAN_MR1 = 17; |
Nick Kralevich | a985c3b | 2013-01-09 16:03:14 -0800 | [diff] [blame] | 578 | |
| 579 | /** |
Dianne Hackborn | 955d8d6 | 2014-10-07 20:17:19 -0700 | [diff] [blame] | 580 | * July 2013: Android 4.3, the revenge of the beans. |
Nick Kralevich | a985c3b | 2013-01-09 16:03:14 -0800 | [diff] [blame] | 581 | */ |
Dianne Hackborn | d2eeed6 | 2013-04-22 13:04:28 -0700 | [diff] [blame] | 582 | public static final int JELLY_BEAN_MR2 = 18; |
Dianne Hackborn | 5d2bfa1 | 2013-03-05 10:28:34 -0800 | [diff] [blame] | 583 | |
| 584 | /** |
Dianne Hackborn | 955d8d6 | 2014-10-07 20:17:19 -0700 | [diff] [blame] | 585 | * October 2013: Android 4.4, KitKat, another tasty treat. |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 586 | * |
| 587 | * <p>Applications targeting this or a later release will get these |
| 588 | * new changes in behavior:</p> |
| 589 | * <ul> |
Mark Doliner | d0646dc | 2014-08-27 16:04:02 -0700 | [diff] [blame] | 590 | * <li> The default result of |
| 591 | * {@link android.preference.PreferenceActivity#isValidFragment(String) |
Dianne Hackborn | 6bc3789 | 2013-10-03 11:05:14 -0700 | [diff] [blame] | 592 | * PreferenceActivity.isValueFragment} becomes false instead of true.</li> |
| 593 | * <li> In {@link android.webkit.WebView}, apps targeting earlier versions will have |
| 594 | * JS URLs evaluated directly and any result of the evaluation will not replace |
| 595 | * the current page content. Apps targetting KITKAT or later that load a JS URL will |
| 596 | * have the result of that URL replace the content of the current page</li> |
| 597 | * <li> {@link android.app.AlarmManager#set AlarmManager.set} becomes interpreted as |
| 598 | * an inexact value, to give the system more flexibility in scheduling alarms.</li> |
| 599 | * <li> {@link android.content.Context#getSharedPreferences(String, int) |
| 600 | * Context.getSharedPreferences} no longer allows a null name.</li> |
| 601 | * <li> {@link android.widget.RelativeLayout} changes to compute wrapped content |
| 602 | * margins correctly.</li> |
| 603 | * <li> {@link android.app.ActionBar}'s window content overlay is allowed to be |
| 604 | * drawn.</li> |
Jeff Sharkey | 3ec2f60 | 2013-10-29 12:21:23 -0700 | [diff] [blame] | 605 | * <li>The {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} |
| 606 | * permission is now always enforced.</li> |
| 607 | * <li>Access to package-specific external storage directories belonging |
| 608 | * to the calling app no longer requires the |
| 609 | * {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} or |
| 610 | * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} |
| 611 | * permissions.</li> |
Dianne Hackborn | 221ea89 | 2013-08-04 16:50:16 -0700 | [diff] [blame] | 612 | * </ul> |
Dianne Hackborn | 5d2bfa1 | 2013-03-05 10:28:34 -0800 | [diff] [blame] | 613 | */ |
Dianne Hackborn | 6bc3789 | 2013-10-03 11:05:14 -0700 | [diff] [blame] | 614 | public static final int KITKAT = 19; |
Dianne Hackborn | 10ad982 | 2014-03-17 11:28:36 -0700 | [diff] [blame] | 615 | |
| 616 | /** |
Dianne Hackborn | e7a3435 | 2015-09-17 14:50:47 -0700 | [diff] [blame] | 617 | * June 2014: Android 4.4W. KitKat for watches, snacks on the run. |
Justin Koh | 78b94de | 2014-05-13 15:48:42 -0700 | [diff] [blame] | 618 | * |
| 619 | * <p>Applications targeting this or a later release will get these |
| 620 | * new changes in behavior:</p> |
| 621 | * <ul> |
| 622 | * <li>{@link android.app.AlertDialog} might not have a default background if the theme does |
| 623 | * not specify one.</li> |
| 624 | * </ul> |
Jeff Brown | 1c3f332 | 2014-04-16 13:15:22 -0700 | [diff] [blame] | 625 | */ |
Justin Koh | 78b94de | 2014-05-13 15:48:42 -0700 | [diff] [blame] | 626 | public static final int KITKAT_WATCH = 20; |
Jeff Brown | 047f3c7 | 2014-04-16 14:18:49 -0700 | [diff] [blame] | 627 | |
| 628 | /** |
Dianne Hackborn | 955d8d6 | 2014-10-07 20:17:19 -0700 | [diff] [blame] | 629 | * Temporary until we completely switch to {@link #LOLLIPOP}. |
Dianne Hackborn | d3511d4 | 2014-10-16 17:48:30 -0700 | [diff] [blame] | 630 | * @hide |
Dianne Hackborn | 955d8d6 | 2014-10-07 20:17:19 -0700 | [diff] [blame] | 631 | */ |
| 632 | public static final int L = 21; |
| 633 | |
| 634 | /** |
Dianne Hackborn | e7a3435 | 2015-09-17 14:50:47 -0700 | [diff] [blame] | 635 | * November 2014: Lollipop. A flat one with beautiful shadows. But still tasty. |
Dianne Hackborn | 10ad982 | 2014-03-17 11:28:36 -0700 | [diff] [blame] | 636 | * |
| 637 | * <p>Applications targeting this or a later release will get these |
| 638 | * new changes in behavior:</p> |
| 639 | * <ul> |
| 640 | * <li> {@link android.content.Context#bindService Context.bindService} now |
Michael Wright | 5b5def5 | 2014-04-11 13:37:50 -0700 | [diff] [blame] | 641 | * requires an explicit Intent, and will throw an exception if given an implicit |
Dianne Hackborn | 10ad982 | 2014-03-17 11:28:36 -0700 | [diff] [blame] | 642 | * Intent.</li> |
Dianne Hackborn | d3511d4 | 2014-10-16 17:48:30 -0700 | [diff] [blame] | 643 | * <li> {@link android.app.Notification.Builder Notification.Builder} will |
| 644 | * not have the colors of their various notification elements adjusted to better |
| 645 | * match the new material design look.</li> |
| 646 | * <li> {@link android.os.Message} will validate that a message is not currently |
| 647 | * in use when it is recycled.</li> |
| 648 | * <li> Hardware accelerated drawing in windows will be enabled automatically |
| 649 | * in most places.</li> |
| 650 | * <li> {@link android.widget.Spinner} throws an exception if attaching an |
| 651 | * adapter with more than one item type.</li> |
| 652 | * <li> If the app is a launcher, the launcher will be available to the user |
| 653 | * even when they are using corporate profiles (which requires that the app |
| 654 | * use {@link android.content.pm.LauncherApps} to correctly populate its |
| 655 | * apps UI).</li> |
| 656 | * <li> Calling {@link android.app.Service#stopForeground Service.stopForeground} |
| 657 | * with removeNotification false will modify the still posted notification so that |
| 658 | * it is no longer forced to be ongoing.</li> |
| 659 | * <li> A {@link android.service.dreams.DreamService} must require the |
| 660 | * {@link android.Manifest.permission#BIND_DREAM_SERVICE} permission to be usable.</li> |
Dianne Hackborn | 10ad982 | 2014-03-17 11:28:36 -0700 | [diff] [blame] | 661 | * </ul> |
| 662 | */ |
Dianne Hackborn | 955d8d6 | 2014-10-07 20:17:19 -0700 | [diff] [blame] | 663 | public static final int LOLLIPOP = 21; |
Dianne Hackborn | 3b69688 | 2014-10-16 18:14:12 -0700 | [diff] [blame] | 664 | |
| 665 | /** |
Dianne Hackborn | e7a3435 | 2015-09-17 14:50:47 -0700 | [diff] [blame] | 666 | * March 2015: Lollipop with an extra sugar coating on the outside! |
Dianne Hackborn | 3b69688 | 2014-10-16 18:14:12 -0700 | [diff] [blame] | 667 | */ |
| 668 | public static final int LOLLIPOP_MR1 = 22; |
Dianne Hackborn | 8bd95f1 | 2015-01-27 13:18:24 -0800 | [diff] [blame] | 669 | |
| 670 | /** |
Dianne Hackborn | e7a3435 | 2015-09-17 14:50:47 -0700 | [diff] [blame] | 671 | * M is for Marshmallow! |
| 672 | * |
| 673 | * <p>Applications targeting this or a later release will get these |
| 674 | * new changes in behavior:</p> |
| 675 | * <ul> |
| 676 | * <li> Runtime permissions. Dangerous permissions are no longer granted at |
| 677 | * install time, but must be requested by the application at runtime through |
| 678 | * {@link android.app.Activity#requestPermissions}.</li> |
| 679 | * <li> Bluetooth and Wi-Fi scanning now requires holding the location permission.</li> |
| 680 | * <li> {@link android.app.AlarmManager#setTimeZone AlarmManager.setTimeZone} will fail if |
| 681 | * the given timezone is non-Olson.</li> |
| 682 | * <li> Activity transitions will only return shared |
| 683 | * elements mapped in the returned view hierarchy back to the calling activity.</li> |
| 684 | * <li> {@link android.view.View} allows a number of behaviors that may break |
| 685 | * existing apps: Canvas throws an exception if restore() is called too many times, |
| 686 | * widgets may return a hint size when returning UNSPECIFIED measure specs, and it |
| 687 | * will respect the attributes {@link android.R.attr#foreground}, |
| 688 | * {@link android.R.attr#foregroundGravity}, {@link android.R.attr#foregroundTint}, and |
| 689 | * {@link android.R.attr#foregroundTintMode}.</li> |
| 690 | * <li> {@link android.view.MotionEvent#getButtonState MotionEvent.getButtonState} |
| 691 | * will no longer report {@link android.view.MotionEvent#BUTTON_PRIMARY} |
| 692 | * and {@link android.view.MotionEvent#BUTTON_SECONDARY} as synonyms for |
| 693 | * {@link android.view.MotionEvent#BUTTON_STYLUS_PRIMARY} and |
| 694 | * {@link android.view.MotionEvent#BUTTON_STYLUS_SECONDARY}.</li> |
| 695 | * <li> {@link android.widget.ScrollView} now respects the layout param margins |
| 696 | * when measuring.</li> |
| 697 | * </ul> |
Dianne Hackborn | 8bd95f1 | 2015-01-27 13:18:24 -0800 | [diff] [blame] | 698 | */ |
Dianne Hackborn | 0e3de6c | 2015-07-29 15:20:21 -0700 | [diff] [blame] | 699 | public static final int M = 23; |
Wale Ogunwale | 7911310 | 2015-10-05 16:52:53 -0700 | [diff] [blame] | 700 | |
| 701 | /** |
Dianne Hackborn | b34cbed | 2016-08-09 13:18:21 -0700 | [diff] [blame] | 702 | * N is for Nougat. |
| 703 | * |
| 704 | * <p>Applications targeting this or a later release will get these |
| 705 | * new changes in behavior:</p> |
| 706 | * <ul> |
| 707 | * <li> {@link android.app.DownloadManager.Request#setAllowedNetworkTypes |
| 708 | * DownloadManager.Request.setAllowedNetworkTypes} |
| 709 | * will disable "allow over metered" when specifying only |
Dianne Hackborn | 5f1649e | 2016-08-09 18:00:31 -0700 | [diff] [blame] | 710 | * {@link android.app.DownloadManager.Request#NETWORK_WIFI}.</li> |
Dianne Hackborn | b34cbed | 2016-08-09 13:18:21 -0700 | [diff] [blame] | 711 | * <li> {@link android.app.DownloadManager} no longer allows access to raw |
Dianne Hackborn | 5f1649e | 2016-08-09 18:00:31 -0700 | [diff] [blame] | 712 | * file paths.</li> |
Dianne Hackborn | b34cbed | 2016-08-09 13:18:21 -0700 | [diff] [blame] | 713 | * <li> {@link android.app.Notification.Builder#setShowWhen |
| 714 | * Notification.Builder.setShowWhen} |
| 715 | * must be called explicitly to have the time shown, and various other changes in |
| 716 | * {@link android.app.Notification.Builder Notification.Builder} to how notifications |
| 717 | * are shown.</li> |
| 718 | * <li>{@link android.content.Context#MODE_WORLD_READABLE} and |
| 719 | * {@link android.content.Context#MODE_WORLD_WRITEABLE} are no longer supported.</li> |
| 720 | * <li>{@link android.os.FileUriExposedException} will be thrown to applications.</li> |
| 721 | * <li>Applications will see global drag and drops as per |
| 722 | * {@link android.view.View#DRAG_FLAG_GLOBAL}.</li> |
| 723 | * <li>{@link android.webkit.WebView#evaluateJavascript WebView.evaluateJavascript} |
| 724 | * will not persist state from an empty WebView.</li> |
| 725 | * <li>{@link android.animation.AnimatorSet} will not ignore calls to end() before |
| 726 | * start().</li> |
| 727 | * <li>{@link android.app.AlarmManager#cancel(android.app.PendingIntent) |
| 728 | * AlarmManager.cancel} will throw a NullPointerException if given a null operation.</li> |
| 729 | * <li>{@link android.app.FragmentManager} will ensure fragments have been created |
| 730 | * before being placed on the back stack.</li> |
| 731 | * <li>{@link android.app.FragmentManager} restores fragments in |
| 732 | * {@link android.app.Fragment#onCreate Fragment.onCreate} rather than after the |
| 733 | * method returns.</li> |
| 734 | * <li>{@link android.R.attr#resizeableActivity} defaults to true.</li> |
| 735 | * <li>{@link android.graphics.drawable.AnimatedVectorDrawable} throws exceptions when |
| 736 | * opening invalid VectorDrawable animations.</li> |
| 737 | * <li>{@link android.view.ViewGroup.MarginLayoutParams} will no longer be dropped |
| 738 | * when converting between some types of layout params (such as |
| 739 | * {@link android.widget.LinearLayout.LayoutParams LinearLayout.LayoutParams} to |
| 740 | * {@link android.widget.RelativeLayout.LayoutParams RelativeLayout.LayoutParams}).</li> |
| 741 | * <li>Your application processes will not be killed when the device density changes.</li> |
Vadim Tryshev | 06b9b60 | 2016-09-23 15:32:33 -0700 | [diff] [blame] | 742 | * <li>Drag and drop. After a view receives the |
| 743 | * {@link android.view.DragEvent#ACTION_DRAG_ENTERED} event, when the drag shadow moves into |
| 744 | * a descendant view that can accept the data, the view receives the |
| 745 | * {@link android.view.DragEvent#ACTION_DRAG_EXITED} event and won’t receive |
| 746 | * {@link android.view.DragEvent#ACTION_DRAG_LOCATION} and |
| 747 | * {@link android.view.DragEvent#ACTION_DROP} events while the drag shadow is within that |
| 748 | * descendant view, even if the descendant view returns <code>false</code> from its handler |
| 749 | * for these events.</li> |
Dianne Hackborn | b34cbed | 2016-08-09 13:18:21 -0700 | [diff] [blame] | 750 | * </ul> |
Wale Ogunwale | 7911310 | 2015-10-05 16:52:53 -0700 | [diff] [blame] | 751 | */ |
Adam Powell | 43ec62a | 2016-05-25 16:36:41 -0700 | [diff] [blame] | 752 | public static final int N = 24; |
Michael Wright | 863ae3e | 2016-06-29 15:47:16 +0100 | [diff] [blame] | 753 | |
| 754 | /** |
Dianne Hackborn | c1b607d | 2016-08-12 16:15:44 -0700 | [diff] [blame] | 755 | * N MR1: Nougat++. |
Michael Wright | 863ae3e | 2016-06-29 15:47:16 +0100 | [diff] [blame] | 756 | */ |
| 757 | public static final int N_MR1 = 25; |
Makoto Onuki | 864f4bd | 2016-11-02 11:11:32 -0700 | [diff] [blame] | 758 | |
| 759 | /** |
| 760 | * O. |
| 761 | */ |
| 762 | public static final int O = CUR_DEVELOPMENT; // STOPSHIP Replace with the real version. |
Dianne Hackborn | 851a541 | 2009-05-08 12:06:44 -0700 | [diff] [blame] | 763 | } |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 764 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 765 | /** The type of build, like "user" or "eng". */ |
| 766 | public static final String TYPE = getString("ro.build.type"); |
| 767 | |
| 768 | /** Comma-separated tags describing the build, like "unsigned,debug". */ |
| 769 | public static final String TAGS = getString("ro.build.tags"); |
| 770 | |
| 771 | /** A string that uniquely identifies this build. Do not attempt to parse this value. */ |
Jeff Sharkey | 5568772 | 2014-04-09 18:07:19 -0700 | [diff] [blame] | 772 | public static final String FINGERPRINT = deriveFingerprint(); |
| 773 | |
| 774 | /** |
| 775 | * Some devices split the fingerprint components between multiple |
| 776 | * partitions, so we might derive the fingerprint at runtime. |
| 777 | */ |
| 778 | private static String deriveFingerprint() { |
| 779 | String finger = SystemProperties.get("ro.build.fingerprint"); |
| 780 | if (TextUtils.isEmpty(finger)) { |
| 781 | finger = getString("ro.product.brand") + '/' + |
| 782 | getString("ro.product.name") + '/' + |
| 783 | getString("ro.product.device") + ':' + |
| 784 | getString("ro.build.version.release") + '/' + |
| 785 | getString("ro.build.id") + '/' + |
| 786 | getString("ro.build.version.incremental") + ':' + |
| 787 | getString("ro.build.type") + '/' + |
| 788 | getString("ro.build.tags"); |
| 789 | } |
| 790 | return finger; |
| 791 | } |
| 792 | |
| 793 | /** |
| 794 | * Ensure that raw fingerprint system property is defined. If it was derived |
| 795 | * dynamically by {@link #deriveFingerprint()} this is where we push the |
| 796 | * derived value into the property service. |
| 797 | * |
| 798 | * @hide |
| 799 | */ |
| 800 | public static void ensureFingerprintProperty() { |
| 801 | if (TextUtils.isEmpty(SystemProperties.get("ro.build.fingerprint"))) { |
Jeff Sharkey | bdd4491 | 2014-04-11 16:30:14 -0700 | [diff] [blame] | 802 | try { |
| 803 | SystemProperties.set("ro.build.fingerprint", FINGERPRINT); |
| 804 | } catch (IllegalArgumentException e) { |
| 805 | Slog.e(TAG, "Failed to set fingerprint property", e); |
| 806 | } |
Jeff Sharkey | 5568772 | 2014-04-09 18:07:19 -0700 | [diff] [blame] | 807 | } |
| 808 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 809 | |
Jeff Sharkey | 2cffc7d | 2014-11-14 13:57:53 -0800 | [diff] [blame] | 810 | /** |
Andres Morales | fd282ed | 2015-02-06 15:07:59 -0800 | [diff] [blame] | 811 | * Verifies the the current flash of the device is consistent with what |
| 812 | * was expected at build time. |
| 813 | * 1) Checks that device fingerprint is defined and that it matches across |
| 814 | * various partitions. |
| 815 | * 2) Verifies radio and bootloader partitions are those expected in the build. |
Jeff Sharkey | 2cffc7d | 2014-11-14 13:57:53 -0800 | [diff] [blame] | 816 | * |
| 817 | * @hide |
| 818 | */ |
Andres Morales | fd282ed | 2015-02-06 15:07:59 -0800 | [diff] [blame] | 819 | public static boolean isBuildConsistent() { |
Xiaohui Chen | 2102dcb | 2015-10-02 16:45:55 -0700 | [diff] [blame] | 820 | // Don't care on eng builds. Incremental build may trigger false negative. |
| 821 | if ("eng".equals(TYPE)) return true; |
| 822 | |
Jeff Sharkey | 2cffc7d | 2014-11-14 13:57:53 -0800 | [diff] [blame] | 823 | final String system = SystemProperties.get("ro.build.fingerprint"); |
| 824 | final String vendor = SystemProperties.get("ro.vendor.build.fingerprint"); |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 825 | final String bootimage = SystemProperties.get("ro.bootimage.build.fingerprint"); |
Andres Morales | fd282ed | 2015-02-06 15:07:59 -0800 | [diff] [blame] | 826 | final String requiredBootloader = SystemProperties.get("ro.build.expect.bootloader"); |
| 827 | final String currentBootloader = SystemProperties.get("ro.bootloader"); |
| 828 | final String requiredRadio = SystemProperties.get("ro.build.expect.baseband"); |
| 829 | final String currentRadio = SystemProperties.get("gsm.version.baseband"); |
Jeff Sharkey | 2cffc7d | 2014-11-14 13:57:53 -0800 | [diff] [blame] | 830 | |
| 831 | if (TextUtils.isEmpty(system)) { |
| 832 | Slog.e(TAG, "Required ro.build.fingerprint is empty!"); |
| 833 | return false; |
| 834 | } |
| 835 | |
| 836 | if (!TextUtils.isEmpty(vendor)) { |
| 837 | if (!Objects.equals(system, vendor)) { |
| 838 | Slog.e(TAG, "Mismatched fingerprints; system reported " + system |
| 839 | + " but vendor reported " + vendor); |
| 840 | return false; |
| 841 | } |
| 842 | } |
| 843 | |
Andres Morales | c97b92e | 2015-06-01 17:50:43 +0000 | [diff] [blame] | 844 | /* TODO: Figure out issue with checks failing |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 845 | if (!TextUtils.isEmpty(bootimage)) { |
Andres Morales | 7de24ce | 2015-01-23 12:45:54 -0800 | [diff] [blame] | 846 | if (!Objects.equals(system, bootimage)) { |
| 847 | Slog.e(TAG, "Mismatched fingerprints; system reported " + system |
Andres Morales | cb3fd69 | 2015-01-14 10:07:55 -0800 | [diff] [blame] | 848 | + " but bootimage reported " + bootimage); |
| 849 | return false; |
| 850 | } |
| 851 | } |
| 852 | |
Andres Morales | fd282ed | 2015-02-06 15:07:59 -0800 | [diff] [blame] | 853 | if (!TextUtils.isEmpty(requiredBootloader)) { |
| 854 | if (!Objects.equals(currentBootloader, requiredBootloader)) { |
| 855 | Slog.e(TAG, "Mismatched bootloader version: build requires " + requiredBootloader |
| 856 | + " but runtime reports " + currentBootloader); |
| 857 | return false; |
| 858 | } |
| 859 | } |
| 860 | |
| 861 | if (!TextUtils.isEmpty(requiredRadio)) { |
| 862 | if (!Objects.equals(currentRadio, requiredRadio)) { |
| 863 | Slog.e(TAG, "Mismatched radio version: build requires " + requiredRadio |
| 864 | + " but runtime reports " + currentRadio); |
| 865 | return false; |
| 866 | } |
| 867 | } |
Daniel Rosenberg | 159c205 | 2015-02-20 13:10:26 -0800 | [diff] [blame] | 868 | */ |
Andres Morales | fd282ed | 2015-02-06 15:07:59 -0800 | [diff] [blame] | 869 | |
Jeff Sharkey | 2cffc7d | 2014-11-14 13:57:53 -0800 | [diff] [blame] | 870 | return true; |
| 871 | } |
| 872 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 873 | // The following properties only make sense for internal engineering builds. |
| 874 | public static final long TIME = getLong("ro.build.date.utc") * 1000; |
| 875 | public static final String USER = getString("ro.build.user"); |
| 876 | public static final String HOST = getString("ro.build.host"); |
| 877 | |
Doug Zongker | ad2171a | 2011-06-14 11:07:24 -0700 | [diff] [blame] | 878 | /** |
Jeff Brown | 89101cd9 | 2011-10-27 21:24:54 -0700 | [diff] [blame] | 879 | * Returns true if we are running a debug build such as "user-debug" or "eng". |
| 880 | * @hide |
| 881 | */ |
| 882 | public static final boolean IS_DEBUGGABLE = |
| 883 | SystemProperties.getInt("ro.debuggable", 0) == 1; |
| 884 | |
| 885 | /** |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 886 | * Specifies whether the permissions needed by a legacy app should be |
| 887 | * reviewed before any of its components can run. A legacy app is one |
| 888 | * with targetSdkVersion < 23, i.e apps using the old permission model. |
| 889 | * If review is not required, permissions are reviewed before the app |
| 890 | * is installed. |
| 891 | * |
| 892 | * @hide |
Svet Ganov | 77df6f3 | 2016-08-17 11:46:34 -0700 | [diff] [blame] | 893 | * @removed |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 894 | */ |
Svet Ganov | ae0e03a | 2016-02-25 18:22:10 -0800 | [diff] [blame] | 895 | @SystemApi |
Svet Ganov | 9c165d7 | 2015-12-01 19:52:26 -0800 | [diff] [blame] | 896 | public static final boolean PERMISSIONS_REVIEW_REQUIRED = |
| 897 | SystemProperties.getInt("ro.permission_review_required", 0) == 1; |
| 898 | |
| 899 | /** |
Doug Zongker | ad2171a | 2011-06-14 11:07:24 -0700 | [diff] [blame] | 900 | * Returns the version string for the radio firmware. May return |
| 901 | * null (if, for instance, the radio is not currently on). |
| 902 | */ |
| 903 | public static String getRadioVersion() { |
| 904 | return SystemProperties.get(TelephonyProperties.PROPERTY_BASEBAND_VERSION, null); |
| 905 | } |
| 906 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 907 | private static String getString(String property) { |
| 908 | return SystemProperties.get(property, UNKNOWN); |
| 909 | } |
| 910 | |
Torne (Richard Coles) | ff701a6 | 2014-07-30 12:11:15 +0100 | [diff] [blame] | 911 | private static String[] getStringList(String property, String separator) { |
| 912 | String value = SystemProperties.get(property); |
| 913 | if (value.isEmpty()) { |
| 914 | return new String[0]; |
| 915 | } else { |
| 916 | return value.split(separator); |
| 917 | } |
| 918 | } |
| 919 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 920 | private static long getLong(String property) { |
| 921 | try { |
| 922 | return Long.parseLong(SystemProperties.get(property)); |
| 923 | } catch (NumberFormatException e) { |
| 924 | return -1; |
| 925 | } |
| 926 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 927 | } |