1page.title=Android 5.0 APIs 2excludeFromSuggestions=true 3sdk.platform.version=5.0 4sdk.platform.apiLevel=21 5@jd:body 6 7 8<div id="qv-wrapper"> 9<div id="qv"> 10 11<h2>In this document 12 <a href="#" onclick="hideNestedItems('#toc44',this);return false;" class="header-toggle"> 13 <span class="more">show more</span> 14 <span class="less" style="display:none">show less</span></a></h2> 15 16<ol id="toc44" class="hide-nested"> 17 <li><a href="#ApiLevel">Update your target API level</a></li> 18 19 20 21 22 <li><a href="#UI">User Interface</a> 23 <ol> 24 <li><a href="#MaterialDesign">Material design support</a></li> 25 <li><a href="#Recents">Concurrent documents and activities in the recents screen</a></li> 26 <li><a href="#WebView">WebView updates</a></li> 27 <li><a href="#ScreenCapture">Screen capturing and sharing</a></li> 28 </ol> 29 </li> 30 <li><a href="#Notifications">Notifications</a> 31 <ol> 32 <li><a href="#LockscreenNotifications">Lock screen notifications</a></li> 33 <li><a href="#NotificationsMetadata">Notifications metadata</a></li> 34 </ol> 35 </li> 36 <li><a href="#Graphics">Graphics</a> 37 <ol> 38 <li><a href="#OpenGLES-3-1">Support for OpenGL ES 3.1</a></li> 39 <li><a href="#AndroidExtensionPack">Android Extension Pack</a></li> 40 </ol> 41 </li> 42 <li><a href="#Media">Media</a> 43 <ol> 44 <li><a href="#Camera-v2">Camera API for advanced camera capabilities</a></li> 45 <li><a href="#AudioPlayback">Audio playback</a></li> 46 <li><a href="#MediaPlaybackControl">Media playback control</a></li> 47 <li><a href="#MediaBrowsing">Media browsing</a></li> 48 </ol> 49 </li> 50 <li><a href="#Storage">Storage</a> 51 <ol> 52 <li><a href="#DirectorySelection">Directory selection</a></li> 53 </ol> 54 </li> 55 <li><a href="#Wireless">Wireless and Connectivity</a> 56 <ol> 57 <li><a href="#Multinetwork">Multiple network connections</a></li> 58 <li><a href="#BluetoothBroadcasting">Bluetooth broadcasting</a></li> 59 <li><a href="#NFCEnhancements">NFC enhancements</a></li> 60 </ol> 61 </li> 62 <li><a href="#Power">Project Volta</a> 63 <ol> 64 <li><a href="#JobScheduler">Scheduling jobs</a></li> 65 <li><a href="#PowerMeasurementTools">Developer tools for battery usage</a> 66 </ol> 67 </li> 68 <li><a href="#Enterprise">Android in the Workplace and in Education</a> 69 <ol> 70 <li><a href="#ManagedProvisioning">Managed provisioning</a></li> 71 <li><a href="#DeviceOwner">Device owner</a></li> 72 <li><a href="#ScreenPinning">Screen pinning</a></li> 73 </ol> 74 </li> 75 <li><a href="#System">System</a> 76 <ol> 77 <li><a href="#AppUsageStatistics">App usage statistics</a></li> 78 </ol> 79 </li> 80 <li><a href="#Printing">Printing Framework</a> 81 <ol> 82 <li><a href="#PDFRender">Render PDF as bitmap</a></li> 83 </ol> 84 </li> 85 <li><a href="#TestingA11y">Testing & Accessibility</a> 86 <ol> 87 <li><a href="#TestingA11yImprovements">Testing and accessibility improvements</a></li> 88 </ol> 89 </li> 90 <li><a href="#IME">IME</a> 91 <ol> 92 <li><a href="#Switching">Easier switching between input languages</a></li> 93 </ol> 94 </li> 95 <li><a href="#Manifest">Manifest Declarations</a> 96 <ol> 97 <li><a href="#ManifestFeatures">Declarable required features</a></li> 98 <li><a href="#Permissions">User permissions</a></li> 99 </ol> 100 </li> 101</ol> 102 103<h2>API Differences</h2> 104<ol> 105<li><a href="{@docRoot}sdk/api_diff/21/changes.html">API level 20 to 21 »</a> </li> 106<li><a href="{@docRoot}sdk/api_diff/preview-21/changes.html">L Developer Preview to 21 »</a> </li> 107</ol> 108 109<h2>See Also</h2> 110<ol> 111<li><a href="{@docRoot}about/versions/android-5.0-changes.html">Android 5.0 Behavior Changes</a> </li> 112<li><a href="{@docRoot}about/versions/lollipop.html">Android Lollipop Highlights</a> </li> 113</ol> 114 115 116</div> 117</div> 118 119<p>API Level: {@sdkPlatformApiLevel}</p> 120 121<p>Android 5.0 (<a href="{@docRoot}reference/android/os/Build.VERSION_CODES.html#LOLLIPOP">LOLLIPOP</a>) 122 offers new features for users and app developers. This document provides an 123 introduction to the most notable new APIs.</p> 124 125<p> 126 If you have a published app, make sure to check out the <a href= 127 "{@docRoot}about/versions/android-5.0-changes.html">Android 5.0 Behavior 128 Changes</a> that you should account for in your app. These behavior changes 129 may affect your app on Android 5.0 devices, even if you are not using new APIs 130 or targeting new functionality. 131</p> 132 133<p>For a high-level look at the new platform features, instead 134see the 135<a href="{@docRoot}about/versions/lollipop.html">Android Lollipop 136highlights</a>.</p> 137 138<h3 id="Start">Start developing</h3> 139 140<p>To start building apps for Android 5.0, you must first <a href="{@docRoot}sdk/index.html">get 141the Android SDK</a>. Then use the <a href="{@docRoot}tools/help/sdk-manager.html">SDK Manager</a> 142to download the Android 5.0 SDK Platform and System Images.</p> 143 144 145<h3 id="ApiLevel">Update your target API level</h3> 146 147<p>To better optimize your app for devices running Android {@sdkPlatformVersion}, 148 set your <a 149href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code targetSdkVersion}</a> to 150<code>"{@sdkPlatformApiLevel}"</code>, install your app on an Android 151{@sdkPlatformVersion} system image, test it, then publish the updated app with 152this change.</p> 153 154<p>You can use Android {@sdkPlatformVersion} APIs while also supporting older 155versions by adding conditions to your code that check for the system API level 156before executing APIs not supported by your <a 157href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code minSdkVersion}</a>. 158To learn more about maintaining backward compatibility, read <a 159href="{@docRoot}training/basics/supporting-devices/platforms.html">Supporting 160Different Platform Versions</a>.</p> 161 162<p>For more information about how API levels work, read <a 163href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#ApiLevels">What is API 164Level?</a></p> 165 166<h3 id="Behaviors">Important behavior changes</h3> 167 168<p>If you have previously published an app for Android, be aware that your app might be affected by changes in Android 5.0.</p> 169 170<p>Please see <a href="{@docRoot}about/versions/android-5.0-changes.html">Android 5.0 Changes</a> for complete information.</p> 171 172 173<h2 id="UI">User Interface</h2> 174 175<h3 id="MaterialDesign">Material design support</h3> 176 177<p>Android 5.0 adds support for Android's new <em>material design</em> 178style. You can create apps with material design that are visually dynamic and 179have UI element transitions that feel natural to users. This support includes:</p> 180 181<ul> 182 183 <li>The material theme</li> 184 <li>View shadows</li> 185 <li>The {@link android.support.v7.widget.RecyclerView} widget</li> 186 <li>Drawable animation and styling effects</li> 187 <li>Material design animation and activity transition effects</li> 188 <li>Animators for view properties based on the state of the view</li> 189 <li>Customizable UI widgets and app bars with color palettes that you control</li> 190 <li>Animated and non-animated drawables based on XML vector graphics</li> 191</ul> 192 193<p>To learn more about adding material design functionality to your app, see 194<a href="{@docRoot}training/material/index.html">Material Design</a>.</p> 195 196<h3 id="Recents">Concurrent documents and activities in the recents screen</h3> 197 198<p>In previous releases, the 199<a href="{@docRoot}guide/components/recents.html">recents screen</a> 200could only display only one task for each app that the user interacted with 201most recently. Now your app can open more tasks as needed for additional 202concurrent activities for documents. This feature facilitates multitasking by 203letting users quickly switch between individual activities and documents from 204the recents screen, with a consistent switching experience across all apps. 205Examples of such concurrent tasks might include open tabs in a web 206browser app, documents in a productivity app, concurrent matches in 207a game, or chats in a messaging app. Your app can manage its tasks 208through the {@link android.app.ActivityManager.AppTask} class.</p> 209 210<p>To insert a logical break so that the system treats your activity as a new 211task, use {@link android.content.Intent#FLAG_ACTIVITY_NEW_DOCUMENT} when 212launching the activity with {@link android.app.Activity#startActivity(android.content.Intent) 213startActivity()}. You can also get this behavior by setting the 214<a href="{@docRoot}guide/topics/manifest/activity-element.html"><activity></a> 215element's {@code documentLaunchMode} attribute to {@code "intoExisting"} or 216{@code "always"} in your manifest.</p> 217 218<p>To avoid cluttering the recents screen, you can set the maximum number of 219tasks from your app that can appear in that screen. To do this, set the 220<a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a> 221attribute {@link android.R.attr#maxRecents android:maxRecents}. The current 222maximum that can be specified is 50 tasks per user (25 for low RAM devices).</a></p> 223 224<p>Tasks in the recents screen can be set to persist across reboots. To control 225the persistence behavior, use the 226<a href="{@docRoot}reference/android/R.attr.html#persistableMode">android:persistableMode</a> 227attribute. You can also change 228the visual properties of an activity in the recents screen, such as the 229activity’s color, label, and icon, by calling the 230{@link android.app.Activity#setTaskDescription(android.app.ActivityManager.TaskDescription) setTaskDescription()} 231method.</p> 232 233<h3 id="WebView">WebView updates</h3> 234<p>Android 5.0 updates the {@link android.webkit.WebView} 235implementation to Chromium M37, bringing security and stability enhancements, 236as well as bug fixes. The default user-agent string for a 237{@link android.webkit.WebView} running on Android 5.0 has 238been updated to incorporate 37.0.0.0 as the version number.</p> 239 240<p>This release introduces the {@link android.webkit.PermissionRequest} class, 241which allows your app to grant the {@link android.webkit.WebView} permission 242to access protected resources like the camera and microphone, through web APIs 243such as <a href="https://developer.mozilla.org/en-US/docs/NavigatorUserMedia.getUserMedia" 244class="external-link">getUserMedia()</a>. Your app must have the appropriate 245Android permissions for these resources in order to grant the permissions to the 246{@link android.webkit.WebView}.</p> 247 248<p>With the new <code><a href="{@docRoot}reference/android/webkit/WebChromeClient.html#onShowFileChooser(android.webkit.WebView, android.webkit.ValueCallback<android.net.Uri[]>, android.webkit.WebChromeClient.FileChooserParams)">onShowFileChooser()</a></code> method, 249you can now use an input form field in the {@link android.webkit.WebView}, 250and launch a file chooser to select images and files from the Android device.</p> 251 252<p>Additionally, this release brings support for the 253<a href="http://webaudio.github.io/web-audio-api/" class="external-link">WebAudio</a>, 254<a href="https://www.khronos.org/webgl/" class="external-link">WebGL</a>, and 255<a href="http://www.webrtc.org/" class="external-link">WebRTC</a> open standards. 256To learn more about the new features included in this release, see 257<a href="https://developer.chrome.com/multidevice/webview/overview" 258class="external-link">WebView for Android</a>.</p> 259 260<h3 id="ScreenCapture">Screen capturing and sharing</h3> 261<p>Android 5.0 lets you add screen capturing and screen sharing capabilities to 262your app with the new {@link android.media.projection} APIs. This functionality 263is useful, for example, if you want to enable screen sharing in a video 264conferencing app.</p> 265 266<p>The new {@link android.media.projection.MediaProjection#createVirtualDisplay(java.lang.String, int, int, int, int, android.view.Surface, android.hardware.display.VirtualDisplay.Callback, android.os.Handler) createVirtualDisplay()} method 267allows your app to capture the contents of the main screen (the default 268display) into a {@link android.view.Surface} object, which your app can then 269send across the network. The API only allows capturing non-secure screen 270content, and not system audio. To begin screen capturing, your app must first 271request the user’s permission by launching a screen capture dialog using an 272{@link android.content.Intent} obtained through the 273{@link android.media.projection.MediaProjectionManager#createScreenCaptureIntent()} 274method.</p> 275 276<p>For an example of how to use the new APIs, see the {@code MediaProjectionDemo} 277class in the sample project.</p> 278 279<h2 id="Notifications">Notifications</h2> 280 281<h3 id="LockscreenNotifications">Lock screen notifications</h3> 282<p>Lock screens in Android 5.0 have the ability to present 283notifications. Users can choose via <em>Settings</em> whether to allow 284sensitive notification content to be shown over a secure lock screen.</p> 285 286<p>Your app can control the level of detail visible when its notifications are 287displayed over the secure lock screen. To control the visibility level, call 288{@link android.app.Notification.Builder#setVisibility(int) setVisibility()} and 289specify one of these values:</p> 290 291<ul> 292<li>{@link android.app.Notification#VISIBILITY_PRIVATE VISIBILITY_PRIVATE}: 293Shows basic information, such as the notification’s icon, but hides the 294notification’s full content.</li> 295<li>{@link android.app.Notification#VISIBILITY_PUBLIC VISIBILITY_PUBLIC}: 296Shows the notification’s full content.</li> 297<li>{@link android.app.Notification#VISIBILITY_SECRET VISIBILITY_SECRET}: 298Shows nothing, excluding even the notification’s icon.</li> 299</ul> 300 301<p>When the visibility level is {@link android.app.Notification#VISIBILITY_PRIVATE VISIBILITY_PRIVATE}, 302 you can also provide a redacted version of the notification 303content that hides personal details. For example, an SMS app might display a 304notification that shows "You have 3 new text messages" but hides the message 305content and senders. To provide this alternative notification, first create the 306replacement notification using {@link android.app.Notification.Builder}. When 307you create the private notification object, attach the replacement notification 308to it through the 309{@link android.app.Notification.Builder#setPublicVersion(android.app.Notification) 310 setPublicVersion()} method.</p> 311 312<h3 id="NotificationsMetadata">Notifications metadata</h3> 313<p>Android 5.0 uses metadata associated with your app notifications 314to sort the notifications more intelligently. To set the metadata, call the 315following methods in {@link android.app.Notification.Builder} when you 316construct the notification:</p> 317 318<ul> 319<li>{@link android.app.Notification.Builder#setCategory(java.lang.String) 320 setCategory()}: Tells the system how to handle your app notifications when the 321 device is in <em>priority</em> mode (for example, if a notification represents an 322incoming call, instant message, or alarm). 323<li>{@link android.app.Notification.Builder#setPriority(int) setPriority()}: 324 Marks the notification as more or less important than normal notifications. 325 Notifications with the priority field set to 326 {@link android.app.Notification#PRIORITY_MAX PRIORITY_MAX} or 327{@link android.app.Notification#PRIORITY_HIGH PRIORITY_HIGH} appear in a 328small floating window if the notification also has sound or vibration.</li> 329<li>{@link android.app.Notification.Builder#addPerson(java.lang.String) 330addPerson()}: Enables you to add one or more people who are relevant to a notification. 331Your app can use this to signal to the system that it should group together 332notifications from the specified people, or rank notifications from these people 333as being more important.</li> 334</ul> 335 336<h2 id="Graphics">Graphics</h2> 337 338<h3 id="OpenGLES-3-1">Support for OpenGL ES 3.1</h3> 339<p>Android 5.0 adds Java interfaces and native support for OpenGL 340ES 3.1. Key new functionality provided in OpenGL ES 3.1 includes:</p> 341 342<ul> 343<li>Compute shaders 344<li>Separate shader objects 345<li>Indirect draw commands 346<li>Multisample and stencil textures 347<li>Shading language improvements 348<li>Extensions for advanced blend modes and debugging 349<li>Backward compatibility with OpenGL ES 2.0 and 3.0 350</ul> 351 352<p>The Java interface for OpenGL ES 3.1 on Android is provided with 353 {@link android.opengl.GLES31}. When using OpenGL ES 3.1, be sure that you 354 declare it in your manifest file with the 355 <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> tag and the {@code android:glEsVersion} attribute. For example:</p> 356 357<pre> 358<manifest> 359 <uses-feature android:glEsVersion="0x00030001" /> 360 ... 361</manifest> 362</pre> 363 364<p>For more information about using OpenGL ES, including how to check the 365device’s supported OpenGL ES version at runtime, see the 366<a href="{@docRoot}guide/topics/graphics/opengl.html">OpenGL ES API guide</a>.</p> 367 368<h3 id="AndroidExtensionPack">Android Extension Pack</h3> 369 370<p>In addition to OpenGL ES 3.1, this release provides an extension pack with 371Java interfaces and native support for advanced graphics functionality. These 372extensions are treated as a single package by Android. (If the 373{@code ANDROID_extension_pack_es31a} extension is present, your app can 374assume all extensions in the package are present and enable the shading language 375features with a single {@code #extension} statement.)</p> 376 377<p>The extension pack supports:</p> 378 379<ul> 380<li>Guaranteed fragment shader support for shader storage buffers, images, and 381 atomics (Fragment shader support is optional in OpenGL ES 3.1.)</li> 382<li>Tessellation and geometry shaders</li> 383<li>ASTC (LDR) texture compression format</li> 384<li>Per-sample interpolation and shading</li> 385<li>Different blend modes for each color attachment in a frame buffer</li> 386</ul> 387 388<p>The Java interface for the extension pack is provided with 389 {@link android.opengl.GLES31Ext}. In your app manifest, you can declare that 390 your app must be installed only on devices that support the extension pack. 391 For example:</p> 392 393<pre> 394<manifest> 395 <uses-feature android:name=“android.hardware.opengles.aep” 396 android:required="true" /> 397 ... 398</manifest> 399</pre> 400 401<h2 id="Media">Media</h2> 402 403<h3 id="Camera-v2">Camera API for advanced camera capabilities</h3> 404 405<p>Android 5.0 introduces the new 406<a href="{@docRoot}reference/android/hardware/camera2/package-summary.html">android.hardware.camera2</a> 407API to facilitate fine-grain photo capture and image processing. You can now 408programmatically access the camera devices available to the system with 409{@link android.hardware.camera2.CameraManager#getCameraIdList() getCameraIdList()} 410and connect to a specific device with 411{@link android.hardware.camera2.CameraManager#openCamera(java.lang.String, android.hardware.camera2.CameraDevice.StateCallback, android.os.Handler) openCamera()}. 412To start capturing images, create a {@link android.hardware.camera2.CameraCaptureSession} 413and specify the {@link android.view.Surface} objects to send captured images. 414The {@link android.hardware.camera2.CameraCaptureSession} can be configured to 415take single shots or multiple images in a burst.</p> 416 417<p>To be notified when new images are captured, implement the 418{@link android.hardware.camera2.CameraCaptureSession.CaptureCallback} listener 419and set it in your capture request. Now when the system completes the image 420capture request, your {@link android.hardware.camera2.CameraCaptureSession.CaptureCallback} 421listener receives a call to 422{@link android.hardware.camera2.CameraCaptureSession.CaptureCallback#onCaptureCompleted(android.hardware.camera2.CameraCaptureSession, android.hardware.camera2.CaptureRequest, android.hardware.camera2.TotalCaptureResult) onCaptureCompleted()}, 423providing you with the image capture metadata in a 424{@link android.hardware.camera2.CaptureResult}.</p> 425 426<p>The {@link android.hardware.camera2.CameraCharacteristics} class lets your 427app detect what camera features are available on a device. The object's 428{@link android.hardware.camera2.CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL 429INFO_SUPPORTED_HARDWARE_LEVEL} property represents the camera's level of functionality.</p> 430 431<ul> 432 <li>All devices support at least the 433{@link android.hardware.camera2.CameraMetadata#INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY 434 INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY} hardware level, which has capabilities 435 roughly equivalent to that of the deprecated {@link android.hardware.Camera} 436 API.</li> 437 <li>Devices that support the {@link android.hardware.camera2.CameraMetadata#INFO_SUPPORTED_HARDWARE_LEVEL_FULL 438 INFO_SUPPORTED_HARDWARE_LEVEL_FULL} hardware level are capable of manual 439 control of capture and post-processing, and capturing high-resolution images 440 at high frame rates.</li> 441</ul> 442 443<p>To see how to use the updated 444<a href="{@docRoot}reference/android/hardware/camera2/package-summary.html">Camera</a> 445API, refer to the {@code Camera2Basic} and {@code Camera2Video} implementation 446samples in this release.</p> 447 448<h3 id="AudioPlayback">Audio playback</h3> 449<p>This release includes the following changes to 450 {@link android.media.AudioTrack}:</p> 451<ul> 452 <li>Your app can now supply audio data in floating-point format 453({@link android.media.AudioFormat#ENCODING_PCM_FLOAT ENCODING_PCM_FLOAT}). This 454permits greater dynamic range, more consistent precision, and greater headroom. 455Floating-point arithmetic is especially useful during intermediate calculations. 456Playback endpoints use integer format for audio data, and with lower bit depth. 457(In Android 5.0, portions of the internal pipeline are not yet 458floating point.) 459 <li>Your app can now supply audio data as a {@link java.nio.ByteBuffer}, in 460the same format as provided by {@link android.media.MediaCodec}. 461 <li>The {@link android.media.AudioTrack#WRITE_NON_BLOCKING WRITE_NON_BLOCKING} 462option can simplify buffering and multithreading for some apps. 463</ul> 464 465<h3 id="MediaPlaybackControl">Media playback control</h3> 466<p>Use the new notification and media APIs to ensure that the 467system UI knows about your media playback and can extract and show album art. 468Controlling media playback across a UI and a service is now easier with the new 469{@link android.media.session.MediaSession} and 470{@link android.media.session.MediaController} classes.</p> 471 472<p>The new {@link android.media.session.MediaSession} class replaces 473the deprecated {@link android.media.RemoteControlClient} class and provides a 474single set of callback methods for handling transport controls and media buttons. 475If your app provides media playback and runs on the Android 476<a href="{@docRoot}tv/index.html">TV</a> or 477<a href="{@docRoot}wear/index.html">Wear</a> platform, use the 478{@link android.media.session.MediaSession} class to handle your transport 479controls using the same callback methods.</p> 480 481<p>You can now build your own media controller app with the new 482{@link android.media.session.MediaController} class. This class provides 483a thread-safe way to monitor and control media playback from your app's UI process. 484When creating a controller, specify a {@link android.media.session.MediaSession.Token} 485object so that your app can interact with the given {@link android.media.session.MediaSession}. 486By using the {@link android.media.session.MediaController.TransportControls} methods, 487you can send commands such as {@link android.media.session.MediaController.TransportControls#play() play()}, 488{@link android.media.session.MediaController.TransportControls#stop() stop()}, 489{@link android.media.session.MediaController.TransportControls#skipToNext() skipToNext()}, 490and {@link android.media.session.MediaController.TransportControls#setRating(android.media.Rating) setRating()} 491to control media playback on that session. With the controller, you can also 492register a {@link android.media.session.MediaController.Callback} object to 493listen for metadata and state changes on the session.</p> 494 495<p>In addition, you can create rich notifications that allow playback control 496tied to a media session with the new {@link android.app.Notification.MediaStyle} 497class.</p> 498 499<h3 id="MediaBrowsing">Media browsing</h3> 500<p>Android 5.0 introduces the ability for apps to browse the media content 501 library of another app, through the new 502 <a href="{@docRoot}reference/android/media/browse/package-summary.html">android.media.browse</a> 503 API. To expose the media content in your app, extend the 504{@link android.service.media.MediaBrowserService} class. Your implementation of 505{@link android.service.media.MediaBrowserService} should provide access to a 506{@link android.media.session.MediaSession.Token} so that apps can play media content 507provided through your service.</p> 508<p>To interact with a media browser service, use the 509 {@link android.media.browse.MediaBrowser} class. Specify the component 510 name for a {@link android.media.session.MediaSession} when you create an 511 {@link android.media.browse.MediaBrowser} instance. Using that browser instance, 512 your app can then connect to the associated service and obtain a 513 {@link android.media.session.MediaSession.Token} object to play content exposed 514 through that service.</p> 515 516<h2 id="Storage">Storage</h2> 517 518<h3 id="DirectorySelection">Directory selection</h3> 519 520<p>Android 5.0 extends the 521 <a href="{@docRoot}guide/topics/providers/document-provider.html">Storage Access Framework</a> 522to let users select an entire directory subtree, giving apps read/write access 523to all contained documents without requiring user confirmation for each item.</p> 524 525<p>To select a directory subtree, build and send an 526{@link android.content.Intent#ACTION_OPEN_DOCUMENT_TREE OPEN_DOCUMENT_TREE} 527intent. The system displays all 528{@link android.provider.DocumentsProvider} instances that support subtree selection, 529letting the user browse and select a directory. The returned URI represents 530access to the selected subtree. You can then use {@link 531android.provider.DocumentsContract#buildChildDocumentsUriUsingTree(android.net.Uri, java.lang.String) buildChildDocumentsUriUsingTree()} 532and {@link android.provider.DocumentsContract#buildDocumentUriUsingTree(android.net.Uri, java.lang.String) buildDocumentUriUsingTree()} 533along with 534{@link android.content.ContentResolver#query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String) query()} 535to explore the subtree.</p> 536 537<p>The new {@link android.provider.DocumentsContract#createDocument(android.content.ContentResolver, android.net.Uri, java.lang.String, java.lang.String) 538createDocument()} method lets you create new documents or directories anywhere 539under the subtree. To manage existing documents, use 540{@link android.provider.DocumentsContract#renameDocument(android.content.ContentResolver, android.net.Uri, java.lang.String) renameDocument()} and 541{@link android.provider.DocumentsProvider#deleteDocument(java.lang.String) deleteDocument()}. 542Check {@link android.provider.DocumentsContract.Document#COLUMN_FLAGS COLUMN_FLAGS} 543to verify provider support for these calls before issuing them.</p> 544 545<p>If you're implementing a {@link android.provider.DocumentsProvider} and want 546to support subtree selection, implement {@link android.provider.DocumentsProvider#isChildDocument(java.lang.String, java.lang.String) isChildDocument()} and include {@link 547android.provider.DocumentsContract.Root#FLAG_SUPPORTS_IS_CHILD FLAG_SUPPORTS_IS_CHILD} 548in your {@link android.provider.DocumentsContract.Root#COLUMN_FLAGS COLUMN_FLAGS}.</p> 549 550<p>Android 5.0 also introduces new package-specific directories on 551shared storage where your app can place media files for inclusion in 552{@link android.provider.MediaStore}. The new 553{@link android.content.Context#getExternalMediaDirs()} returns paths to these 554directories on all shared storage devices. Similarly to 555{@link android.content.Context#getExternalFilesDir(java.lang.String) getExternalFilesDir()}, 556no additional permissions are needed by your app to access the returned paths. The 557platform periodically scans for new media in these directories, but you can also 558use {@link android.media.MediaScannerConnection} to explicitly scan for new 559content.</p> 560 561<h2 id="Wireless">Wireless & Connectivity</h2> 562 563<h3 id="Multinetwork">Multiple network connections</h3> 564<p>Android 5.0 provides new multi-networking APIs that let your app 565dynamically scan for available networks with specific capabilities, and 566establish a connection to them. This functionality is useful when your app 567requires a specialized network, such as an SUPL, MMS, or carrier-billing network, 568or if you want to send data using a particular type of transport protocol.</p> 569 570<p>To select and connect to a network dynamically from your app, follow these 571steps:</p> 572 573<ol> 574 <li>Create a {@link android.net.ConnectivityManager}.</li> 575 <li>Use the {@link android.net.NetworkRequest.Builder} class to create an 576 {@link android.net.NetworkRequest} object and specify the network features 577 and transport type your app is interested in.</li> 578<li>To scan for suitable networks, call {@link android.net.ConnectivityManager#requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback) requestNetwork()} 579or {@link android.net.ConnectivityManager#registerNetworkCallback(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback) registerNetworkCallback()}, and pass in the 580{@link android.net.NetworkRequest} object and an implementation of 581{@link android.net.ConnectivityManager.NetworkCallback}. Use the 582{@link android.net.ConnectivityManager#requestNetwork(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback) requestNetwork()} method if you want to actively switch to a suitable network once it’s detected; to receive 583only notifications for scanned networks without actively switching, use the 584{@link android.net.ConnectivityManager#registerNetworkCallback(android.net.NetworkRequest, android.net.ConnectivityManager.NetworkCallback) registerNetworkCallback()} method instead.</li> 585</ol> 586 587<p>When the system detects a suitable network, it connects to the network and 588invokes the 589{@link android.net.ConnectivityManager.NetworkCallback#onAvailable(android.net.Network) onAvailable()} 590callback. You can use the {@link android.net.Network} object from the callback to 591get additional information about the network, or to direct traffic to use the 592selected network.</p> 593 594<h3 id="BluetoothBroadcasting">Bluetooth Low Energy</h3> 595<p>Android 4.3 introduced platform support for 596 <a href="{@docRoot}guide/topics/connectivity/bluetooth-le.html">Bluetooth Low Energy</a> 597(<em>Bluetooth LE</em>) in the central role. In Android 5.0, an Android device can now 598act as a Bluetooth LE <em>peripheral device</em>. Apps can use this capability 599to make their presence known to nearby devices. For instance, you can build apps 600that allow a device to function as a pedometer or health monitor and communicate 601its data with another Bluetooth LE device.</p> 602 603<p>The new {@link android.bluetooth.le} APIs enable your apps to broadcast 604advertisements, scan for responses, and form connections with nearby Bluetooth 605LE devices. To use the new advertising and scanning features, add the 606{@link android.Manifest.permission#BLUETOOTH_ADMIN BLUETOOTH_ADMIN} 607permission in your manifest. When users update or download your app from the Play Store, 608they are asked to grant the following permission to your app: 609"Bluetooth connection information: Allows the app to control Bluetooth, 610including broadcasting to or getting information about nearby Bluetooth devices."</p> 611 612<p>To begin Bluetooth LE advertising so that other devices can discover 613your app, call 614{@link android.bluetooth.le.BluetoothLeAdvertiser#startAdvertising(android.bluetooth.le.AdvertiseSettings, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertiseCallback) startAdvertising()} 615and pass in an implementation of the 616{@link android.bluetooth.le.AdvertiseCallback} class. The callback object 617receives a report of the success or failure of the advertising operation.</p> 618 619<p> Android 5.0 introduces the {@link android.bluetooth.le.ScanFilter} class so 620 that your app can scan for only the 621specific types of devices it is interested in. To begin scanning for Bluetooth 622LE devices, call {@link android.bluetooth.le.BluetoothLeScanner#startScan(android.bluetooth.le.ScanCallback) startScan()} 623and pass in a list of filters. In the method call, you must also provide an 624implementation of {@link android.bluetooth.le.ScanCallback} to report when a 625Bluetooth LE advertisement is found. </p> 626 627<h3 id="NFCEnhancements">NFC enhancements</h3> 628<p>Android 5.0 adds these enhancements to enable wider and more 629flexible use of NFC:</p> 630 631<ul> 632<li>Android Beam is now available in the <em>share</em> menu.</li> 633<li>Your app can invoke the Android Beam on the user’s device to share data by 634calling {@link android.nfc.NfcAdapter#invokeBeam(android.app.Activity) invokeBeam()}. 635This avoids the need for the user to manually tap the device against another 636NFC-capable device to complete the data transfer.</li> 637<li>You can use the new {@link android.nfc.NdefRecord#createTextRecord(java.lang.String, java.lang.String) 638 createTextRecord()} method to create an NDEF record containing UTF-8 text data.</li> 639<li>If you are developing a payment app, you now have the ability to 640register an NFC application ID (AID) dynamically by calling 641<code><a href="{@docRoot}reference/android/nfc/cardemulation/CardEmulation.html#registerAidsForService(android.content.ComponentName, java.lang.String, java.util.List<java.lang.String>)">registerAidsForService()</a></code>. 642You can also use {@link android.nfc.cardemulation.CardEmulation#setPreferredService(android.app.Activity, android.content.ComponentName) setPreferredService()} to set the preferred card emulation service that should 643be used when a specific activity is in the foreground.</li> 644</ul> 645 646<h2 id="Power">Project Volta</h2> 647 648<p>In addition to new features, Android 5.0 emphasizes improvements in battery 649 life. Use the new APIs and tool to understand and optimize your app’s power 650 consumption.</p> 651 652<h3 id="JobScheduler">Scheduling jobs</h3> 653<p>Android 5.0 provides a new {@link android.app.job.JobScheduler} 654API that lets you optimize battery life by defining jobs for the system to run 655asynchronously at a later time or under specified conditions (such as when the 656device is charging). Job scheduling is useful in such situations as:</p> 657<ul> 658 <li>The app has non-user-facing work that you can defer.</li> 659 <li>The app has work you'd prefer to do when the unit is plugged in.</li> 660 <li>The app has a task that requires network access or a Wi-Fi 661 connection.</li> 662 <li>The app has a number of tasks that you want to run as a batch on a regular 663 schedule.</li> 664 665</ul> 666 667<p>A unit of work is encapsulated by a {@link android.app.job.JobInfo} object. 668This object specifies the scheduling criteria.</p> 669 670<p>Use the {@link android.app.job.JobInfo.Builder} class to configure how the 671scheduled task should run. You can schedule the task to run under specific 672conditions, such as:</p> 673 674<ul> 675 <li>Start when the device is charging</li> 676 <li>Start when the device is connected to an unmetered network</li> 677 <li>Start when the device is idle</li> 678 <li>Finish before a certain deadline or with a minimum delay</li> 679</ul> 680 681<p>For example, you can add code like this to run your task on an 682unmetered network:</p> 683 684<pre> 685JobInfo uploadTask = new JobInfo.Builder(mJobId, 686 mServiceComponent /* JobService component */) 687 .setRequiredNetworkCapabilities(JobInfo.NetworkType.UNMETERED) 688 .build(); 689JobScheduler jobScheduler = 690 (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); 691jobScheduler.schedule(uploadTask); 692</pre> 693 694<p>If the device has stable power (that is, it has been plugged in for more 695 than 2 minutes and the battery is at a 696<a href="{@docRoot}reference/android/content/Intent.html#ACTION_BATTERY_OKAY">healthy level</a>), 697the system will run any scheduled job that is ready to run, even if the job’s 698deadline has not expired.</p> 699 700<p>To see an example of how to use the {@link android.app.job.JobScheduler} API, 701refer to the {@code JobSchedulerSample} implementation sample in this release.</p> 702 703<h3 id="PowerMeasurementTools">Developer tools for battery usage</h3> 704 705<p>The new {@code dumpsys batterystats} command generates interesting 706statistical data about battery usage on a device, organized by unique user ID 707(UID). The statistics include:</p> 708 709<ul> 710<li>History of battery related events 711<li>Global statistics for the device 712<li>Approximate power use per UID and system component 713<li>Per-app mobile ms per packet 714<li>System UID aggregated statistics 715<li>App UID aggregated statistics 716</ul> 717 718<p>Use the {@code --help} option to learn about the various options for 719tailoring the output. For example, to print battery usage 720statistics for a given app package since the device was last charged, run this 721command: 722<pre> 723$ adb shell dumpsys batterystats --charged <package-name> 724</pre> 725 726<p>You can use the 727 <a href="https://github.com/google/battery-historian" class="external-link">Battery Historian</a> 728 tool on the output of the {@code dumpsys} command to 729generate an HTML visualization of power-related events from the logs. This 730information makes it easier for you to understand and diagnose any battery 731related issues.</p> 732 733<h2 id="Enterprise">Android in the Workplace and in Education</h2> 734<h3 id="ManagedProvisioning">Managed provisioning</h3> 735 736<p>Android 5.0 provides new functionality for running apps within 737an enterprise environment. A 738<a href="{@docRoot}guide/topics/admin/device-admin.html">device administrator</a> can 739initiate a managed provisioning process to add a copresent but separate 740<em>managed profile</em> to a device, if the user has an existing personal account. 741Apps that are associated with managed profiles appear alongside 742non-managed apps in the user’s Launcher, recents screen, and notifications.</p> 743 744<p>To start the managed provisioning process, send 745{@link android.app.admin.DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE 746ACTION_PROVISION_MANAGED_PROFILE} in an {@link android.content.Intent}. If the 747call is successful, the system triggers the 748{@link android.app.admin.DeviceAdminReceiver#onProfileProvisioningComplete(android.content.Context, android.content.Intent) onProfileProvisioningComplete()} callback. 749You can then call {@link android.app.admin.DevicePolicyManager#setProfileEnabled(android.content.ComponentName) setProfileEnabled()} to 750enable this managed profile.</p> 751 752<p>By default, only a small subset of apps are enabled in the managed profile. 753 You can install additional apps in the managed profile by calling 754 {@link android.app.admin.DevicePolicyManager#enableSystemApp(android.content.ComponentName, android.content.Intent) enableSystemApp()}.</p> 755 756<p>If you are developing a Launcher app, you can use the new {@link 757android.content.pm.LauncherApps} class to get a list of launchable activities 758for the current user and any associated managed profiles. Your Launcher can make 759the managed apps visually prominent by appending a work badge to the icon 760drawable. To retrieve the badged icon, call 761{@link android.content.pm.PackageManager#getUserBadgedIcon(android.graphics.drawable.Drawable, android.os.UserHandle) 762getUserBadgedIcon()}.</p> 763 764<p>To see how to use the new functionality, refer to the 765{@code BasicManagedProfile} implementation sample in this release.</p> 766 767<h3 id="DeviceOwner">Device owner</h3> 768<p>Android 5.0 introduces the ability to deploy a device owner app. A <em>device 769 owner</em> is a specialized type of 770 <a href="{@docRoot}guide/topics/admin/device-admin.html">device administrator</a> 771 that has the additional ability to create and remove secondary users and to 772 configure global settings on the device. Your device owner app can use the 773 methods in the {@link android.app.admin.DevicePolicyManager} class to take 774 fine-grain control of the configuration, security, and apps on managed devices. 775 A device can have only one active device owner at a time.</p> 776 777<p>To deploy and activate a device owner, you must perform an NFC data transfer 778 from a programming app to the device while the device is in its unprovisioned 779 state. This data transfer sends the same information as in the provisioning intent 780 described in <a href="#ManagedProvisioning">Managed provisioning</a>.</p> 781 782<h3 id="ScreenPinning">Screen pinning</h3> 783 784<p>Android 5.0 introduces a new screen pinning API that lets you temporarily 785 restrict users from leaving your task or being interrupted by notifications. 786 This could be used, for example, if you are developing an education app to 787 support high stakes assessment requirements on Android, or a single-purpose or 788 kiosk application. Once your app activates screen pinning, users cannot see 789 notifications, access other apps, or return to the home screen, 790 until your app exits the mode.</p> 791 792<p>There are two ways to activate screen pinning:</p> 793 794<ul> 795<li><strong>Manually:</strong> Users can enable screen pinning in 796<em>Settings > Security > Screen Pinning</em>, and select the tasks they want to 797pin by touching the green pin icon in the recents screen.</li> 798<li><strong>Programmatically:</strong> To activate screen pinning 799programmatically, call {@link android.app.Activity#startLockTask() startLockTask()} 800from your app. If the requesting app is not a device owner, the user is prompted 801for confirmation. A device owner app can call the 802{@link android.app.admin.DevicePolicyManager#setLockTaskPackages(android.content.ComponentName, java.lang.String[]) setLockTaskPackages()} 803method to enable apps to be pinnable without the user confirmation step.</li> 804</ul> 805 806<p>When task locking is active, the following behavior happens:</p> 807 808<ul> 809<li>The status bar is blank, and user notifications and status information are 810hidden.</li> 811<li>The Home and Recent Apps buttons are hidden.</li> 812<li>Other apps cannot launch new activities.</li> 813<li>The current app can start new activities, as long as doing so does not 814create new tasks.</li> 815<li>When screen pinning is invoked by a device owner, the user remains locked 816 to your app until the app calls 817 {@link android.app.Activity#stopLockTask() stopLockTask()}.</li> 818<li>If screen pinning is activity by another app that is not a device owner or 819by the user directly, the user can exit by holding both the Back and Recent buttons.</li> 820 821</ul> 822 823<h2 id="Printing">Printing Framework</h2> 824 825<h3 id="PDFRender">Render PDF as bitmap</h3> 826<p>You can now render PDF document pages into bitmap images for printing by 827using the new {@link android.graphics.pdf.PdfRenderer} class. You must specify a 828{@link android.os.ParcelFileDescriptor} that is seekable (that is, the content 829can be randomly accessed) on which the system writes the the printable content. 830Your app can obtain a page for rendering with 831{@link android.graphics.pdf.PdfRenderer#openPage(int) openPage()}, then call 832{@link android.graphics.pdf.PdfRenderer.Page#render(android.graphics.Bitmap, android.graphics.Rect, android.graphics.Matrix, int) render()} 833to turn the opened {@link android.graphics.pdf.PdfRenderer.Page} into a bitmap. You 834can also set additional parameters if you only want to convert a portion of the 835document into a bitmap image (for example, to implement 836<a href="http://en.wikipedia.org/wiki/Tiled_rendering" class="external-link">tiled rendering</a> 837to zoom in on the document).</p> 838 839<p>For an example of how to use the new APIs, see the {@code PdfRendererBasic} 840 sample.</p> 841 842<h2 id="System">System</h2> 843<h3 id="AppUsageStatistics">App usage statistics</h3> 844<p>You can now access app usage history on an Android device with the 845 new {@link android.app.usage} API. This API provides more detailed usage 846 information than the deprecated 847 {@link android.app.ActivityManager#getRecentTasks(int, int) getRecentTasks()} method. 848 To use this API, you must first declare the 849 {@code "android.permission.PACKAGE_USAGE_STATS"} permission in your manifest. 850 The user must also enable access for this app through <em>Settings > Security > Apps</em> 851 with usage access.</p> 852 853<p>The system collects the usage data on a per-app basis, aggregating the 854 data over daily, weekly, monthly, and yearly intervals. The maximum duration 855 that the system keeps this data is as follows:</p> 856 857<ul> 858 <li>Daily data: 7 days</li> 859 <li>Weekly data: 4 weeks</li> 860 <li>Monthly data: 6 months</li> 861 <li>Yearly data: 2 years</li> 862</ul> 863 864<p>For each app, the system records the following data:</p> 865<ul> 866<li>The last time the app was used</li> 867<li>The total length of time the app was in the foreground for that time interval 868 (by day, week, month, or year)</li> 869<li>Timestamp capturing when a component (identified by a package and activity name) 870 moved to the foreground or background during a day</li> 871<li>Timestamp capturing when a device configuration changed (such as when the 872 device orientation changed because of rotation)</li> 873</ul> 874 875<h2 id="TestingA11y">Testing & Accessibility </h2> 876 877<h3 id="TestingA11yImprovements">Testing and accessibility improvements</h3> 878<p>Android 5.0 adds the following support for testing and 879accessibility:</p> 880 881<ul> 882<li>The new {@link android.app.UiAutomation#getWindowAnimationFrameStats() getWindowAnimationFrameStats()} 883and {@link android.app.UiAutomation#getWindowContentFrameStats(int) getWindowContentFrameStats()} 884methods capture frame statistics for window animations and content. These methods 885let you write instrumentation tests to evaluate whether an app is rendering 886frames at a sufficient refresh frequency to provide a smooth user experience.</li> 887 888<li>The new 889{@link android.app.UiAutomation#executeShellCommand(java.lang.String) executeShellCommand()} 890method lets you execute shell commands from your instrumentation test. The 891command execution is similar to running {@code adb shell} from a host 892connected to the device, allowing you to use shell-based tools such as 893{@code dumpsys}, {@code am}, {@code content}, and {@code pm}.</li> 894 895<li>Accessibility services and test tools that use the accessibility APIs 896(such as <a href="{@docRoot}tools/help/uiautomator/index.html">{@code UiAutomator}</a>) 897can now retrieve detailed information about the properties of windows on the 898screen that sighted users can interact with. To retrieve a list of 899{@link android.view.accessibility.AccessibilityWindowInfo} objects, call the new 900{@link android.accessibilityservice.AccessibilityService#getWindows() getWindows()} 901method.</li> 902 903<li>The new {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction} 904 class lets you define standard or customized actions to perform on an 905 {@link android.view.accessibility.AccessibilityNodeInfo}. 906The new {@link android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction} 907class replaces the actions-related APIs previously found in 908{@link android.view.accessibility.AccessibilityNodeInfo}.</li> 909 910<li>Android 5.0 provides finer-grain control over text-to-speech synthesis in 911 your app. The new {@link android.speech.tts.Voice} class allows your app to 912 use voice profiles associated with specific locales, quality and latency 913 rating, and text-to-speech engine-specific parameters.</li> 914</ul> 915 916<h2 id="IME">IME</h2> 917 918<h3 id="Switching">Easier switching between input languages</h3> 919 920<p>Beginning in Android 5.0, users can more easily switch between 921all <a href="{@docRoot}guide/topics/text/creating-input-method.html">input 922method editors (IME)</a> supported by the platform. Performing the designated 923switching action (usually touching a Globe icon on the soft keyboard) cycles 924through all such IMEs. This change in behavior is implemented by the 925{@link android.view.inputmethod.InputMethodManager#shouldOfferSwitchingToNextInputMethod(android.os.IBinder) shouldOfferSwitchingToNextInputMethod()} 926method.</p> 927 928<p>In addition, the framework now checks whether the next IME includes a 929switching mechanism at all (and, thus, whether that IME supports switching to 930the IME after it). An 931IME with a switching mechanism will not cycle to an IME without one. This 932change in behavior is implemented by the 933{@link android.view.inputmethod.InputMethodManager#switchToNextInputMethod(android.os.IBinder, boolean) switchToNextInputMethod()} 934method. 935 936<p>To see an example of how to use the updated IME-switching APIs, refer to the 937updated soft-keyboard implementation sample in this release. To learn more about 938how to implement switching between IMEs, see 939<a href="{@docRoot}guide/topics/text/creating-input-method.html">Creating an Input Method</a>. 940</p> 941 942<h2 id="Manifest">Manifest Declarations</h2> 943 944<h3 id="ManifestFeatures">Declarable required features</h3> 945<p>The following values are now supported in the 946<a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> 947element, so you can ensure that your app is installed only on devices that 948provide the features your app needs.</p> 949 950<ul> 951<li>{@link android.content.pm.PackageManager#FEATURE_AUDIO_OUTPUT}</li> 952<li>{@link android.content.pm.PackageManager#FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING}</li> 953<li>{@link android.content.pm.PackageManager#FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR}</li> 954<li>{@link android.content.pm.PackageManager#FEATURE_CAMERA_CAPABILITY_RAW}</li> 955<li>{@link android.content.pm.PackageManager#FEATURE_CAMERA_LEVEL_FULL}</li> 956<li>{@link android.content.pm.PackageManager#FEATURE_GAMEPAD}</li> 957<li>{@link android.content.pm.PackageManager#FEATURE_LIVE_TV}</li> 958<li>{@link android.content.pm.PackageManager#FEATURE_MANAGED_USERS}</li> 959<li>{@link android.content.pm.PackageManager#FEATURE_LEANBACK}</li> 960<li>{@link android.content.pm.PackageManager#FEATURE_OPENGLES_EXTENSION_PACK}</li> 961<li>{@link android.content.pm.PackageManager#FEATURE_SECURELY_REMOVES_USERS}</li> 962<li>{@link android.content.pm.PackageManager#FEATURE_SENSOR_AMBIENT_TEMPERATURE}</li> 963<li>{@link android.content.pm.PackageManager#FEATURE_SENSOR_HEART_RATE_ECG}</li> 964<li>{@link android.content.pm.PackageManager#FEATURE_SENSOR_RELATIVE_HUMIDITY}</li> 965<li>{@link android.content.pm.PackageManager#FEATURE_VERIFIED_BOOT}</li> 966<li>{@link android.content.pm.PackageManager#FEATURE_WEBVIEW}</li> 967</ul> 968 969<h3 id="Permissions">User permissions</h3> 970 971<p>The following permission is now supported in the 972<a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">{@code <uses-permission>}</a> 973element to declare the permissions your app requires to access certain APIs.</p> 974 975<ul> 976<li>{@link android.Manifest.permission#BIND_DREAM_SERVICE}: When targeting API 977 level 21 and higher, this permission is required by a 978 <a href="{@docRoot}about/versions/android-4.2.html#Daydream">Daydream</a> service, 979 to ensure that only the system can bind to it.</li> 980</ul>