Build.java revision 4656e69bf36d42a35c9290ab79eeb33b4cca1d5c
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 17package android.os; 18 19import android.text.TextUtils; 20import android.util.Slog; 21 22import com.android.internal.telephony.TelephonyProperties; 23 24/** 25 * Information about the current build, extracted from system properties. 26 */ 27public class Build { 28 private static final String TAG = "Build"; 29 30 /** Value used for when a build property is unknown. */ 31 public static final String UNKNOWN = "unknown"; 32 33 /** Either a changelist number, or a label like "M4-rc20". */ 34 public static final String ID = getString("ro.build.id"); 35 36 /** A build ID string meant for displaying to the user */ 37 public static final String DISPLAY = getString("ro.build.display.id"); 38 39 /** The name of the overall product. */ 40 public static final String PRODUCT = getString("ro.product.name"); 41 42 /** The name of the industrial design. */ 43 public static final String DEVICE = getString("ro.product.device"); 44 45 /** The name of the underlying board, like "goldfish". */ 46 public static final String BOARD = getString("ro.product.board"); 47 48 /** 49 * The name of the instruction set (CPU type + ABI convention) of native code. 50 * 51 * @deprecated Use {@link #SUPPORTED_ABIS} instead. 52 */ 53 @Deprecated 54 public static final String CPU_ABI = getString("ro.product.cpu.abi"); 55 56 /** 57 * The name of the second instruction set (CPU type + ABI convention) of native code. 58 * 59 * @deprecated Use {@link #SUPPORTED_ABIS} instead. 60 */ 61 @Deprecated 62 public static final String CPU_ABI2 = getString("ro.product.cpu.abi2"); 63 64 /** The manufacturer of the product/hardware. */ 65 public static final String MANUFACTURER = getString("ro.product.manufacturer"); 66 67 /** The consumer-visible brand with which the product/hardware will be associated, if any. */ 68 public static final String BRAND = getString("ro.product.brand"); 69 70 /** The end-user-visible name for the end product. */ 71 public static final String MODEL = getString("ro.product.model"); 72 73 /** The system bootloader version number. */ 74 public static final String BOOTLOADER = getString("ro.bootloader"); 75 76 /** 77 * The radio firmware version number. 78 * 79 * @deprecated The radio firmware version is frequently not 80 * available when this class is initialized, leading to a blank or 81 * "unknown" value for this string. Use 82 * {@link #getRadioVersion} instead. 83 */ 84 @Deprecated 85 public static final String RADIO = getString(TelephonyProperties.PROPERTY_BASEBAND_VERSION); 86 87 /** The name of the hardware (from the kernel command line or /proc). */ 88 public static final String HARDWARE = getString("ro.hardware"); 89 90 /** A hardware serial number, if available. Alphanumeric only, case-insensitive. */ 91 public static final String SERIAL = getString("ro.serialno"); 92 93 /** 94 * An ordered list of ABIs supported by this device. The most preferred ABI is the first 95 * element in the list. 96 * 97 * See {@link #SUPPORTED_32_BIT_ABIS} and {@link #SUPPORTED_64_BIT_ABIS}. 98 */ 99 public static final String[] SUPPORTED_ABIS = getStringList("ro.product.cpu.abilist", ","); 100 101 /** 102 * An ordered list of <b>32 bit</b> ABIs supported by this device. The most preferred ABI 103 * is the first element in the list. 104 * 105 * See {@link #SUPPORTED_ABIS} and {@link #SUPPORTED_64_BIT_ABIS}. 106 */ 107 public static final String[] SUPPORTED_32_BIT_ABIS = 108 getStringList("ro.product.cpu.abilist32", ","); 109 110 /** 111 * An ordered list of <b>64 bit</b> ABIs supported by this device. The most preferred ABI 112 * is the first element in the list. 113 * 114 * See {@link #SUPPORTED_ABIS} and {@link #SUPPORTED_32_BIT_ABIS}. 115 */ 116 public static final String[] SUPPORTED_64_BIT_ABIS = 117 getStringList("ro.product.cpu.abilist64", ","); 118 119 120 /** Various version strings. */ 121 public static class VERSION { 122 /** 123 * The internal value used by the underlying source control to 124 * represent this build. E.g., a perforce changelist number 125 * or a git hash. 126 */ 127 public static final String INCREMENTAL = getString("ro.build.version.incremental"); 128 129 /** 130 * The user-visible version string. E.g., "1.0" or "3.4b5". 131 */ 132 public static final String RELEASE = getString("ro.build.version.release"); 133 134 /** 135 * The user-visible SDK version of the framework in its raw String 136 * representation; use {@link #SDK_INT} instead. 137 * 138 * @deprecated Use {@link #SDK_INT} to easily get this as an integer. 139 */ 140 @Deprecated 141 public static final String SDK = getString("ro.build.version.sdk"); 142 143 /** 144 * The user-visible SDK version of the framework; its possible 145 * values are defined in {@link Build.VERSION_CODES}. 146 */ 147 public static final int SDK_INT = SystemProperties.getInt( 148 "ro.build.version.sdk", 0); 149 150 /** 151 * The current development codename, or the string "REL" if this is 152 * a release build. 153 */ 154 public static final String CODENAME = getString("ro.build.version.codename"); 155 156 private static final String[] ALL_CODENAMES 157 = getStringList("ro.build.version.all_codenames", ","); 158 159 /** 160 * @hide 161 */ 162 public static final String[] ACTIVE_CODENAMES = "REL".equals(ALL_CODENAMES[0]) 163 ? new String[0] : ALL_CODENAMES; 164 165 /** 166 * The SDK version to use when accessing resources. 167 * Use the current SDK version code. For every active development codename 168 * we are operating under, we bump the assumed resource platform version by 1. 169 * @hide 170 */ 171 public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length; 172 } 173 174 /** 175 * Enumeration of the currently known SDK version codes. These are the 176 * values that can be found in {@link VERSION#SDK}. Version numbers 177 * increment monotonically with each official platform release. 178 */ 179 public static class VERSION_CODES { 180 /** 181 * Magic version number for a current development build, which has 182 * not yet turned into an official release. 183 */ 184 public static final int CUR_DEVELOPMENT = 10000; 185 186 /** 187 * October 2008: The original, first, version of Android. Yay! 188 */ 189 public static final int BASE = 1; 190 191 /** 192 * February 2009: First Android update, officially called 1.1. 193 */ 194 public static final int BASE_1_1 = 2; 195 196 /** 197 * May 2009: Android 1.5. 198 */ 199 public static final int CUPCAKE = 3; 200 201 /** 202 * September 2009: Android 1.6. 203 * 204 * <p>Applications targeting this or a later release will get these 205 * new changes in behavior:</p> 206 * <ul> 207 * <li> They must explicitly request the 208 * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permission to be 209 * able to modify the contents of the SD card. (Apps targeting 210 * earlier versions will always request the permission.) 211 * <li> They must explicitly request the 212 * {@link android.Manifest.permission#READ_PHONE_STATE} permission to be 213 * able to be able to retrieve phone state info. (Apps targeting 214 * earlier versions will always request the permission.) 215 * <li> They are assumed to support different screen densities and 216 * sizes. (Apps targeting earlier versions are assumed to only support 217 * medium density normal size screens unless otherwise indicated). 218 * They can still explicitly specify screen support either way with the 219 * supports-screens manifest tag. 220 * <li> {@link android.widget.TabHost} will use the new dark tab 221 * background design. 222 * </ul> 223 */ 224 public static final int DONUT = 4; 225 226 /** 227 * November 2009: Android 2.0 228 * 229 * <p>Applications targeting this or a later release will get these 230 * new changes in behavior:</p> 231 * <ul> 232 * <li> The {@link android.app.Service#onStartCommand 233 * Service.onStartCommand} function will return the new 234 * {@link android.app.Service#START_STICKY} behavior instead of the 235 * old compatibility {@link android.app.Service#START_STICKY_COMPATIBILITY}. 236 * <li> The {@link android.app.Activity} class will now execute back 237 * key presses on the key up instead of key down, to be able to detect 238 * canceled presses from virtual keys. 239 * <li> The {@link android.widget.TabWidget} class will use a new color scheme 240 * for tabs. In the new scheme, the foreground tab has a medium gray background 241 * the background tabs have a dark gray background. 242 * </ul> 243 */ 244 public static final int ECLAIR = 5; 245 246 /** 247 * December 2009: Android 2.0.1 248 */ 249 public static final int ECLAIR_0_1 = 6; 250 251 /** 252 * January 2010: Android 2.1 253 */ 254 public static final int ECLAIR_MR1 = 7; 255 256 /** 257 * June 2010: Android 2.2 258 */ 259 public static final int FROYO = 8; 260 261 /** 262 * November 2010: Android 2.3 263 * 264 * <p>Applications targeting this or a later release will get these 265 * new changes in behavior:</p> 266 * <ul> 267 * <li> The application's notification icons will be shown on the new 268 * dark status bar background, so must be visible in this situation. 269 * </ul> 270 */ 271 public static final int GINGERBREAD = 9; 272 273 /** 274 * February 2011: Android 2.3.3. 275 */ 276 public static final int GINGERBREAD_MR1 = 10; 277 278 /** 279 * February 2011: Android 3.0. 280 * 281 * <p>Applications targeting this or a later release will get these 282 * new changes in behavior:</p> 283 * <ul> 284 * <li> The default theme for applications is now dark holographic: 285 * {@link android.R.style#Theme_Holo}. 286 * <li> On large screen devices that do not have a physical menu 287 * button, the soft (compatibility) menu is disabled. 288 * <li> The activity lifecycle has changed slightly as per 289 * {@link android.app.Activity}. 290 * <li> An application will crash if it does not call through 291 * to the super implementation of its 292 * {@link android.app.Activity#onPause Activity.onPause()} method. 293 * <li> When an application requires a permission to access one of 294 * its components (activity, receiver, service, provider), this 295 * permission is no longer enforced when the application wants to 296 * access its own component. This means it can require a permission 297 * on a component that it does not itself hold and still access that 298 * component. 299 * <li> {@link android.content.Context#getSharedPreferences 300 * Context.getSharedPreferences()} will not automatically reload 301 * the preferences if they have changed on storage, unless 302 * {@link android.content.Context#MODE_MULTI_PROCESS} is used. 303 * <li> {@link android.view.ViewGroup#setMotionEventSplittingEnabled} 304 * will default to true. 305 * <li> {@link android.view.WindowManager.LayoutParams#FLAG_SPLIT_TOUCH} 306 * is enabled by default on windows. 307 * <li> {@link android.widget.PopupWindow#isSplitTouchEnabled() 308 * PopupWindow.isSplitTouchEnabled()} will return true by default. 309 * <li> {@link android.widget.GridView} and {@link android.widget.ListView} 310 * will use {@link android.view.View#setActivated View.setActivated} 311 * for selected items if they do not implement {@link android.widget.Checkable}. 312 * <li> {@link android.widget.Scroller} will be constructed with 313 * "flywheel" behavior enabled by default. 314 * </ul> 315 */ 316 public static final int HONEYCOMB = 11; 317 318 /** 319 * May 2011: Android 3.1. 320 */ 321 public static final int HONEYCOMB_MR1 = 12; 322 323 /** 324 * June 2011: Android 3.2. 325 * 326 * <p>Update to Honeycomb MR1 to support 7 inch tablets, improve 327 * screen compatibility mode, etc.</p> 328 * 329 * <p>As of this version, applications that don't say whether they 330 * support XLARGE screens will be assumed to do so only if they target 331 * {@link #HONEYCOMB} or later; it had been {@link #GINGERBREAD} or 332 * later. Applications that don't support a screen size at least as 333 * large as the current screen will provide the user with a UI to 334 * switch them in to screen size compatibility mode.</p> 335 * 336 * <p>This version introduces new screen size resource qualifiers 337 * based on the screen size in dp: see 338 * {@link android.content.res.Configuration#screenWidthDp}, 339 * {@link android.content.res.Configuration#screenHeightDp}, and 340 * {@link android.content.res.Configuration#smallestScreenWidthDp}. 341 * Supplying these in <supports-screens> as per 342 * {@link android.content.pm.ApplicationInfo#requiresSmallestWidthDp}, 343 * {@link android.content.pm.ApplicationInfo#compatibleWidthLimitDp}, and 344 * {@link android.content.pm.ApplicationInfo#largestWidthLimitDp} is 345 * preferred over the older screen size buckets and for older devices 346 * the appropriate buckets will be inferred from them.</p> 347 * 348 * <p>Applications targeting this or a later release will get these 349 * new changes in behavior:</p> 350 * <ul> 351 * <li><p>New {@link android.content.pm.PackageManager#FEATURE_SCREEN_PORTRAIT} 352 * and {@link android.content.pm.PackageManager#FEATURE_SCREEN_LANDSCAPE} 353 * features were introduced in this release. Applications that target 354 * previous platform versions are assumed to require both portrait and 355 * landscape support in the device; when targeting Honeycomb MR1 or 356 * greater the application is responsible for specifying any specific 357 * orientation it requires.</p> 358 * <li><p>{@link android.os.AsyncTask} will use the serial executor 359 * by default when calling {@link android.os.AsyncTask#execute}.</p> 360 * <li><p>{@link android.content.pm.ActivityInfo#configChanges 361 * ActivityInfo.configChanges} will have the 362 * {@link android.content.pm.ActivityInfo#CONFIG_SCREEN_SIZE} and 363 * {@link android.content.pm.ActivityInfo#CONFIG_SMALLEST_SCREEN_SIZE} 364 * bits set; these need to be cleared for older applications because 365 * some developers have done absolute comparisons against this value 366 * instead of correctly masking the bits they are interested in. 367 * </ul> 368 */ 369 public static final int HONEYCOMB_MR2 = 13; 370 371 /** 372 * October 2011: Android 4.0. 373 * 374 * <p>Applications targeting this or a later release will get these 375 * new changes in behavior:</p> 376 * <ul> 377 * <li> For devices without a dedicated menu key, the software compatibility 378 * menu key will not be shown even on phones. By targeting Ice Cream Sandwich 379 * or later, your UI must always have its own menu UI affordance if needed, 380 * on both tablets and phones. The ActionBar will take care of this for you. 381 * <li> 2d drawing hardware acceleration is now turned on by default. 382 * You can use 383 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated} 384 * to turn it off if needed, although this is strongly discouraged since 385 * it will result in poor performance on larger screen devices. 386 * <li> The default theme for applications is now the "device default" theme: 387 * {@link android.R.style#Theme_DeviceDefault}. This may be the 388 * holo dark theme or a different dark theme defined by the specific device. 389 * The {@link android.R.style#Theme_Holo} family must not be modified 390 * for a device to be considered compatible. Applications that explicitly 391 * request a theme from the Holo family will be guaranteed that these themes 392 * will not change character within the same platform version. Applications 393 * that wish to blend in with the device should use a theme from the 394 * {@link android.R.style#Theme_DeviceDefault} family. 395 * <li> Managed cursors can now throw an exception if you directly close 396 * the cursor yourself without stopping the management of it; previously failures 397 * would be silently ignored. 398 * <li> The fadingEdge attribute on views will be ignored (fading edges is no 399 * longer a standard part of the UI). A new requiresFadingEdge attribute allows 400 * applications to still force fading edges on for special cases. 401 * <li> {@link android.content.Context#bindService Context.bindService()} 402 * will not automatically add in {@link android.content.Context#BIND_WAIVE_PRIORITY}. 403 * <li> App Widgets will have standard padding automatically added around 404 * them, rather than relying on the padding being baked into the widget itself. 405 * <li> An exception will be thrown if you try to change the type of a 406 * window after it has been added to the window manager. Previously this 407 * would result in random incorrect behavior. 408 * <li> {@link android.view.animation.AnimationSet} will parse out 409 * the duration, fillBefore, fillAfter, repeatMode, and startOffset 410 * XML attributes that are defined. 411 * <li> {@link android.app.ActionBar#setHomeButtonEnabled 412 * ActionBar.setHomeButtonEnabled()} is false by default. 413 * </ul> 414 */ 415 public static final int ICE_CREAM_SANDWICH = 14; 416 417 /** 418 * December 2011: Android 4.0.3. 419 */ 420 public static final int ICE_CREAM_SANDWICH_MR1 = 15; 421 422 /** 423 * June 2012: Android 4.1. 424 * 425 * <p>Applications targeting this or a later release will get these 426 * new changes in behavior:</p> 427 * <ul> 428 * <li> You must explicitly request the {@link android.Manifest.permission#READ_CALL_LOG} 429 * and/or {@link android.Manifest.permission#WRITE_CALL_LOG} permissions; 430 * access to the call log is no longer implicitly provided through 431 * {@link android.Manifest.permission#READ_CONTACTS} and 432 * {@link android.Manifest.permission#WRITE_CONTACTS}. 433 * <li> {@link android.widget.RemoteViews} will throw an exception if 434 * setting an onClick handler for views being generated by a 435 * {@link android.widget.RemoteViewsService} for a collection container; 436 * previously this just resulted in a warning log message. 437 * <li> New {@link android.app.ActionBar} policy for embedded tabs: 438 * embedded tabs are now always stacked in the action bar when in portrait 439 * mode, regardless of the size of the screen. 440 * <li> {@link android.webkit.WebSettings#setAllowFileAccessFromFileURLs(boolean) 441 * WebSettings.setAllowFileAccessFromFileURLs} and 442 * {@link android.webkit.WebSettings#setAllowUniversalAccessFromFileURLs(boolean) 443 * WebSettings.setAllowUniversalAccessFromFileURLs} default to false. 444 * <li> Calls to {@link android.content.pm.PackageManager#setComponentEnabledSetting 445 * PackageManager.setComponentEnabledSetting} will now throw an 446 * IllegalArgumentException if the given component class name does not 447 * exist in the application's manifest. 448 * <li> {@link android.nfc.NfcAdapter#setNdefPushMessage 449 * NfcAdapter.setNdefPushMessage}, 450 * {@link android.nfc.NfcAdapter#setNdefPushMessageCallback 451 * NfcAdapter.setNdefPushMessageCallback} and 452 * {@link android.nfc.NfcAdapter#setOnNdefPushCompleteCallback 453 * NfcAdapter.setOnNdefPushCompleteCallback} will throw 454 * IllegalStateException if called after the Activity has been destroyed. 455 * <li> Accessibility services must require the new 456 * {@link android.Manifest.permission#BIND_ACCESSIBILITY_SERVICE} permission or 457 * they will not be available for use. 458 * <li> {@link android.accessibilityservice.AccessibilityServiceInfo#FLAG_INCLUDE_NOT_IMPORTANT_VIEWS 459 * AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS} must be set 460 * for unimportant views to be included in queries. 461 * </ul> 462 */ 463 public static final int JELLY_BEAN = 16; 464 465 /** 466 * Android 4.2: Moar jelly beans! 467 * 468 * <p>Applications targeting this or a later release will get these 469 * new changes in behavior:</p> 470 * <ul> 471 * <li>Content Providers: The default value of {@code android:exported} is now 472 * {@code false}. See 473 * <a href="{@docRoot}guide/topics/manifest/provider-element.html#exported"> 474 * the android:exported section</a> in the provider documentation for more details.</li> 475 * <li>{@link android.view.View#getLayoutDirection() View.getLayoutDirection()} 476 * can return different values than {@link android.view.View#LAYOUT_DIRECTION_LTR} 477 * based on the locale etc. 478 * <li> {@link android.webkit.WebView#addJavascriptInterface(Object, String) 479 * WebView.addJavascriptInterface} requires explicit annotations on methods 480 * for them to be accessible from Javascript. 481 * </ul> 482 */ 483 public static final int JELLY_BEAN_MR1 = 17; 484 485 /** 486 * Android 4.3: Jelly Bean MR2, the revenge of the beans. 487 */ 488 public static final int JELLY_BEAN_MR2 = 18; 489 490 /** 491 * Android 4.4: KitKat, another tasty treat. 492 * 493 * <p>Applications targeting this or a later release will get these 494 * new changes in behavior:</p> 495 * <ul> 496 * <li> The default result of 497 * {@link android.preference.PreferenceActivity#isValidFragment(String) 498 * PreferenceActivity.isValueFragment} becomes false instead of true.</li> 499 * <li> In {@link android.webkit.WebView}, apps targeting earlier versions will have 500 * JS URLs evaluated directly and any result of the evaluation will not replace 501 * the current page content. Apps targetting KITKAT or later that load a JS URL will 502 * have the result of that URL replace the content of the current page</li> 503 * <li> {@link android.app.AlarmManager#set AlarmManager.set} becomes interpreted as 504 * an inexact value, to give the system more flexibility in scheduling alarms.</li> 505 * <li> {@link android.content.Context#getSharedPreferences(String, int) 506 * Context.getSharedPreferences} no longer allows a null name.</li> 507 * <li> {@link android.widget.RelativeLayout} changes to compute wrapped content 508 * margins correctly.</li> 509 * <li> {@link android.app.ActionBar}'s window content overlay is allowed to be 510 * drawn.</li> 511 * <li>The {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} 512 * permission is now always enforced.</li> 513 * <li>Access to package-specific external storage directories belonging 514 * to the calling app no longer requires the 515 * {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} or 516 * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} 517 * permissions.</li> 518 * </ul> 519 */ 520 public static final int KITKAT = 19; 521 522 /** 523 * Android 4.4W: KitKat for watches, snacks on the run. 524 * 525 * <p>Applications targeting this or a later release will get these 526 * new changes in behavior:</p> 527 * <ul> 528 * <li>{@link android.app.AlertDialog} might not have a default background if the theme does 529 * not specify one.</li> 530 * </ul> 531 */ 532 public static final int KITKAT_WATCH = 20; 533 534 /** 535 * L! 536 * 537 * <p>Applications targeting this or a later release will get these 538 * new changes in behavior:</p> 539 * <ul> 540 * <li> {@link android.content.Context#bindService Context.bindService} now 541 * requires an explicit Intent, and will throw an exception if given an implicit 542 * Intent.</li> 543 * </ul> 544 */ 545 public static final int L = 21; 546 } 547 548 /** The type of build, like "user" or "eng". */ 549 public static final String TYPE = getString("ro.build.type"); 550 551 /** Comma-separated tags describing the build, like "unsigned,debug". */ 552 public static final String TAGS = getString("ro.build.tags"); 553 554 /** A string that uniquely identifies this build. Do not attempt to parse this value. */ 555 public static final String FINGERPRINT = deriveFingerprint(); 556 557 /** 558 * Some devices split the fingerprint components between multiple 559 * partitions, so we might derive the fingerprint at runtime. 560 */ 561 private static String deriveFingerprint() { 562 String finger = SystemProperties.get("ro.build.fingerprint"); 563 if (TextUtils.isEmpty(finger)) { 564 finger = getString("ro.product.brand") + '/' + 565 getString("ro.product.name") + '/' + 566 getString("ro.product.device") + ':' + 567 getString("ro.build.version.release") + '/' + 568 getString("ro.build.id") + '/' + 569 getString("ro.build.version.incremental") + ':' + 570 getString("ro.build.type") + '/' + 571 getString("ro.build.tags"); 572 } 573 return finger; 574 } 575 576 /** 577 * Ensure that raw fingerprint system property is defined. If it was derived 578 * dynamically by {@link #deriveFingerprint()} this is where we push the 579 * derived value into the property service. 580 * 581 * @hide 582 */ 583 public static void ensureFingerprintProperty() { 584 if (TextUtils.isEmpty(SystemProperties.get("ro.build.fingerprint"))) { 585 try { 586 SystemProperties.set("ro.build.fingerprint", FINGERPRINT); 587 } catch (IllegalArgumentException e) { 588 Slog.e(TAG, "Failed to set fingerprint property", e); 589 } 590 } 591 } 592 593 // The following properties only make sense for internal engineering builds. 594 public static final long TIME = getLong("ro.build.date.utc") * 1000; 595 public static final String USER = getString("ro.build.user"); 596 public static final String HOST = getString("ro.build.host"); 597 598 /** 599 * Returns true if we are running a debug build such as "user-debug" or "eng". 600 * @hide 601 */ 602 public static final boolean IS_DEBUGGABLE = 603 SystemProperties.getInt("ro.debuggable", 0) == 1; 604 605 /** 606 * Returns the version string for the radio firmware. May return 607 * null (if, for instance, the radio is not currently on). 608 */ 609 public static String getRadioVersion() { 610 return SystemProperties.get(TelephonyProperties.PROPERTY_BASEBAND_VERSION, null); 611 } 612 613 private static String getString(String property) { 614 return SystemProperties.get(property, UNKNOWN); 615 } 616 617 private static String[] getStringList(String property, String separator) { 618 String value = SystemProperties.get(property); 619 if (value.isEmpty()) { 620 return new String[0]; 621 } else { 622 return value.split(separator); 623 } 624 } 625 626 private static long getLong(String property) { 627 try { 628 return Long.parseLong(SystemProperties.get(property)); 629 } catch (NumberFormatException e) { 630 return -1; 631 } 632 } 633} 634