blob: d0029e192d3190ead7b4c844b600f7d84c62feb1 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.os;
18
Jeff Sharkey55687722014-04-09 18:07:19 -070019import android.text.TextUtils;
Jeff Sharkeybdd44912014-04-11 16:30:14 -070020import android.util.Slog;
Jeff Sharkey55687722014-04-09 18:07:19 -070021
Doug Zongkerad2171a2011-06-14 11:07:24 -070022import com.android.internal.telephony.TelephonyProperties;
Jeff Sharkey2cffc7d2014-11-14 13:57:53 -080023
Narayan Kamatheff258c2014-09-30 13:20:57 +010024import dalvik.system.VMRuntime;
Doug Zongkerad2171a2011-06-14 11:07:24 -070025
Jeff Sharkey2cffc7d2014-11-14 13:57:53 -080026import java.util.Objects;
27
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080028/**
29 * Information about the current build, extracted from system properties.
30 */
31public class Build {
Jeff Sharkeybdd44912014-04-11 16:30:14 -070032 private static final String TAG = "Build";
33
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080034 /** Value used for when a build property is unknown. */
Ficus Kirkpatrick71de7852010-01-08 13:10:51 -080035 public static final String UNKNOWN = "unknown";
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080036
37 /** Either a changelist number, or a label like "M4-rc20". */
38 public static final String ID = getString("ro.build.id");
39
40 /** A build ID string meant for displaying to the user */
41 public static final String DISPLAY = getString("ro.build.display.id");
42
43 /** The name of the overall product. */
44 public static final String PRODUCT = getString("ro.product.name");
45
46 /** The name of the industrial design. */
47 public static final String DEVICE = getString("ro.product.device");
48
49 /** The name of the underlying board, like "goldfish". */
50 public static final String BOARD = getString("ro.product.board");
51
Narayan Kamath1adf4002014-07-12 11:46:37 +010052 /**
53 * The name of the instruction set (CPU type + ABI convention) of native code.
54 *
55 * @deprecated Use {@link #SUPPORTED_ABIS} instead.
56 */
57 @Deprecated
Narayan Kamatheff258c2014-09-30 13:20:57 +010058 public static final String CPU_ABI;
Dianne Hackbornb1811182009-05-21 15:45:42 -070059
Narayan Kamath1adf4002014-07-12 11:46:37 +010060 /**
61 * The name of the second instruction set (CPU type + ABI convention) of native code.
62 *
63 * @deprecated Use {@link #SUPPORTED_ABIS} instead.
64 */
65 @Deprecated
Narayan Kamatheff258c2014-09-30 13:20:57 +010066 public static final String CPU_ABI2;
Ficus Kirkpatrickfa9cafa2010-01-06 17:37:13 -080067
Dianne Hackbornd62ad4f2009-05-19 19:06:25 -070068 /** The manufacturer of the product/hardware. */
69 public static final String MANUFACTURER = getString("ro.product.manufacturer");
70
Dirk Dougherty491b40d2013-10-29 18:33:29 -070071 /** The consumer-visible brand with which the product/hardware will be associated, if any. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080072 public static final String BRAND = getString("ro.product.brand");
73
74 /** The end-user-visible name for the end product. */
75 public static final String MODEL = getString("ro.product.model");
76
Doug Zongker74885ef2010-02-02 17:39:26 -080077 /** The system bootloader version number. */
Dan Egnor42471dd2010-01-07 17:25:22 -080078 public static final String BOOTLOADER = getString("ro.bootloader");
79
Doug Zongkerad2171a2011-06-14 11:07:24 -070080 /**
81 * The radio firmware version number.
82 *
83 * @deprecated The radio firmware version is frequently not
84 * available when this class is initialized, leading to a blank or
85 * "unknown" value for this string. Use
86 * {@link #getRadioVersion} instead.
87 */
88 @Deprecated
89 public static final String RADIO = getString(TelephonyProperties.PROPERTY_BASEBAND_VERSION);
Dan Egnor42471dd2010-01-07 17:25:22 -080090
Doug Zongker74885ef2010-02-02 17:39:26 -080091 /** The name of the hardware (from the kernel command line or /proc). */
92 public static final String HARDWARE = getString("ro.hardware");
Dan Egnor42471dd2010-01-07 17:25:22 -080093
Griff Hazend3c454d2016-03-25 07:30:34 -070094 /**
95 * Whether this build was for an emulator device.
96 * @hide
97 */
98 public static final boolean IS_EMULATOR = getString("ro.kernel.qemu").equals("1");
99
Andres Moralescb3fd692015-01-14 10:07:55 -0800100 /** A hardware serial number, if available. Alphanumeric only, case-insensitive. */
Doug Zongker7d2e3df2010-08-11 16:58:04 -0700101 public static final String SERIAL = getString("ro.serialno");
Ramin Zaghi1378aba2014-02-28 15:03:19 +0000102
103 /**
Narayan Kamath0f206a12014-04-12 11:41:13 +0100104 * An ordered list of ABIs supported by this device. The most preferred ABI is the first
105 * element in the list.
106 *
107 * See {@link #SUPPORTED_32_BIT_ABIS} and {@link #SUPPORTED_64_BIT_ABIS}.
Ramin Zaghi1378aba2014-02-28 15:03:19 +0000108 */
Torne (Richard Coles)ff701a62014-07-30 12:11:15 +0100109 public static final String[] SUPPORTED_ABIS = getStringList("ro.product.cpu.abilist", ",");
Ramin Zaghi1378aba2014-02-28 15:03:19 +0000110
Narayan Kamath0f206a12014-04-12 11:41:13 +0100111 /**
112 * An ordered list of <b>32 bit</b> ABIs supported by this device. The most preferred ABI
113 * is the first element in the list.
114 *
115 * See {@link #SUPPORTED_ABIS} and {@link #SUPPORTED_64_BIT_ABIS}.
Narayan Kamath0f206a12014-04-12 11:41:13 +0100116 */
Torne (Richard Coles)da8c0372014-05-14 16:17:26 +0100117 public static final String[] SUPPORTED_32_BIT_ABIS =
Torne (Richard Coles)ff701a62014-07-30 12:11:15 +0100118 getStringList("ro.product.cpu.abilist32", ",");
Narayan Kamath0f206a12014-04-12 11:41:13 +0100119
120 /**
121 * An ordered list of <b>64 bit</b> ABIs supported by this device. The most preferred ABI
122 * is the first element in the list.
123 *
124 * See {@link #SUPPORTED_ABIS} and {@link #SUPPORTED_32_BIT_ABIS}.
Narayan Kamath0f206a12014-04-12 11:41:13 +0100125 */
Torne (Richard Coles)da8c0372014-05-14 16:17:26 +0100126 public static final String[] SUPPORTED_64_BIT_ABIS =
Torne (Richard Coles)ff701a62014-07-30 12:11:15 +0100127 getStringList("ro.product.cpu.abilist64", ",");
Narayan Kamath0f206a12014-04-12 11:41:13 +0100128
129
Narayan Kamatheff258c2014-09-30 13:20:57 +0100130 static {
131 /*
132 * Adjusts CPU_ABI and CPU_ABI2 depending on whether or not a given process is 64 bit.
133 * 32 bit processes will always see 32 bit ABIs in these fields for backward
134 * compatibility.
135 */
136 final String[] abiList;
137 if (VMRuntime.getRuntime().is64Bit()) {
138 abiList = SUPPORTED_64_BIT_ABIS;
139 } else {
140 abiList = SUPPORTED_32_BIT_ABIS;
141 }
142
143 CPU_ABI = abiList[0];
144 if (abiList.length > 1) {
145 CPU_ABI2 = abiList[1];
146 } else {
147 CPU_ABI2 = "";
148 }
149 }
150
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800151 /** Various version strings. */
152 public static class VERSION {
153 /**
154 * The internal value used by the underlying source control to
155 * represent this build. E.g., a perforce changelist number
156 * or a git hash.
157 */
158 public static final String INCREMENTAL = getString("ro.build.version.incremental");
159
160 /**
161 * The user-visible version string. E.g., "1.0" or "3.4b5".
162 */
163 public static final String RELEASE = getString("ro.build.version.release");
164
165 /**
Dianne Hackbornc3f74492015-08-12 16:10:58 -0700166 * The base OS build the product is based on.
167 */
168 public static final String BASE_OS = SystemProperties.get("ro.build.version.base_os", "");
169
170 /**
171 * The user-visible security patch level.
172 */
173 public static final String SECURITY_PATCH = SystemProperties.get(
174 "ro.build.version.security_patch", "");
175
176 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700177 * The user-visible SDK version of the framework in its raw String
178 * representation; use {@link #SDK_INT} instead.
Andres Moralescb3fd692015-01-14 10:07:55 -0800179 *
Dianne Hackborn851a5412009-05-08 12:06:44 -0700180 * @deprecated Use {@link #SDK_INT} to easily get this as an integer.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800181 */
Dianne Hackborn4a51c202009-08-21 15:14:02 -0700182 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800183 public static final String SDK = getString("ro.build.version.sdk");
Dianne Hackborn851a5412009-05-08 12:06:44 -0700184
185 /**
186 * The user-visible SDK version of the framework; its possible
187 * values are defined in {@link Build.VERSION_CODES}.
188 */
189 public static final int SDK_INT = SystemProperties.getInt(
190 "ro.build.version.sdk", 0);
191
192 /**
Adam Powelle9600302015-05-06 18:13:09 -0700193 * The developer preview revision of a prerelease SDK. This value will always
194 * be <code>0</code> on production platform builds/devices.
195 *
196 * <p>When this value is nonzero, any new API added since the last
197 * officially published {@link #SDK_INT API level} is only guaranteed to be present
198 * on that specific preview revision. For example, an API <code>Activity.fooBar()</code>
199 * might be present in preview revision 1 but renamed or removed entirely in
200 * preview revision 2, which may cause an app attempting to call it to crash
201 * at runtime.</p>
202 *
203 * <p>Experimental apps targeting preview APIs should check this value for
204 * equality (<code>==</code>) with the preview SDK revision they were built for
205 * before using any prerelease platform APIs. Apps that detect a preview SDK revision
206 * other than the specific one they expect should fall back to using APIs from
207 * the previously published API level only to avoid unwanted runtime exceptions.
208 * </p>
209 */
210 public static final int PREVIEW_SDK_INT = SystemProperties.getInt(
211 "ro.build.version.preview_sdk", 0);
212
213 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700214 * The current development codename, or the string "REL" if this is
215 * a release build.
216 */
217 public static final String CODENAME = getString("ro.build.version.codename");
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800218
Dianne Hackbornffcda102014-04-24 13:06:27 -0700219 private static final String[] ALL_CODENAMES
Torne (Richard Coles)ff701a62014-07-30 12:11:15 +0100220 = getStringList("ro.build.version.all_codenames", ",");
Dianne Hackbornffcda102014-04-24 13:06:27 -0700221
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800222 /**
Dianne Hackborn3b81bc12011-01-15 11:50:52 -0800223 * @hide
224 */
Dianne Hackbornffcda102014-04-24 13:06:27 -0700225 public static final String[] ACTIVE_CODENAMES = "REL".equals(ALL_CODENAMES[0])
226 ? new String[0] : ALL_CODENAMES;
227
228 /**
229 * The SDK version to use when accessing resources.
230 * Use the current SDK version code. For every active development codename
231 * we are operating under, we bump the assumed resource platform version by 1.
232 * @hide
233 */
234 public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800235 }
236
Dianne Hackborn851a5412009-05-08 12:06:44 -0700237 /**
238 * Enumeration of the currently known SDK version codes. These are the
239 * values that can be found in {@link VERSION#SDK}. Version numbers
240 * increment monotonically with each official platform release.
241 */
242 public static class VERSION_CODES {
243 /**
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700244 * Magic version number for a current development build, which has
245 * not yet turned into an official release.
246 */
247 public static final int CUR_DEVELOPMENT = 10000;
Andres Moralescb3fd692015-01-14 10:07:55 -0800248
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700249 /**
Dianne Hackborn851a5412009-05-08 12:06:44 -0700250 * October 2008: The original, first, version of Android. Yay!
251 */
252 public static final int BASE = 1;
Andres Moralescb3fd692015-01-14 10:07:55 -0800253
Dianne Hackborn851a5412009-05-08 12:06:44 -0700254 /**
255 * February 2009: First Android update, officially called 1.1.
256 */
257 public static final int BASE_1_1 = 2;
Andres Moralescb3fd692015-01-14 10:07:55 -0800258
Dianne Hackborn851a5412009-05-08 12:06:44 -0700259 /**
260 * May 2009: Android 1.5.
261 */
262 public static final int CUPCAKE = 3;
Andres Moralescb3fd692015-01-14 10:07:55 -0800263
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700264 /**
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700265 * September 2009: Android 1.6.
Andres Moralescb3fd692015-01-14 10:07:55 -0800266 *
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700267 * <p>Applications targeting this or a later release will get these
268 * new changes in behavior:</p>
269 * <ul>
270 * <li> They must explicitly request the
San Mehat5a3a77d2009-06-01 09:25:28 -0700271 * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission to be
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700272 * able to modify the contents of the SD card. (Apps targeting
273 * earlier versions will always request the permission.)
Dianne Hackbornfe77ec82009-08-12 16:53:56 -0700274 * <li> They must explicitly request the
275 * {@link android.Manifest.permission#READ_PHONE_STATE} permission to be
276 * able to be able to retrieve phone state info. (Apps targeting
277 * earlier versions will always request the permission.)
278 * <li> They are assumed to support different screen densities and
279 * sizes. (Apps targeting earlier versions are assumed to only support
280 * medium density normal size screens unless otherwise indicated).
281 * They can still explicitly specify screen support either way with the
282 * supports-screens manifest tag.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700283 * <li> {@link android.widget.TabHost} will use the new dark tab
284 * background design.
Dianne Hackborna96cbb42009-05-13 15:06:13 -0700285 * </ul>
286 */
Dianne Hackbornfe77ec82009-08-12 16:53:56 -0700287 public static final int DONUT = 4;
Andres Moralescb3fd692015-01-14 10:07:55 -0800288
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700289 /**
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700290 * November 2009: Android 2.0
Andres Moralescb3fd692015-01-14 10:07:55 -0800291 *
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700292 * <p>Applications targeting this or a later release will get these
293 * new changes in behavior:</p>
294 * <ul>
295 * <li> The {@link android.app.Service#onStartCommand
296 * Service.onStartCommand} function will return the new
297 * {@link android.app.Service#START_STICKY} behavior instead of the
298 * old compatibility {@link android.app.Service#START_STICKY_COMPATIBILITY}.
Dianne Hackborn8d374262009-09-14 21:21:52 -0700299 * <li> The {@link android.app.Activity} class will now execute back
300 * key presses on the key up instead of key down, to be able to detect
301 * canceled presses from virtual keys.
Mike Cleron76097642009-09-25 17:53:56 -0700302 * <li> The {@link android.widget.TabWidget} class will use a new color scheme
303 * for tabs. In the new scheme, the foreground tab has a medium gray background
304 * the background tabs have a dark gray background.
Dianne Hackbornf6f9f2d2009-08-21 16:26:03 -0700305 * </ul>
306 */
Jeff Hamilton6dc3f4e2009-10-10 12:06:19 -0500307 public static final int ECLAIR = 5;
Andres Moralescb3fd692015-01-14 10:07:55 -0800308
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700309 /**
Dianne Hackborn17787762009-11-12 16:11:36 -0800310 * December 2009: Android 2.0.1
Dianne Hackborn0fa35912009-10-23 12:32:45 -0700311 */
Dianne Hackborn17787762009-11-12 16:11:36 -0800312 public static final int ECLAIR_0_1 = 6;
Andres Moralescb3fd692015-01-14 10:07:55 -0800313
Dianne Hackborn23ef7b42009-11-18 18:20:39 -0800314 /**
315 * January 2010: Android 2.1
316 */
317 public static final int ECLAIR_MR1 = 7;
Andres Moralescb3fd692015-01-14 10:07:55 -0800318
Dianne Hackborn3e03cfa2010-06-13 12:07:00 -0700319 /**
320 * June 2010: Android 2.2
321 */
Adam Powell216bccf2010-02-01 15:03:17 -0800322 public static final int FROYO = 8;
Andres Moralescb3fd692015-01-14 10:07:55 -0800323
Dianne Hackborn3e03cfa2010-06-13 12:07:00 -0700324 /**
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800325 * November 2010: Android 2.3
Dianne Hackborn81e92762011-10-09 16:00:21 -0700326 *
327 * <p>Applications targeting this or a later release will get these
328 * new changes in behavior:</p>
329 * <ul>
330 * <li> The application's notification icons will be shown on the new
331 * dark status bar background, so must be visible in this situation.
332 * </ul>
Dianne Hackborn3e03cfa2010-06-13 12:07:00 -0700333 */
Dianne Hackborn4fa1a222010-10-18 13:10:49 -0700334 public static final int GINGERBREAD = 9;
Andres Moralescb3fd692015-01-14 10:07:55 -0800335
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800336 /**
Dianne Hackbornedf1fc62011-03-17 18:34:48 -0700337 * February 2011: Android 2.3.3.
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800338 */
339 public static final int GINGERBREAD_MR1 = 10;
Dianne Hackbornb1ad5972010-08-02 17:30:33 -0700340
341 /**
Dianne Hackbornedf1fc62011-03-17 18:34:48 -0700342 * February 2011: Android 3.0.
Dianne Hackbornb1ad5972010-08-02 17:30:33 -0700343 *
344 * <p>Applications targeting this or a later release will get these
345 * new changes in behavior:</p>
346 * <ul>
Dianne Hackborn3e6d50c2010-08-23 18:30:44 -0700347 * <li> The default theme for applications is now dark holographic:
348 * {@link android.R.style#Theme_Holo}.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700349 * <li> On large screen devices that do not have a physical menu
350 * button, the soft (compatibility) menu is disabled.
Dianne Hackborn0aae2d42010-12-07 23:51:29 -0800351 * <li> The activity lifecycle has changed slightly as per
352 * {@link android.app.Activity}.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700353 * <li> An application will crash if it does not call through
354 * to the super implementation of its
355 * {@link android.app.Activity#onPause Activity.onPause()} method.
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800356 * <li> When an application requires a permission to access one of
Dianne Hackborn6c2c5fc2011-01-18 17:02:33 -0800357 * its components (activity, receiver, service, provider), this
358 * permission is no longer enforced when the application wants to
359 * access its own component. This means it can require a permission
360 * on a component that it does not itself hold and still access that
361 * component.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700362 * <li> {@link android.content.Context#getSharedPreferences
363 * Context.getSharedPreferences()} will not automatically reload
364 * the preferences if they have changed on storage, unless
365 * {@link android.content.Context#MODE_MULTI_PROCESS} is used.
366 * <li> {@link android.view.ViewGroup#setMotionEventSplittingEnabled}
367 * will default to true.
368 * <li> {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH}
369 * is enabled by default on windows.
370 * <li> {@link android.widget.PopupWindow#isSplitTouchEnabled()
371 * PopupWindow.isSplitTouchEnabled()} will return true by default.
372 * <li> {@link android.widget.GridView} and {@link android.widget.ListView}
373 * will use {@link android.view.View#setActivated View.setActivated}
374 * for selected items if they do not implement {@link android.widget.Checkable}.
375 * <li> {@link android.widget.Scroller} will be constructed with
376 * "flywheel" behavior enabled by default.
Dianne Hackbornb1ad5972010-08-02 17:30:33 -0700377 * </ul>
378 */
Dianne Hackborn9d97b632011-01-23 14:56:39 -0800379 public static final int HONEYCOMB = 11;
Andres Moralescb3fd692015-01-14 10:07:55 -0800380
Dianne Hackbornedf1fc62011-03-17 18:34:48 -0700381 /**
Dianne Hackborna8138732011-05-12 15:45:21 -0700382 * May 2011: Android 3.1.
Dianne Hackbornedf1fc62011-03-17 18:34:48 -0700383 */
384 public static final int HONEYCOMB_MR1 = 12;
Andres Moralescb3fd692015-01-14 10:07:55 -0800385
Dianne Hackborna8138732011-05-12 15:45:21 -0700386 /**
Dianne Hackborn426431a2011-06-09 11:29:08 -0700387 * June 2011: Android 3.2.
Dianne Hackborne6676352011-06-01 16:51:20 -0700388 *
389 * <p>Update to Honeycomb MR1 to support 7 inch tablets, improve
390 * screen compatibility mode, etc.</p>
391 *
392 * <p>As of this version, applications that don't say whether they
393 * support XLARGE screens will be assumed to do so only if they target
394 * {@link #HONEYCOMB} or later; it had been {@link #GINGERBREAD} or
395 * later. Applications that don't support a screen size at least as
396 * large as the current screen will provide the user with a UI to
397 * switch them in to screen size compatibility mode.</p>
Dianne Hackborne289bff2011-06-13 19:33:22 -0700398 *
399 * <p>This version introduces new screen size resource qualifiers
400 * based on the screen size in dp: see
401 * {@link android.content.res.Configuration#screenWidthDp},
402 * {@link android.content.res.Configuration#screenHeightDp}, and
403 * {@link android.content.res.Configuration#smallestScreenWidthDp}.
404 * Supplying these in &lt;supports-screens&gt; as per
405 * {@link android.content.pm.ApplicationInfo#requiresSmallestWidthDp},
406 * {@link android.content.pm.ApplicationInfo#compatibleWidthLimitDp}, and
407 * {@link android.content.pm.ApplicationInfo#largestWidthLimitDp} is
408 * preferred over the older screen size buckets and for older devices
409 * the appropriate buckets will be inferred from them.</p>
410 *
Dianne Hackborn81e92762011-10-09 16:00:21 -0700411 * <p>Applications targeting this or a later release will get these
412 * new changes in behavior:</p>
413 * <ul>
414 * <li><p>New {@link android.content.pm.PackageManager#FEATURE_SCREEN_PORTRAIT}
Dianne Hackborne289bff2011-06-13 19:33:22 -0700415 * and {@link android.content.pm.PackageManager#FEATURE_SCREEN_LANDSCAPE}
Dianne Hackborn81e92762011-10-09 16:00:21 -0700416 * features were introduced in this release. Applications that target
Dianne Hackborne289bff2011-06-13 19:33:22 -0700417 * previous platform versions are assumed to require both portrait and
418 * landscape support in the device; when targeting Honeycomb MR1 or
419 * greater the application is responsible for specifying any specific
420 * orientation it requires.</p>
Dianne Hackborn81e92762011-10-09 16:00:21 -0700421 * <li><p>{@link android.os.AsyncTask} will use the serial executor
422 * by default when calling {@link android.os.AsyncTask#execute}.</p>
423 * <li><p>{@link android.content.pm.ActivityInfo#configChanges
424 * ActivityInfo.configChanges} will have the
425 * {@link android.content.pm.ActivityInfo#CONFIG_SCREEN_SIZE} and
426 * {@link android.content.pm.ActivityInfo#CONFIG_SMALLEST_SCREEN_SIZE}
427 * bits set; these need to be cleared for older applications because
428 * some developers have done absolute comparisons against this value
429 * instead of correctly masking the bits they are interested in.
430 * </ul>
Dianne Hackborna8138732011-05-12 15:45:21 -0700431 */
Dianne Hackborn426431a2011-06-09 11:29:08 -0700432 public static final int HONEYCOMB_MR2 = 13;
Dianne Hackborn3fc982f2011-03-30 16:20:26 -0700433
434 /**
Dianne Hackbornf35fe232011-11-01 19:25:20 -0700435 * October 2011: Android 4.0.
Dianne Hackborn2d6833b2011-06-24 16:04:19 -0700436 *
437 * <p>Applications targeting this or a later release will get these
438 * new changes in behavior:</p>
439 * <ul>
Dianne Hackborn9d0e37e2011-09-22 12:58:54 -0700440 * <li> For devices without a dedicated menu key, the software compatibility
441 * menu key will not be shown even on phones. By targeting Ice Cream Sandwich
442 * or later, your UI must always have its own menu UI affordance if needed,
443 * on both tablets and phones. The ActionBar will take care of this for you.
Dianne Hackborn2d6833b2011-06-24 16:04:19 -0700444 * <li> 2d drawing hardware acceleration is now turned on by default.
445 * You can use
446 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
447 * to turn it off if needed, although this is strongly discouraged since
448 * it will result in poor performance on larger screen devices.
Adam Powell6e90a362011-08-14 16:48:32 -0700449 * <li> The default theme for applications is now the "device default" theme:
450 * {@link android.R.style#Theme_DeviceDefault}. This may be the
451 * holo dark theme or a different dark theme defined by the specific device.
452 * The {@link android.R.style#Theme_Holo} family must not be modified
453 * for a device to be considered compatible. Applications that explicitly
454 * request a theme from the Holo family will be guaranteed that these themes
455 * will not change character within the same platform version. Applications
456 * that wish to blend in with the device should use a theme from the
457 * {@link android.R.style#Theme_DeviceDefault} family.
Dianne Hackborn9d0e37e2011-09-22 12:58:54 -0700458 * <li> Managed cursors can now throw an exception if you directly close
459 * the cursor yourself without stopping the management of it; previously failures
460 * would be silently ignored.
461 * <li> The fadingEdge attribute on views will be ignored (fading edges is no
462 * longer a standard part of the UI). A new requiresFadingEdge attribute allows
463 * applications to still force fading edges on for special cases.
Dianne Hackborn81e92762011-10-09 16:00:21 -0700464 * <li> {@link android.content.Context#bindService Context.bindService()}
465 * will not automatically add in {@link android.content.Context#BIND_WAIVE_PRIORITY}.
466 * <li> App Widgets will have standard padding automatically added around
467 * them, rather than relying on the padding being baked into the widget itself.
468 * <li> An exception will be thrown if you try to change the type of a
469 * window after it has been added to the window manager. Previously this
470 * would result in random incorrect behavior.
471 * <li> {@link android.view.animation.AnimationSet} will parse out
472 * the duration, fillBefore, fillAfter, repeatMode, and startOffset
473 * XML attributes that are defined.
474 * <li> {@link android.app.ActionBar#setHomeButtonEnabled
475 * ActionBar.setHomeButtonEnabled()} is false by default.
Dianne Hackborn2d6833b2011-06-24 16:04:19 -0700476 * </ul>
Dianne Hackborn3fc982f2011-03-30 16:20:26 -0700477 */
Dianne Hackborn0784cfb2011-09-14 13:48:15 -0700478 public static final int ICE_CREAM_SANDWICH = 14;
Dianne Hackbornf35fe232011-11-01 19:25:20 -0700479
480 /**
Dianne Hackborn81e92762011-10-09 16:00:21 -0700481 * December 2011: Android 4.0.3.
Dianne Hackbornf35fe232011-11-01 19:25:20 -0700482 */
483 public static final int ICE_CREAM_SANDWICH_MR1 = 15;
Dianne Hackborn81e92762011-10-09 16:00:21 -0700484
485 /**
Dianne Hackborn435cdb42012-07-30 17:36:43 -0700486 * June 2012: Android 4.1.
Dianne Hackborn65696252012-03-05 18:49:21 -0800487 *
488 * <p>Applications targeting this or a later release will get these
489 * new changes in behavior:</p>
490 * <ul>
Dianne Hackborn636fd522012-06-05 17:38:50 -0700491 * <li> You must explicitly request the {@link android.Manifest.permission#READ_CALL_LOG}
492 * and/or {@link android.Manifest.permission#WRITE_CALL_LOG} permissions;
493 * access to the call log is no longer implicitly provided through
494 * {@link android.Manifest.permission#READ_CONTACTS} and
495 * {@link android.Manifest.permission#WRITE_CONTACTS}.
496 * <li> {@link android.widget.RemoteViews} will throw an exception if
497 * setting an onClick handler for views being generated by a
498 * {@link android.widget.RemoteViewsService} for a collection container;
499 * previously this just resulted in a warning log message.
500 * <li> New {@link android.app.ActionBar} policy for embedded tabs:
501 * embedded tabs are now always stacked in the action bar when in portrait
502 * mode, regardless of the size of the screen.
503 * <li> {@link android.webkit.WebSettings#setAllowFileAccessFromFileURLs(boolean)
504 * WebSettings.setAllowFileAccessFromFileURLs} and
505 * {@link android.webkit.WebSettings#setAllowUniversalAccessFromFileURLs(boolean)
506 * WebSettings.setAllowUniversalAccessFromFileURLs} default to false.
Dianne Hackborn65696252012-03-05 18:49:21 -0800507 * <li> Calls to {@link android.content.pm.PackageManager#setComponentEnabledSetting
508 * PackageManager.setComponentEnabledSetting} will now throw an
509 * IllegalArgumentException if the given component class name does not
510 * exist in the application's manifest.
Dianne Hackborn636fd522012-06-05 17:38:50 -0700511 * <li> {@link android.nfc.NfcAdapter#setNdefPushMessage
512 * NfcAdapter.setNdefPushMessage},
513 * {@link android.nfc.NfcAdapter#setNdefPushMessageCallback
514 * NfcAdapter.setNdefPushMessageCallback} and
515 * {@link android.nfc.NfcAdapter#setOnNdefPushCompleteCallback
516 * NfcAdapter.setOnNdefPushCompleteCallback} will throw
517 * IllegalStateException if called after the Activity has been destroyed.
518 * <li> Accessibility services must require the new
519 * {@link android.Manifest.permission#BIND_ACCESSIBILITY_SERVICE} permission or
520 * they will not be available for use.
521 * <li> {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_INCLUDE_NOT_IMPORTANT_VIEWS
522 * AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS} must be set
523 * for unimportant views to be included in queries.
Dianne Hackborn65696252012-03-05 18:49:21 -0800524 * </ul>
Dianne Hackborn81e92762011-10-09 16:00:21 -0700525 */
Dianne Hackbornfa61f0b2012-05-09 21:49:38 -0700526 public static final int JELLY_BEAN = 16;
Dianne Hackborn435cdb42012-07-30 17:36:43 -0700527
528 /**
Dianne Hackborn955d8d62014-10-07 20:17:19 -0700529 * November 2012: Android 4.2, Moar jelly beans!
Nick Kralevichf097b162012-07-28 12:43:48 -0700530 *
531 * <p>Applications targeting this or a later release will get these
532 * new changes in behavior:</p>
533 * <ul>
534 * <li>Content Providers: The default value of {@code android:exported} is now
535 * {@code false}. See
Nick Kralevich2caec6c2012-08-08 11:33:17 -0700536 * <a href="{@docRoot}guide/topics/manifest/provider-element.html#exported">
Nick Kralevichf097b162012-07-28 12:43:48 -0700537 * the android:exported section</a> in the provider documentation for more details.</li>
Dianne Hackbornfc494742012-09-27 16:15:42 -0700538 * <li>{@link android.view.View#getLayoutDirection() View.getLayoutDirection()}
539 * can return different values than {@link android.view.View#LAYOUT_DIRECTION_LTR}
540 * based on the locale etc.
541 * <li> {@link android.webkit.WebView#addJavascriptInterface(Object, String)
542 * WebView.addJavascriptInterface} requires explicit annotations on methods
543 * for them to be accessible from Javascript.
Nick Kralevichf097b162012-07-28 12:43:48 -0700544 * </ul>
Dianne Hackborn435cdb42012-07-30 17:36:43 -0700545 */
546 public static final int JELLY_BEAN_MR1 = 17;
Nick Kralevicha985c3b2013-01-09 16:03:14 -0800547
548 /**
Dianne Hackborn955d8d62014-10-07 20:17:19 -0700549 * July 2013: Android 4.3, the revenge of the beans.
Nick Kralevicha985c3b2013-01-09 16:03:14 -0800550 */
Dianne Hackbornd2eeed62013-04-22 13:04:28 -0700551 public static final int JELLY_BEAN_MR2 = 18;
Dianne Hackborn5d2bfa12013-03-05 10:28:34 -0800552
553 /**
Dianne Hackborn955d8d62014-10-07 20:17:19 -0700554 * October 2013: Android 4.4, KitKat, another tasty treat.
Dianne Hackborn221ea892013-08-04 16:50:16 -0700555 *
556 * <p>Applications targeting this or a later release will get these
557 * new changes in behavior:</p>
558 * <ul>
Mark Dolinerd0646dc2014-08-27 16:04:02 -0700559 * <li> The default result of
560 * {@link android.preference.PreferenceActivity#isValidFragment(String)
Dianne Hackborn6bc37892013-10-03 11:05:14 -0700561 * PreferenceActivity.isValueFragment} becomes false instead of true.</li>
562 * <li> In {@link android.webkit.WebView}, apps targeting earlier versions will have
563 * JS URLs evaluated directly and any result of the evaluation will not replace
564 * the current page content. Apps targetting KITKAT or later that load a JS URL will
565 * have the result of that URL replace the content of the current page</li>
566 * <li> {@link android.app.AlarmManager#set AlarmManager.set} becomes interpreted as
567 * an inexact value, to give the system more flexibility in scheduling alarms.</li>
568 * <li> {@link android.content.Context#getSharedPreferences(String, int)
569 * Context.getSharedPreferences} no longer allows a null name.</li>
570 * <li> {@link android.widget.RelativeLayout} changes to compute wrapped content
571 * margins correctly.</li>
572 * <li> {@link android.app.ActionBar}'s window content overlay is allowed to be
573 * drawn.</li>
Jeff Sharkey3ec2f602013-10-29 12:21:23 -0700574 * <li>The {@link android.Manifest.permission#READ_EXTERNAL_STORAGE}
575 * permission is now always enforced.</li>
576 * <li>Access to package-specific external storage directories belonging
577 * to the calling app no longer requires the
578 * {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} or
579 * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE}
580 * permissions.</li>
Dianne Hackborn221ea892013-08-04 16:50:16 -0700581 * </ul>
Dianne Hackborn5d2bfa12013-03-05 10:28:34 -0800582 */
Dianne Hackborn6bc37892013-10-03 11:05:14 -0700583 public static final int KITKAT = 19;
Dianne Hackborn10ad9822014-03-17 11:28:36 -0700584
585 /**
Dianne Hackborne7a34352015-09-17 14:50:47 -0700586 * June 2014: Android 4.4W. KitKat for watches, snacks on the run.
Justin Koh78b94de2014-05-13 15:48:42 -0700587 *
588 * <p>Applications targeting this or a later release will get these
589 * new changes in behavior:</p>
590 * <ul>
591 * <li>{@link android.app.AlertDialog} might not have a default background if the theme does
592 * not specify one.</li>
593 * </ul>
Jeff Brown1c3f3322014-04-16 13:15:22 -0700594 */
Justin Koh78b94de2014-05-13 15:48:42 -0700595 public static final int KITKAT_WATCH = 20;
Jeff Brown047f3c72014-04-16 14:18:49 -0700596
597 /**
Dianne Hackborn955d8d62014-10-07 20:17:19 -0700598 * Temporary until we completely switch to {@link #LOLLIPOP}.
Dianne Hackbornd3511d42014-10-16 17:48:30 -0700599 * @hide
Dianne Hackborn955d8d62014-10-07 20:17:19 -0700600 */
601 public static final int L = 21;
602
603 /**
Dianne Hackborne7a34352015-09-17 14:50:47 -0700604 * November 2014: Lollipop. A flat one with beautiful shadows. But still tasty.
Dianne Hackborn10ad9822014-03-17 11:28:36 -0700605 *
606 * <p>Applications targeting this or a later release will get these
607 * new changes in behavior:</p>
608 * <ul>
609 * <li> {@link android.content.Context#bindService Context.bindService} now
Michael Wright5b5def52014-04-11 13:37:50 -0700610 * requires an explicit Intent, and will throw an exception if given an implicit
Dianne Hackborn10ad9822014-03-17 11:28:36 -0700611 * Intent.</li>
Dianne Hackbornd3511d42014-10-16 17:48:30 -0700612 * <li> {@link android.app.Notification.Builder Notification.Builder} will
613 * not have the colors of their various notification elements adjusted to better
614 * match the new material design look.</li>
615 * <li> {@link android.os.Message} will validate that a message is not currently
616 * in use when it is recycled.</li>
617 * <li> Hardware accelerated drawing in windows will be enabled automatically
618 * in most places.</li>
619 * <li> {@link android.widget.Spinner} throws an exception if attaching an
620 * adapter with more than one item type.</li>
621 * <li> If the app is a launcher, the launcher will be available to the user
622 * even when they are using corporate profiles (which requires that the app
623 * use {@link android.content.pm.LauncherApps} to correctly populate its
624 * apps UI).</li>
625 * <li> Calling {@link android.app.Service#stopForeground Service.stopForeground}
626 * with removeNotification false will modify the still posted notification so that
627 * it is no longer forced to be ongoing.</li>
628 * <li> A {@link android.service.dreams.DreamService} must require the
629 * {@link android.Manifest.permission#BIND_DREAM_SERVICE} permission to be usable.</li>
Dianne Hackborn10ad9822014-03-17 11:28:36 -0700630 * </ul>
631 */
Dianne Hackborn955d8d62014-10-07 20:17:19 -0700632 public static final int LOLLIPOP = 21;
Dianne Hackborn3b696882014-10-16 18:14:12 -0700633
634 /**
Dianne Hackborne7a34352015-09-17 14:50:47 -0700635 * March 2015: Lollipop with an extra sugar coating on the outside!
Dianne Hackborn3b696882014-10-16 18:14:12 -0700636 */
637 public static final int LOLLIPOP_MR1 = 22;
Dianne Hackborn8bd95f12015-01-27 13:18:24 -0800638
639 /**
Dianne Hackborne7a34352015-09-17 14:50:47 -0700640 * M is for Marshmallow!
641 *
642 * <p>Applications targeting this or a later release will get these
643 * new changes in behavior:</p>
644 * <ul>
645 * <li> Runtime permissions. Dangerous permissions are no longer granted at
646 * install time, but must be requested by the application at runtime through
647 * {@link android.app.Activity#requestPermissions}.</li>
648 * <li> Bluetooth and Wi-Fi scanning now requires holding the location permission.</li>
649 * <li> {@link android.app.AlarmManager#setTimeZone AlarmManager.setTimeZone} will fail if
650 * the given timezone is non-Olson.</li>
651 * <li> Activity transitions will only return shared
652 * elements mapped in the returned view hierarchy back to the calling activity.</li>
653 * <li> {@link android.view.View} allows a number of behaviors that may break
654 * existing apps: Canvas throws an exception if restore() is called too many times,
655 * widgets may return a hint size when returning UNSPECIFIED measure specs, and it
656 * will respect the attributes {@link android.R.attr#foreground},
657 * {@link android.R.attr#foregroundGravity}, {@link android.R.attr#foregroundTint}, and
658 * {@link android.R.attr#foregroundTintMode}.</li>
659 * <li> {@link android.view.MotionEvent#getButtonState MotionEvent.getButtonState}
660 * will no longer report {@link android.view.MotionEvent#BUTTON_PRIMARY}
661 * and {@link android.view.MotionEvent#BUTTON_SECONDARY} as synonyms for
662 * {@link android.view.MotionEvent#BUTTON_STYLUS_PRIMARY} and
663 * {@link android.view.MotionEvent#BUTTON_STYLUS_SECONDARY}.</li>
664 * <li> {@link android.widget.ScrollView} now respects the layout param margins
665 * when measuring.</li>
666 * </ul>
Dianne Hackborn8bd95f12015-01-27 13:18:24 -0800667 */
Dianne Hackborn0e3de6c2015-07-29 15:20:21 -0700668 public static final int M = 23;
Wale Ogunwale79113102015-10-05 16:52:53 -0700669
670 /**
671 * N is for ¯\_(ツ)_/¯.
672 */
673 public static final int N = CUR_DEVELOPMENT;
Dianne Hackborn851a5412009-05-08 12:06:44 -0700674 }
Andres Moralescb3fd692015-01-14 10:07:55 -0800675
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800676 /** The type of build, like "user" or "eng". */
677 public static final String TYPE = getString("ro.build.type");
678
679 /** Comma-separated tags describing the build, like "unsigned,debug". */
680 public static final String TAGS = getString("ro.build.tags");
681
682 /** A string that uniquely identifies this build. Do not attempt to parse this value. */
Jeff Sharkey55687722014-04-09 18:07:19 -0700683 public static final String FINGERPRINT = deriveFingerprint();
684
685 /**
686 * Some devices split the fingerprint components between multiple
687 * partitions, so we might derive the fingerprint at runtime.
688 */
689 private static String deriveFingerprint() {
690 String finger = SystemProperties.get("ro.build.fingerprint");
691 if (TextUtils.isEmpty(finger)) {
692 finger = getString("ro.product.brand") + '/' +
693 getString("ro.product.name") + '/' +
694 getString("ro.product.device") + ':' +
695 getString("ro.build.version.release") + '/' +
696 getString("ro.build.id") + '/' +
697 getString("ro.build.version.incremental") + ':' +
698 getString("ro.build.type") + '/' +
699 getString("ro.build.tags");
700 }
701 return finger;
702 }
703
704 /**
705 * Ensure that raw fingerprint system property is defined. If it was derived
706 * dynamically by {@link #deriveFingerprint()} this is where we push the
707 * derived value into the property service.
708 *
709 * @hide
710 */
711 public static void ensureFingerprintProperty() {
712 if (TextUtils.isEmpty(SystemProperties.get("ro.build.fingerprint"))) {
Jeff Sharkeybdd44912014-04-11 16:30:14 -0700713 try {
714 SystemProperties.set("ro.build.fingerprint", FINGERPRINT);
715 } catch (IllegalArgumentException e) {
716 Slog.e(TAG, "Failed to set fingerprint property", e);
717 }
Jeff Sharkey55687722014-04-09 18:07:19 -0700718 }
719 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800720
Jeff Sharkey2cffc7d2014-11-14 13:57:53 -0800721 /**
Andres Moralesfd282ed2015-02-06 15:07:59 -0800722 * Verifies the the current flash of the device is consistent with what
723 * was expected at build time.
724 * 1) Checks that device fingerprint is defined and that it matches across
725 * various partitions.
726 * 2) Verifies radio and bootloader partitions are those expected in the build.
Jeff Sharkey2cffc7d2014-11-14 13:57:53 -0800727 *
728 * @hide
729 */
Andres Moralesfd282ed2015-02-06 15:07:59 -0800730 public static boolean isBuildConsistent() {
Xiaohui Chen2102dcb2015-10-02 16:45:55 -0700731 // Don't care on eng builds. Incremental build may trigger false negative.
732 if ("eng".equals(TYPE)) return true;
733
Jeff Sharkey2cffc7d2014-11-14 13:57:53 -0800734 final String system = SystemProperties.get("ro.build.fingerprint");
735 final String vendor = SystemProperties.get("ro.vendor.build.fingerprint");
Andres Moralescb3fd692015-01-14 10:07:55 -0800736 final String bootimage = SystemProperties.get("ro.bootimage.build.fingerprint");
Andres Moralesfd282ed2015-02-06 15:07:59 -0800737 final String requiredBootloader = SystemProperties.get("ro.build.expect.bootloader");
738 final String currentBootloader = SystemProperties.get("ro.bootloader");
739 final String requiredRadio = SystemProperties.get("ro.build.expect.baseband");
740 final String currentRadio = SystemProperties.get("gsm.version.baseband");
Jeff Sharkey2cffc7d2014-11-14 13:57:53 -0800741
742 if (TextUtils.isEmpty(system)) {
743 Slog.e(TAG, "Required ro.build.fingerprint is empty!");
744 return false;
745 }
746
747 if (!TextUtils.isEmpty(vendor)) {
748 if (!Objects.equals(system, vendor)) {
749 Slog.e(TAG, "Mismatched fingerprints; system reported " + system
750 + " but vendor reported " + vendor);
751 return false;
752 }
753 }
754
Andres Moralesc97b92e2015-06-01 17:50:43 +0000755 /* TODO: Figure out issue with checks failing
Andres Moralescb3fd692015-01-14 10:07:55 -0800756 if (!TextUtils.isEmpty(bootimage)) {
Andres Morales7de24ce2015-01-23 12:45:54 -0800757 if (!Objects.equals(system, bootimage)) {
758 Slog.e(TAG, "Mismatched fingerprints; system reported " + system
Andres Moralescb3fd692015-01-14 10:07:55 -0800759 + " but bootimage reported " + bootimage);
760 return false;
761 }
762 }
763
Andres Moralesfd282ed2015-02-06 15:07:59 -0800764 if (!TextUtils.isEmpty(requiredBootloader)) {
765 if (!Objects.equals(currentBootloader, requiredBootloader)) {
766 Slog.e(TAG, "Mismatched bootloader version: build requires " + requiredBootloader
767 + " but runtime reports " + currentBootloader);
768 return false;
769 }
770 }
771
772 if (!TextUtils.isEmpty(requiredRadio)) {
773 if (!Objects.equals(currentRadio, requiredRadio)) {
774 Slog.e(TAG, "Mismatched radio version: build requires " + requiredRadio
775 + " but runtime reports " + currentRadio);
776 return false;
777 }
778 }
Daniel Rosenberg159c2052015-02-20 13:10:26 -0800779 */
Andres Moralesfd282ed2015-02-06 15:07:59 -0800780
Jeff Sharkey2cffc7d2014-11-14 13:57:53 -0800781 return true;
782 }
783
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800784 // The following properties only make sense for internal engineering builds.
785 public static final long TIME = getLong("ro.build.date.utc") * 1000;
786 public static final String USER = getString("ro.build.user");
787 public static final String HOST = getString("ro.build.host");
788
Doug Zongkerad2171a2011-06-14 11:07:24 -0700789 /**
Jeff Brown89101cd92011-10-27 21:24:54 -0700790 * Returns true if we are running a debug build such as "user-debug" or "eng".
791 * @hide
792 */
793 public static final boolean IS_DEBUGGABLE =
794 SystemProperties.getInt("ro.debuggable", 0) == 1;
795
796 /**
Svet Ganov9c165d72015-12-01 19:52:26 -0800797 * Specifies whether the permissions needed by a legacy app should be
798 * reviewed before any of its components can run. A legacy app is one
799 * with targetSdkVersion < 23, i.e apps using the old permission model.
800 * If review is not required, permissions are reviewed before the app
801 * is installed.
802 *
803 * @hide
804 */
805 public static final boolean PERMISSIONS_REVIEW_REQUIRED =
806 SystemProperties.getInt("ro.permission_review_required", 0) == 1;
807
808 /**
Doug Zongkerad2171a2011-06-14 11:07:24 -0700809 * Returns the version string for the radio firmware. May return
810 * null (if, for instance, the radio is not currently on).
811 */
812 public static String getRadioVersion() {
813 return SystemProperties.get(TelephonyProperties.PROPERTY_BASEBAND_VERSION, null);
814 }
815
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800816 private static String getString(String property) {
817 return SystemProperties.get(property, UNKNOWN);
818 }
819
Torne (Richard Coles)ff701a62014-07-30 12:11:15 +0100820 private static String[] getStringList(String property, String separator) {
821 String value = SystemProperties.get(property);
822 if (value.isEmpty()) {
823 return new String[0];
824 } else {
825 return value.split(separator);
826 }
827 }
828
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800829 private static long getLong(String property) {
830 try {
831 return Long.parseLong(SystemProperties.get(property));
832 } catch (NumberFormatException e) {
833 return -1;
834 }
835 }
836}