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