Home | History | Annotate | Download | only in versions
      1 page.title=Jelly Bean
      2 tab1=Android 4.3
      3 tab1.link=#android-43
      4 tab2=Android 4.2
      5 tab2.link=#android-42
      6 tab3=Android 4.1
      7 tab3.link=#android-41
      8 
      9 @jd:body
     10 
     11 
     12 <style>
     13 #android-41 {display:none;}
     14 #android-42 {display:none;}
     15 </style>
     16 
     17 <script>
     18 function revealSection(hashy) {
     19   if (hashy != "" && !$(hashy).is(":visible")) {
     20     sectionId = $(hashy).closest(".version-section").attr("id");
     21     link = $("#title-tabs a[href$="+sectionId+"]");
     22     link.parent().addClass("selected");
     23     link.parent().siblings().removeClass("selected");
     24     
     25     sectionDiv = $(".version-section"+link.attr("href"));
     26     if (sectionDiv.length) {
     27       $(".version-section").hide();
     28       sectionDiv.show();
     29     }
     30     
     31     $('html, body').animate({
     32          scrollTop: $(hashy).offset().top
     33      }, 100);
     34   }
     35 }
     36 
     37 $(document).ready(function() {
     38   $("#title-tabs li a").each(function() {
     39     $(this).click(function(){
     40       $(this).parent().addClass("selected");
     41       $(this).parent().siblings().removeClass("selected");
     42       $(".version-section").hide();
     43       $($(this).attr("href")).show();
     44       return false;
     45     });
     46   });
     47 
     48   hashy = escapeHTML(location.hash);
     49   revealSection(hashy);
     50 });
     51 
     52 window.onhashchange = function () {
     53   revealSection(escapeHTML(location.hash));
     54 }
     55 
     56 </script>
     57 
     58 
     59 <!-- BEGIN ANDROID 4.3 -->
     60 <div id="android-43" class="version-section">
     61 
     62 <div style="float:right;padding:0px 0px 10px 28px;width:480px;">
     63 <div>
     64 <a href="{@docRoot}images/jb-android-43@2x.png"><img src="{@docRoot}images/jb-android-43.jpg" alt="Android 4.3 on phone and tablet" width="472"></a>
     65 
     66 </div>
     67 </div>
     68 <p>Welcome to Android 4.3, a sweeter version of <span
     69 style="white-space:nowrap;">Jelly Bean!</span></p>
     70 
     71 <p>Android 4.3 includes performance optimizations and great
     72 new features for users and developers. This document provides a glimpse of what's new for
     73 developers.
     74 
     75 <p>See the <a href="{@docRoot}about/versions/android-4.3.html">Android 4.3 APIs</a>
     76 document for a detailed look at the new developer APIs.</p>
     77 
     78 <p>Find out more about the new Jelly Bean features for users at <a
     79 href="http://www.android.com/whatsnew">www.android.com</a>.</p>
     80 
     81 
     82 <h2 id="43-performance" style="line-height:1.25em;">Faster, Smoother, More
     83 Responsive</h2>
     84 
     85 <p>Android 4.3 builds on the performance improvements already included in Jelly
     86 Bean &mdash; <strong>vsync timing</strong>, <strong>triple buffering</strong>,
     87 <strong>reduced touch latency</strong>, <strong>CPU input boost</strong>, and
     88 <strong>hardware-accelerated 2D rendering</strong> &mdash; and adds new
     89 optimizations that make Android even faster.</p>
     90 
     91 <p>For a graphics performance boost, the hardware-accelerated 2D renderer now
     92 <strong>optimizes the stream of drawing commands</strong>, transforming it into
     93 a more efficient GPU format by rearranging and merging draw operations. For
     94 multithreaded processing, the renderer can also now use <strong>multithreading
     95 across multiple CPU cores</strong> to perform certain tasks.</p>
     96 
     97 <p>Android 4.3 also improves <strong>rendering for shapes and text</strong>.
     98 Shapes such as circles and rounded rectangles are now rendered at higher quality
     99 in a more efficient manner. Optimizations for text include increased performance
    100 when using multiple fonts or complex glyph sets (CJK), higher rendering quality
    101 when scaling text, and faster rendering of drop shadows.</p>
    102 
    103 <p><strong>Improved window buffer allocation</strong> results in a faster image
    104 buffer allocation for your apps, reducing the time taken to start rendering when
    105 you create a window.</p>
    106 
    107 <p>For highest-performance graphics, Android 4.3 introduces support for
    108 <strong>OpenGL ES 3.0</strong> and makes it accessible to apps through both
    109 framework and native APIs. On supported devices, the hardware accelerated 2D
    110 rendering engine takes advantage of OpenGL ES 3.0 to optimize <strong>texture
    111 management</strong> and increase <strong>gradient rendering
    112 fidelity</strong>.</p>
    113 
    114 
    115 <h2 id="43-graphics">OpenGL ES 3.0 for High-Performance Graphics</h2>
    116 
    117 <p>Android 4.3 introduces platform support for <a class="external-link"
    118 href="http://www.khronos.org/opengles/3_X/" target="_android">Khronos OpenGL ES 3.0</a>,
    119 providing games and other apps with highest-performance 2D and 3D graphics
    120 capabilities on supported devices. You can take advantage of OpenGL ES 3.0
    121 and related EGL extensions using either <strong>framework APIs</strong>
    122 or <strong>native API bindings</strong> through the Android Native Development
    123 Kit (NDK).</p>
    124 
    125 <p>Key new functionality provided in OpenGL ES 3.0 includes acceleration of
    126 advanced visual effects, high quality ETC2/EAC texture compression as a standard
    127 feature, a new version of the GLSL ES shading language with integer and 32-bit
    128 floating point support, advanced texture rendering, and standardized texture
    129 size and render-buffer formats.
    130 
    131 <p>You can use the OpenGL ES 3.0 APIs to create highly complex, highly efficient
    132 graphics that run across a range of compatible Android devices, and you can
    133 support a single, standard texture-compression format across those devices.</p>
    134 
    135 <p>OpenGL ES 3.0 is an optional feature that depends on underlying graphics
    136 hardware. Support is already available on Nexus 7 (2013), Nexus 4, and
    137 Nexus 10 devices.</p>
    138 
    139 
    140 <h2 id="43-bluetooth" style="clear:both;">Enhanced Bluetooth Connectivity</h2>
    141 
    142 <h4 id="43-bt-le">Connectivity with Bluetooth Smart devices and sensors</h4>
    143 
    144 <p>Now you can design and build apps that interact with the latest generation
    145 of small, low-power devices and sensors that use <a
    146 href="http://www.bluetooth.com/Pages/Bluetooth-Smart-Devices.aspx"
    147 class="external-link" target="_android">Bluetooth Smart technology</a>. </p>
    148 
    149 <div style="float:right;margin:0px 0px 32px 0px;width:460px;">
    150 <img src="{@docRoot}images/jb-btle.png" alt="" width="450" style="padding-left:1.5em;margin-bottom:0">
    151 <p class="img-caption" style="padding-top:1.5em;line-height:1.25em;margin-bottom:0;padding-left:1.5em;">Android 4.3 gives you a single, standard API for interacting with Bluetooth Smart devices. </p>
    152 </div>
    153 
    154 <p>Android 4.3 introduces built-in platform support for <strong>Bluetooth Smart
    155 Ready</strong> in the central role and provides a standard set of APIs that
    156 apps can use to discover nearby devices, query for GATT services, and read/write
    157 characteristics.</p>
    158 
    159 <p>With the new APIs, your apps can efficiently scan for devices and services of
    160 interest. For each device, you can check for supported GATT services by UUID and
    161 manage connections by device ID and signal strength. You can connect to a GATT
    162 server hosted on the device and read or write characteristics, or register a
    163 listener to receive notifications whenever those characteristics change.</p>
    164 
    165 <p>You can implement support for any GATT profile. You can read or write
    166 standard characteristics or add support for custom characteristics as needed.
    167 Your app can function as either client or server and can transmit and receive
    168 data in either mode. The APIs are generic, so youll be able to support
    169 interactions with a variety of devices such as proximity tags, watches, fitness
    170 meters, game controllers, remote controls, health devices, and more.
    171 </p>
    172 
    173 <p>Support for Bluetooth Smart Ready is already available on Nexus 7 (2013)
    174 and Nexus 4 devices and will be supported in a growing number of
    175 Android-compatible devices in the months ahead.</p>
    176 
    177 <h4 id="43-bt-avrcp">AVRCP 1.3 Profile</h4>
    178 
    179 <p>Android 4.3 adds built-in support for <strong>Bluetooth AVRCP 1.3</strong>,
    180 so your apps can support richer interactions with remote streaming media
    181 devices. Apps such as media players can take advantage of AVRCP 1.3 through the
    182 <strong>remote control client APIs</strong> introduced in Android 4.0. In
    183 addition to exposing playback controls on the remote devices connected over
    184 Bluetooth, apps can now transmit metadata such as track name, composer, and
    185 other types of media metadata. </p>
    186 
    187 <p>Platform support for AVRCP 1.3 is built on the Bluedroid Bluetooth stack
    188 introduced by Google and Broadcom in Android 4.2. Support is available right
    189 away on Nexus devices and other Android-compatible devices that offer A2DP/AVRCP
    190 capability. </p>
    191 
    192 
    193 <h2 id="43-profiles">Support for Restricted Profiles</h2>
    194 
    195 <div style="float:right;margin:22px 0px 0px 24px;width:340px;">
    196 <img src="{@docRoot}images/jb-profiles-create-n713.png" alt="Setting up a Restricted Profile" width="340" style="margin-bottom:0">
    197 <p class="img-caption" style="padding-top:1.5em;line-height:1.25em;margin-bottom:0;">A tablet owner can set up one or more restricted profiles in Settings and manage them independently. </p>
    198 <img src="{@docRoot}images/jb-profiles-restrictions-n713.png" alt="Setting Restrictions in a Profile" width="340" style="margin-bottom:0;padding-top:1em;">
    199 <p class="img-caption" style="padding-top:1.5em;line-height:1.25em;">Your app can offer restrictions to let owners manage your app content when it's running in a profile. </p>
    200 </div>
    201 
    202 <p>Android 4.3 extends the multiuser feature for tablets with <strong>restricted
    203 profiles</strong>, a new way to manage users and their capabilities on a single
    204 device. With restricted profiles, tablet owners can quickly set up
    205 <strong>separate environments</strong> for each user, with the ability to
    206 manage <strong>finer-grained restrictions</strong> in the apps that are
    207 available in those environments. Restricted profiles are ideal for friends and
    208 family, guest users, kiosks, point-of-sale devices, and more. </p>
    209 
    210 <p>Each restricted profile offers an isolated and secure space with its own
    211 local storage, home screens, widgets, and settings. Unlike with
    212 users, profiles are created from the tablet owners environment, based on the
    213 owners installed apps and system accounts. The owner controls which installed
    214 apps are enabled in the new profile, and access to the owners accounts is
    215 disabled by default. </p>
    216 
    217 <p>Apps that need to access the owners accounts &mdash; for sign-in,
    218 preferences, or other uses &mdash; can opt-in by declaring a manifest attribute,
    219 and the owner can review and manage those apps from the profile configuration
    220 settings.</p>
    221 
    222 <p>For developers, restricted profiles offer a new way to deliver more value and
    223 control to your users. You can implement <strong>app restrictions</strong>
    224 &mdash; content or capabilities controls that are supported by your app &mdash;
    225 and advertise them to tablet owners in the profile configuration settings.
    226 </p>
    227 
    228 <p>You can add app restrictions directly to the profile configuration settings
    229 using predefined boolean, select, and multi-select types. If you want more
    230 flexibility, you can even launch your own UI from profile configuration settings
    231 to offer any type of restriction you want. </p>
    232 
    233 <p>When your app runs in a profile, it can check for any restrictions configured
    234 by the owner and enforce them appropriately. For example, a media app
    235 might offer a restriction to let the owner set a maturity level for the profile.
    236 At run time, the app could check for the maturity setting and then manage
    237 content according to the preferred maturity level. </p>
    238 
    239 <p>If your app is not designed for use in restricted profiles, you can opt
    240 out altogether, so that your app can't be enabled in any restricted profile.</p>
    241 
    242 
    243 <h2 id="43-optimized-location">Optimized Location and Sensor Capabilities</h2>
    244 
    245 <p><a href="{@docRoot}google/play-services/index.html">Google Play services</a>
    246 offers advanced location APIs that you can use in your apps. Android 4.3
    247 <strong>optimizes these APIs</strong> on supported devices with new hardware and
    248 software capabilities that minimize use of the battery. </p>
    249 
    250 
    251 <div style="float:left;margin:22px 24px 36px 22px;width:250px;">
    252 <a href=""><img src="{@docRoot}images/google/gps-location.png" alt="" height="160" style="padding-right:1.5em;margin-bottom:0"></a>
    253 </div>
    254 
    255 <p><strong>Hardware geofencing</strong> optimizes for power efficiency by
    256 performing location computation in the device hardware, rather than in
    257 software. On devices that support hardware geofencing, Google Play services
    258 geofence APIs will be able to take advantage of this optimization to save
    259 battery while the device is moving. </p>
    260 
    261 <p><strong>Wi-Fi scan-only mode</strong> is a new platform optimization that
    262 lets users keep Wi-Fi scan on without connecting to a Wi-Fi network, to improve
    263 location accuracy while conserving battery. Apps that depend on Wi-Fi for
    264 location services can now ask users to enable scan-only mode from Wi-Fi
    265 advanced settings. Wi-Fi scan-only mode is not dependent on device hardware and
    266 is available as part of the Android 4.3 platform.</p>
    267 
    268 <p>New sensor types allow apps to better manage sensor readings. A <strong>game
    269 rotation vector</strong> lets game developers sense the devices rotation
    270 without having to worry about magnetic interference.  <strong>Uncalibrated
    271 gyroscope</strong> and <strong>uncalibrated magnetometer</strong> sensors report
    272 raw measurements as well as estimated biases to apps. </p>
    273 
    274 <p>The new hardware capabilities are already available on Nexus 7 (2013) and
    275 Nexus 4 devices, and any device manufacturer or chipset vendor can build them
    276 into their devices.</p>
    277 
    278 
    279 <h2 id="43-media">New Media Capabilities</h2>
    280 
    281 <h4 id="43-modular-drm">Modular DRM framework</h4>
    282 
    283 <p>To meet the needs of the next generation of media services, Android 4.3
    284 introduces a <strong>modular DRM framework</strong> that enables media application
    285 developers to more easily integrate DRM into their own streaming protocols, such
    286 as MPEG DASH (Dynamic Adaptive Streaming over HTTP, ISO/IEC 23009-1).</p>
    287 
    288 <p>Through a combination of new APIs and enhancements to existing APIs, the
    289 media DRM framework provides an <strong>integrated set of services</strong> for
    290 managing licensing and provisioning, accessing low-level codecs, and decoding
    291 encrypted media data. A new MediaExtractor API lets you get the PSSH metadata
    292 for DASH media. Apps using the media DRM framework manage the network
    293 communication with a license server and handle the streaming of encrypted data
    294 from a content library. </p>
    295 
    296 <h4 id="43-vp8-encoder">VP8 encoder</h4>
    297 
    298 <p>Android 4.3 introduces built-in support for <strong>VP8 encoding</strong>,
    299 accessible from framework and native APIs. For apps using native APIs, the
    300 platform includes <strong>OpenMAX 1.1.2 extension headers</strong> to support
    301 VP8 profiles and levels. VP8 encoding support includes settings for target
    302 bitrate, rate control, frame rate, token partitioning, error resilience,
    303 reconstruction and loop filters. The platform API introduces VP8 encoder support
    304 in a range of formats, so you can take advantage of the best format for your
    305 content. </p>
    306 
    307 <p>VP8 encoding is available in software on all compatible devices running
    308 Android 4.3. For highest performance, the platform also supports
    309 hardware-accelerated VP8 encoding on capable devices.</p>
    310 
    311 <h4 id="43-surface">Video encoding from a surface</h4>
    312 
    313 <p>Starting in Android 4.3 you can use a surface as the input to a video
    314 encoder. For example, you can now direct a stream from an OpenGL ES surface
    315 to the encoder, rather than having to copy between buffers.</p>
    316 
    317 <h4 id="43-media-muxer">Media muxer</h4>
    318 
    319 <p>Apps can use new media muxer APIs to combine elementary audio and video
    320 streams into a single output file. Currently apps can multiplex a single MPEG-4
    321 audio stream and a single MPEG-4 video stream into a <strong>single MPEG-4 ouput
    322 file</strong>. The new APIs are a counterpart to the media demuxing APIs
    323 introduced in Android 4.2. </p>
    324 
    325 <h4 id="43-progress-scrubbing">Playback progress and scrubbing in remote control
    326 clients</h4>
    327 
    328 <p>Since Android 4.0, media players and similar applications have been able to
    329 offer playback controls from remote control clients such as the device lock
    330 screen, notifications, and remote devices connected over Bluetooth. Starting in
    331 Android 4.3, those applications can now also expose playback <strong>progress
    332 and speed</strong> through their remote control clients, and receive commands to
    333 jump to a specific <strong>playback position</strong>. </p>
    334 
    335 
    336 <h2 id="43-beautiful-apps">New Ways to Build Beautiful Apps</h2>
    337 
    338 
    339 <h3 id="43-notification-access">Access to notifications</h3>
    340 
    341 <p>Notifications have long been a popular Android feature because they let users
    342 see information and updates from across the system, all in one place. Now in
    343 Android 4.3, apps can <strong>observe the stream of notifications</strong> with the
    344 user's permission and display the notifications in any way they want, including
    345 sending them to nearby devices connected over Bluetooth. </p>
    346 
    347 <p>You can access notifications through new APIs that let you <strong>register a
    348 notification listener</strong> service and with permission of the user, receive
    349 notifications as they are displayed in the status bar. Notifications are
    350 delivered to you in full, with all details on the originating app, the post
    351 time, the content view and style, and priority. You can evaluate fields of
    352 interest in the notifications, process or add context from your app, and route
    353 them for display in any way you choose.</p>
    354 
    355 <p>The new API gives you callbacks when a notification is added, updated, and
    356 removed (either because the user dismissed it or the originating app withdrew it).
    357 You'll be able to launch any intents attached to the notification or its actions,
    358 as well as dismiss it from the system, allowing your app to provide a complete
    359 user interface to notifications.</p>
    360 
    361 <p><strong>Users remain in control</strong> of which apps can receive
    362 notifications. At any time, they can look in Settings to see which apps have
    363 notification access and <strong>enable or disable access</strong> as needed.
    364 Notification access is disabled by default &mdash; apps can use a new Intent to
    365 take the user directly to the Settings to enable the listener service after
    366 installation.</p>
    367 
    368 <h4 id="43-view-overlays">View overlays</h4>
    369 
    370 <p>You can now create <strong>transparent overlays</strong> on top of Views and
    371 ViewGroups to render a temporary View hierarchy or transient animation effects
    372 without disturbing the underlying layout hierarchy. Overlays are particularly
    373 useful when you want to create animations such as sliding a view outside of its
    374 container or dragging items on the screen without affecting the view
    375 hierarchy. </p>
    376 
    377 <h4 id="43-optical-bounds">Optical bounds layout mode</h4>
    378 
    379 <p>A new layout mode lets you manage the positioning of Views inside ViewGroups
    380 according to their <strong>optical bounds</strong>, rather than their clip
    381 bounds. Clip bounds represent a widgets actual outer boundary, while the new
    382 optical bounds describe the where the widget appears to be, within the clip
    383 bounds. You can use the optical bounds layout mode to properly align widgets
    384 that use outer visual effects such as shadows and glows.</p>
    385 
    386 <h4 id="43-rotation-animation">Custom rotation animation types</h4>
    387 
    388 <p>Apps can now define the exit and entry animation types used on a window when the
    389 device is rotated. You can set window properties to enable
    390 <strong>jump-cut</strong>, <strong>cross-fade</strong>, or
    391 <strong>standard</strong> window rotation. The system uses the custom animation
    392 types when the window is fullscreen and is not covered by other windows.</p>
    393 
    394 <h4 id="43-screen-orientations">Screen orientation modes</h4>
    395 
    396 <p>Apps can set new orientation modes for Activities to ensure that they are
    397 displayed in the proper orientation when the device is flipped. Additionally,
    398 apps can use a new mode to <strong>lock the screen</strong> to its current
    399 orientation. This is useful for apps using the camera that want to
    400 <strong>disable rotation</strong>  while shooting video. </p>
    401 
    402 <h4 id="43-quick-responses-intent">Intent for handling Quick Responses</h4>
    403 
    404 <p>Android 4.3 introduces a new public Intent that lets any app <strong>handle
    405 Quick Responses</strong> &mdash; text messages sent by the user in response to
    406 an incoming call, without needing to pick up the call or unlock the device. Your
    407 app can listen for the intent and send the message to the caller over your
    408 messaging system. The intent includes the recipient (caller) as well as the
    409 message itself. </p>
    410 
    411 
    412 <h2 id="43-intl">Support for International Users</h2>
    413 
    414 <div style="float:right;margin:22px 0px 0px 24px;width:380px;">
    415 <img src="{@docRoot}images/jb-rtl-arabic-n4.png" alt="" width="180" style="margin-bottom:0;">
    416 <img src="{@docRoot}images/jb-rtl-hebrew-n4.png" alt="" width="180" style="margin-bottom:0;padding-left:10px;">
    417 <p class="img-caption" style="padding-top:1.5em;line-height:1.25em;">More parts of Android 4.3 are optimized for RTL languages.</p>
    418 </div>
    419 
    420 <h4 id="43-rtl">RTL improvements</h4>
    421 
    422 <p>Android 4.3 includes RTL performance enhancements and broader RTL support
    423 across framework UI widgets, including ProgressBar/Spinner and
    424 ExpandableListView. More debugging information visible through the
    425 <code>uiautomatorviewer</code> tool. In addition, more system UI components are
    426 now RTL aware, such as notifications, navigation bar and the Action Bar.</p>
    427 
    428 <p>To provide a better systemwide experience in RTL scripts, more default system
    429 apps now support RTL layouts, including Launcher, Quick Settings, Phone, People,
    430 SetupWizard, Clock, Downloads, and more.</p>
    431 
    432 <h4 id="43-localization">Utilities for localization</h4>
    433 
    434 <div style="float:right;margin:16px 12px 0px 32px;width:260px;clear:both;">
    435 <img src="{@docRoot}images/jb-pseudo-locale-zz.png" alt="" width="260" style="margin-bottom:0;">
    436 <p class="img-caption" style="padding-top:1.5em;line-height:1.25em;">Pseudo-locales make it easier to test your app's localization.</p>
    437 </div>
    438 
    439 <p>Android 4.3 also includes new utilities and APIs for creating better RTL
    440 strings and testing your localized UIs. A new <strong>BidiFormatter</strong>
    441 class provides a simple API for wrapping Unicode strings, so that RTL-script
    442 data is displayed as intended in LTR-locale messages and vice-versa. To let you use this utility more
    443 broadly in your apps, the BidiFormatter API is also now available for earlier
    444 platform versions through the Support Package in the Android SDK. </p>
    445 
    446 <p>To assist you with managing date formatting across locales, Android 4.3
    447 includes a new <strong>getBestDateTimePattern()</strong> method that automatically
    448 generates the best possible localized form of a Unicode UTS date for a locale
    449 that you specify. Its a convenient way to provide a more localized experience
    450 for your users. </p>
    451 
    452 <p>To help you test your app more easily in other locales, Android 4.3
    453 introduces <strong>pseudo-locales</strong> as a new developer option.
    454 Pseudo-locales simulate the language, script, and display characteristics
    455 associated with a locale or language group. Currently, you can test with a
    456 pseudo-locale for <strong>Accented English</strong>, which lets you see how your
    457 UI works with script accents and characters used in a variety of European
    458 languages. <!--To use the pseudo-locale, enable Developer options in Settings
    459 and then select Accented English from Language and Input settings. --></p>
    460 
    461 
    462 <h2 id="43-accessibility">Accessibility and UI Automation</h2>
    463 
    464 <p>Starting in Android 4.3, accessibility services can <strong>observe and
    465 filter key events</strong>, such as to handle keyboard shortcuts or provide
    466 navigation parity with gesture-based input. The service receives the events and
    467 can process them as needed before they are passed to the system or other
    468 installed apps.</p>
    469 
    470 <p>Accessibility services can declare <strong>new capability attributes</strong>
    471 to describe what their services can do and what platform features they use. For
    472 example, they can declare the capability to filter key events, retrieve window
    473 content, enable explore-by-touch, or enable web accessibility features. In some
    474 cases, services must declare a capability attribute before they can access
    475 related platform features. The system uses the services capability attributes
    476 to generate an opt-in dialog for users, so they can see and agree to the
    477 capabilities before launch.</p>
    478 
    479 <p>Building on the accessibility framework in Android 4.3, a new <strong>UI
    480 automation framework</strong> lets tests interact with the devices UI by
    481 simulating user actions and introspecting the screen content. Through the UI
    482 automation framework you can perform basic operations, set rotation of the
    483 screen, generate input events, take screenshots, and much more. Its a powerful
    484 way to automate testing in realistic user scenarios, including actions or
    485 sequences that span multiple apps.</p>
    486 
    487 
    488 <h2 id="43-enterprise-security">Enterprise and Security</h2>
    489 
    490 <h4 id="43-wpa2">Wi-Fi configuration for WPA2-Enterprise networks</h4>
    491 
    492 <p>Apps can now configure the <strong>Wi-Fi credentials</strong> they need for
    493 connections to <strong>WPA2 enterprise access points</strong>. Developers can
    494 use new APIs to configure Extensible Authentication Protocol (EAP) and
    495 Encapsulated EAP (Phase 2) credentials for authentication methods used in the
    496 enterprise. Apps with permission to access and change Wi-Fi can configure
    497 authentication credentials for a variety of EAP and Phase 2 authentication
    498 methods. </p>
    499 
    500 <h4 id="43-selinux">Android sandbox reinforced with SELinux</h4>
    501 
    502 <p>Android now uses <strong>SELinux</strong>, a mandatory access control (MAC)
    503 system in the Linux kernel to augment the UID based application sandbox.
    504 This protects the operating system against potential security vulnerabilities.</p>
    505 
    506 <h4 id="43-keychain">KeyChain enhancements</h4>
    507 
    508 <p>The KeyChain API now provides a method that allows applications to confirm
    509 that system-wide keys are bound to a <strong>hardware root of trust</strong> for
    510 the device.  This provides a place to create or store private keys that
    511 <strong>cannot be exported</strong> off the device, even in the event of a root or
    512 kernel compromise.</p>
    513 
    514 <h4 id="43-keystore">Android Keystore Provider</h4>
    515 
    516 <p>Android 4.3 introduces a keystore provider and APIs that allow applications
    517 to create exclusive-use keys. Using the APIs, apps can create or store private
    518 keys that <strong>cannot be seen or used by other apps</strong>, and can be
    519 added to the keystore without any user interaction. </p>
    520 
    521 <p>The keystore provider provides the same security benefits that the KeyChain
    522 API provides for system-wide credentials, such as binding credentials to a
    523 device. Private keys in the keystore cannot be exported off the device.</p>
    524 
    525 <h4 id="43-seuid">Restrict Setuid from Android Apps</h4>
    526 
    527 <p>The <code>/system</code> partition is now mounted <code>nosuid</code> for
    528 zygote-spawned processes, preventing Android applications from executing
    529 <code>setuid</code> programs. This reduces root attack surface and likelihood of
    530 potential security vulnerabilities.</p>
    531 
    532 
    533 <h2 id="43-tools">New Ways to Analyze Performance</h2>
    534 
    535 <div style="float:right;margin:16px 6px 0px 32px;width:390px;">
    536 <img src="{@docRoot}images/jb-systrace.png" alt="" width="390" style="margin-bottom:0;">
    537 <p class="img-caption" style="padding-top:1.5em;line-height:1.25em;">Systrace uses a new command syntax and lets you collect more types of profiling data.</p>
    538 </div>
    539 
    540 <h4 id="43-systrace">Enhanced Systrace logging</h4>
    541 
    542 <p>Android 4.3 supports an enhanced version of the <strong>Systrace</strong>
    543 tool thats easier to use and that gives you access to more types of information
    544 to profile the performance of your app. You can now collect trace data from
    545 <strong>hardware modules</strong>, <strong>kernel functions</strong>,
    546 <strong>Dalvik VM</strong> including garbage collection, <strong>resources
    547 loading</strong>, and more. </p>
    548 
    549 <p>Android 4.3 also includes new Trace APIs that you can use in your apps to mark
    550 specific sections of code to trace using Systrace <strong>begin/end
    551 events</strong>. When the marked sections of code execute, the system writes the
    552 begin/end events to the trace log. There's minimal impact on the performance of
    553 your app, so timings reported give you an accurate view of what your app is
    554 doing.</p>
    555 
    556 <p>You can visualize app-specific events in a timeline in the Systrace output
    557 file and analyze the events in the context of other kernel and user space trace
    558 data. Together with existing Systrace tags, custom app sections can give you new
    559 ways to understand the performance and behavior of your apps.</p>
    560 
    561 <div style="float:right;margin:6px 0px 0px 32px;width:380px;">
    562 <img src="{@docRoot}images/jb-gpu-profile-clk-n4.png" alt="" width="180" style="margin-bottom:0;">
    563 <img src="{@docRoot}images/jb-gpu-profile-cal-n4.png" alt="" width="180" style="margin-bottom:0;padding-left:10px;">
    564 <p class="img-caption" style="padding-top:1.5em;line-height:1.25em;">On-screen GPU profiling in Android 4.3.</p>
    565 </div>
    566 
    567 <h4 id="43-gpu-profiling" >On-screen GPU profiling</h4>
    568 
    569 <p>Android 4.3 adds new developer options to help you analyze your apps
    570 performance and pinpoint rendering issues on any device or emulator.</p>
    571 
    572 <p>In the <strong>Profile GPU rendering</strong> option you can now visualize
    573 your apps effective framerate on-screen, while the app is running. You can
    574 choose to display profiling data as on-screen <strong>bar or line
    575 graphs</strong>, with colors indicating time spent creating drawing commands
    576 (blue), issuing the commands (orange), and waiting for the commands to complete
    577 (yellow). The system updates the on-screen graphs continuously, displaying a
    578 graph for each visible Activity, including the navigation bar and notification
    579 bar. </p>
    580 
    581 <p>A green line highlights the <strong>16ms threshold</strong> for rendering
    582 operations, so you can assess the your apps effective framerate relative
    583 to a 60 fps goal (because 1/60th of a second equals roughly 16ms).
    584 If you see operations that cross the green line, you
    585 can analyze them further using Systrace and other tools.</p>
    586 
    587 <p class="caution" style="clear:both">On devices running Android 4.2 and higher,
    588 developer options are hidden by default. You can reveal them at any time by
    589 tapping 7 times on <strong>Settings &gt; About phone &gt; Build number</strong>
    590 on any compatible Android device.</p>
    591 
    592 <h4 id="43-strictmode">StrictMode warning for file URIs</h4>
    593 
    594 <p>The latest addition to the StrictMode tool is a policy constraint that warns
    595 when your app exposes a <code>file://</code> URI to the system or another app.
    596 In some cases the receiving app may not have access to the <code>file://</code>
    597 URI path, so when sharing files between apps, a <code>content://</code> URI should
    598 be used (with the appropriate permission). This new policy helps you catch and fix
    599 such cases. If youre looking for a convenient way to store and expose files to other
    600 apps, try using the <code>FileProvider</code> content provider thats available
    601 in the <a href="{@docRoot}tools/support-library/index.html">Support Library</a>.</p>
    602 
    603 </div><!-- END ANDROID 4.3 -->
    604 
    605 
    606 
    607 
    608 
    609 
    610 
    611 
    612 
    613 
    614 
    615 
    616 
    617 
    618 
    619 
    620 
    621 
    622 
    623 
    624 
    625 
    626 
    627 
    628 <!-- BEGIN ANDROID 4.2 -->
    629 <div id="android-42" class="version-section">
    630 <div style="float:right;padding:0px 0px 12px 34px;">
    631 <div>
    632 <img src="{@docRoot}images/jb-device-2.png" alt="Android 4.2 on phone and tablet" height="348" width="400">
    633 </div>
    634 </div>
    635 <p>Welcome to Android 4.2, the latest version of <span
    636 style="white-space:nowrap;">Jelly Bean!</span></p>
    637 
    638 <p>Android 4.2 has performance optimizations, a refreshed system UI, and great
    639 new features for users and developers. This document provides a glimpse of what's new for
    640 developers.
    641 
    642 <p>See the <a href="{@docRoot}about/versions/android-4.2.html">Android 4.2 APIs</a>
    643 document for a detailed look at the new developer APIs.</p>
    644 
    645 <p>Find out more about the new Jelly Bean features for users at <a
    646 href="http://www.android.com/whatsnew">www.android.com</a>.</p>
    647 
    648 
    649 <h2 id="42-performance" style="line-height:1.25em;">Faster, Smoother, More Responsive</h2>
    650 
    651 <p>Android 4.2 builds on the performance improvements already included in Jelly Bean
    652 &mdash; <strong>vsync timing</strong>, <strong>triple buffering</strong>,
    653 <strong>reduced touch latency</strong>, and <strong>CPU input boost</strong>
    654 &mdash; and adds new optimizations that make Android even faster.</p>
    655 
    656 <p>Improvements in the <strong>hardware-accelerated 2D renderer</strong> make
    657 common animations such as scrolling and swiping smoother and faster. In
    658 particular, <strong>drawing is optimized</strong> for layers, clipping and
    659 certain shapes (rounded rects, circles and ovals).</p>
    660 
    661 <p>A variety of <strong>WebView rendering optimizations</strong> make scrolling
    662 of web pages smoother and free from jitter and lags.</p>
    663 
    664 <p>Androids <strong>Renderscript Compute</strong> is the first computation
    665 platform ported to run directly on a <strong>mobile device GPU</strong>. It automatically
    666 takes advantage of <strong>GPU computation</strong> resources whenever possible,
    667 dramatically improving performance for graphics and image processing. Any app using
    668 Renderscript on a supported device can benefit immediately from
    669 this GPU integration <strong>without recompiling</strong>.</p>
    670 
    671 
    672 <div style="float:left;margin:16px 24px 12px 0px;">
    673 <a href="" target="_android">
    674 <img src="{@docRoot}images/jb-nexus10-1.png" alt="10-inch tablet running Android 4.2" width="380" height="281" /></a>
    675 </div> 
    676 
    677 <h2 id="42-ui" style="margin-top:2em;">Refined, refreshed UI</h2>
    678 
    679 <p>Android 4.2 refines the Jelly Bean user experience and brings familiar
    680 Android UI patterns such as status bar, system bar, and notifications window to
    681 all tablets.</p>
    682 
    683 <p>All screen sizes now feature the <strong>status bar</strong> on top, with
    684 pull-down access to <strong>notifications</strong> and a new <strong>Quick
    685 Settings</strong> menu. The familiar </strong>system bar</strong> appears on the
    686 bottom, with buttons easily accessible from either hand. The <strong>Application
    687 Tray</strong> is also available on all screen sizes.</p>
    688 
    689 
    690 <h2 id="42-multiuser" style="margin-top:2em;clear:left;">One tablet, many users</h2>
    691 
    692 <p>Now several users can <strong>share a single Android tablet</strong>, with
    693 each user having convenient access to a <strong>dedicated user
    694 space</strong>. Users can switch to their spaces with a single touch from the
    695 lock screen.</p>
    696 
    697 <p>On a multiuser device, Android gives each user a separate environment,
    698 including user-specific emulated SD card storage. Users also have their own
    699 homescreens, widgets, accounts, settings, files, and apps, and the system keeps
    700 these separate. All users share core system services, but the system ensures that
    701 each user's applications and data remain isolated. In effect, each of the multiple
    702 users has his or her own Android device.</p>
    703 
    704 <p>Users can install and uninstall apps at any time in their own environments.
    705 To save storage space, Google Play downloads an APK only if it's not already
    706 installed by another user on the device. If the app is already installed, Google
    707 Play records the new user's installation in the usual way but doesn't download
    708 another copy of the app. Multiple users can run the same copy of an APK because
    709 the system creates a new instance for each user, including a user-specific data
    710 directory.</p>
    711 
    712 <p>For developers, <strong>multi-user support is transparent</strong> &mdash;
    713 your apps do not need to do anything special to run normally in a multi-user
    714 environment and there are no changes you need to make in your existing or
    715 published APKs. The system manages your app in each user space just as it does
    716 in a single-user environment. </p>
    717 
    718 
    719 <h2 id="42-engagement" style="clear:left; margin-top:1em;">New ways to engage users</h2>
    720 
    721 <div style="float:right;margin:22px 0px 0px 24px;width:280px;">
    722 <div>
    723 <img src="{@docRoot}images/jb-lock-calendar.png" alt="Calendar lock screen widget" width="280" height="543" style="padding-left:1em;margin-bottom:0">
    724 </div>
    725 <p class="img-caption" style="padding-top:1.5em;line-height:1.25em;">You can extend <strong>app widgets</strong> to run on the lock screen, for instant access to your content.</p>
    726 </div>
    727 
    728 <h3 id="42-lockscreen-widgets">Lock screen widgets</h3>
    729 
    730 <p>In Android 4.2, users can place <strong>app widgets</strong> directly on
    731 their <strong>lock screens</strong>, for instant access to favorite app content
    732 without having to unlock. Users can add as many as five lock screen widgets,
    733 choosing from widgets provided by installed apps. The lock screen displays each
    734 widget in its own panel, letting users swipe left and right to view different
    735 panels and their widgets.</p>
    736 
    737 <p>Like all app widgets, lock screen widgets can display <strong>any kind of content</strong> and
    738 they can accept direct user interaction. They can be entirely self-contained,
    739 such as a widget that offers controls to play music, or they can let users jump
    740 straight to an Activity in your app, after unlocking along the way as
    741 needed.</p>
    742 
    743 <p>For developers, lock screen widgets offer a great new way to engage users.
    744 They let you put your content in front of users in a location theyll see often,
    745 and they give you more opportunities to bring users directly into your app.</p>
    746 
    747 <p>You can take advantage of this new capability by building a new app widget or
    748 by extending an existing home screen widget. If your app already includes home
    749 screen widgets, you can extend them to the lock screen with minimal change. To
    750 give users an optimal experience, you can update the widget to use the full lock
    751 screen area when available and resize when needed on smaller screens. You can
    752 also add features to your widgets that might be especially useful or convenient
    753 on the lock screen.</p>
    754 
    755 <h3 id="42-daydreams">Daydream</h3>
    756 
    757 <p>Daydream is an <strong>interactive screensaver mode</strong> that starts when
    758 a users device is docked or charging. In this mode, the system launches a
    759 daydream &mdash; a remote content service provided by an installed app &mdash;
    760 as the device screensaver. A user can enable Daydream from the Settings app and
    761 then choose the daydream to display.</p>
    762 
    763 <p>Daydreams combine the best capabilities of live wallpapers and home screen
    764 widgets, but they are more powerful. They let you offer the any kind of content
    765 in a completely new context, with user interactions such as flipping through
    766 photos, playing audio or video, or jumping straight into your app with a single
    767 touch.</p>
    768 
    769 <p>Because daydreams can start automatically when a device is charging or
    770 docked, they also give your app a great way to support new types of user
    771 experiences, such as leanback or exhibition mode, demo or kiosk mode, and
    772 "attract mode" &mdash; all without requiring special hardware.</p>
    773 
    774 <div style="float:left;margin:20px 30px 0px 0px;width:460px;">
    775 <div>
    776 <img src="{@docRoot}images/jb-dream-1.png" alt="Daydream screensaver mode" height="300" style="padding-left:1em;">
    777 </div>
    778 <p class="image-caption" style="padding:.5em .5em .5em 1.5em;"><span
    779 style="font-weight:500;">Daydream</span> lets you create powerful interactive screensavers that display any kind of content.</p>
    780 </div>
    781 
    782 <p>Daydreams are similar to Activities and can do anything that Activity
    783 can do &mdash; from rendering a UI hierarchy (without using RemoteViews) to
    784 drawing directly using Canvas, OpenGL, SurfaceTexture, and more. They can play
    785 video and audio and they can even accept direct user interaction. However,
    786 daydreams are not Activities, so they dont affect the backstack or appear in
    787 Recents and they cannot be launched directly from your app.</p>
    788 
    789 <p>Implementing a daydream is straightforward and you can take advantage of UI
    790 components and resources that youve already created for other parts of your
    791 app. You can provide multiple daydreams in your app and you can offer distinct
    792 content and display settings for each.</p>
    793 
    794 <h2  id="42-external-display" style="clear:left;">External display support</h2>
    795 
    796 <p>Android 4.2 introduces platform support for <strong>external
    797 displays</strong> that goes far beyond mirroring &mdash; apps can now target
    798 unique content to any one or multiple displays that are attached to an Android
    799 device. Apps can build on this to deliver new kinds of interaction and
    800 entertainment experiences to users.</p>
    801 
    802 <h3 id="42-display-manager">Display manager</h3>
    803 
    804 <p>Apps interact with displays through a new display manager system service.
    805 Your app can enumerate the displays and check the capabilities of each,
    806 including size, density, display name, ID, support for secure video, and more.
    807 Your app can also receive callbacks when displays are added or removed or when
    808 their capabilities change, to better manage your content on external
    809 displays.</p>
    810 
    811 <h3 id="42-presentation">Presentation window</h3>
    812 
    813 <p>To make it easy to show content on an external display, the framework
    814 provides a new UI object called a <strong>Presentation</strong> &mdash; a type of dialog that
    815 represents a window for your apps content on a specific external display. Your
    816 app just gives the display to use, a theme for the window, and any unique
    817 content to show. The Presentation handles inflating resources and rendering your
    818 content according to the characteristics of the targeted display.</p>
    819 
    820 <div style="margin:0 auto;width:569px;padding-top:1em;">
    821 
    822 <img src="{@docRoot}images/external-display.png" alt="" width="555" height="351" style="padding-left:1em;margin-bottom:0">
    823 
    824 <p class="image-caption" style="padding:1.25em">You can take full control of two or more independent displays using <strong>Presentation</strong>.</p>
    825 </div>
    826 
    827 <p>A Presentation gives your app full control over the remote display window and
    828 its content and lets you manage it based on user input events such as key
    829 presses, gestures, motion events, and more. You can use all of the normal tools
    830 to create a UI and render content in the Presentation, from building an
    831 arbitrary view hierarchy to using SurfaceView or SurfaceTexture to draw directly
    832 into the window for streamed content or camera previews.</p>
    833 
    834 <h3 id="42-preferred display">Preferred display selection</h3>
    835 
    836 <p>When multiple external displays are available, you can create as many
    837 Presentations as you need, with each one showing unique content on a specific
    838 display. In many cases, you might only want to show your content on a single
    839 external display &mdash; but always on the thats best for Presentation content.
    840 For this, the system can help your app choose the best display to use.</p>
    841 
    842 <p>To find the best display to use, your app can query the display manager for
    843 the systems <strong>preferred Presentation display</strong> and receive callbacks when that
    844 display changes. Alternatively, you can use the media router service, extended
    845 in Android 4.2, to receive notifications when a system video route changes. Your
    846 app can display content by default in the main Activity until a preferred
    847 Presentation display is attached, at which time it can automatically switch to
    848 Presentation content on the preferred display. Your apps can also use media
    849 routers MediaRouteActionProvider and MediaRouteButton to offer standard
    850 display-selection UI.</p>
    851 
    852 <h3 id="42-protected-content">Protected content</h3>
    853 
    854 <p>For apps that handle protected or encrypted content, the display API now
    855 reports the <strong>secure video capabilities</strong> of attached displays. Your app query a
    856 display to find out if it offers a secure video output or provides protected
    857 graphics buffers and then choose the appropriate content stream or decoding to
    858 make the content viewable. For additional security on SurfaceView objects, your
    859 app can set a secure flag to indicate that the contents should never appear in
    860 screenshots or on a non-secure display output, even when mirrored.</p>
    861 
    862 <h3 id="42-wireless-display">Wireless display</h3>
    863 
    864 <p>Starting in Android 4.2, users on supported devices can connect to an external display over
    865 Wi-Fi, using Wi-Fi Display (a peer-to-peer wireless display solution that complies with the
    866 <a href="http://www.wi-fi.org/wi-fi-certified-miracast%E2%84%A2"
    867  class="external-link">Miracast&trade;</a> certification
    868 program). When a wireless display is connected, users can stream any type of content to the big
    869 screen, including photos, games, maps, and more.</p>
    870 
    871 
    872 <p>Apps can take advantage of <strong>wireless displays</strong> in the same way as they do other
    873 external displays and no extra work is needed. The system manages the network
    874 connection and streams your Presentation or other app content to the wireless
    875 display as needed.</p>
    876 
    877 
    878 <h2 id="42-native-rtl">Native RTL support</h2>
    879 
    880 <div style="float:right;margin:22px 0px 0px 24px;width:340px;">
    881 <div>
    882 <img src="{@docRoot}images/jb-rtl.png" alt="RTL layout mirroring" width="340" height="457" style="margin-bottom:0;">
    883 </div>
    884 <p class="image-caption" style="padding-top:1em">Developers can now <strong>mirror their layouts</strong> for RTL languages.</p>
    885 </div>
    886 
    887 <p>Android 4.2 introduces <strong>full native support for RTL</strong>
    888 (right-to-left) layouts, including layout mirroring. With native RTL support,
    889 you can deliver the same great app experience to all of your users, whether
    890 their language uses a script that reads right-to-left or one that reads
    891 left-to-right.</p>
    892 
    893 <p>When the user switches the system language to a right-to-left script, the
    894 system now provides automatic mirroring of app UI layouts and all view widgets,
    895 in addition to bidi mirroring of text elements for both reading and character
    896 input.</p>
    897 
    898 <p>Your app can take advantage of <strong>RTL layout mirroring</strong> in your app with minimal effort.
    899 If you want the app to be mirrored, you simply declare a new attribute in your
    900 app manifest and change all "left/right" layout properties to new "start/end"
    901 equivalents. The system then handles the mirroring and display of your UI as
    902 appropriate.</p>
    903 
    904 <p>For precise control over your app UI, Android 4.2 includes new APIs that let
    905 you manage layout direction, text direction, text alignment, gravity, and 
    906 locale direction in View components. You can even create custom versions of
    907 layout, drawables, and other resources for display when a right-to-left script
    908 is in use.</p>
    909 
    910 <p>To help you debug and optimize your custom right-to-left layouts, the
    911 HierarchyViewer tool now lets you see start/end properties, layout direction,
    912 text direction, and text alignment for all the Views in the hierarchy.</p>
    913 
    914 
    915 <h2 id="42-intl">Enhancements for international languages</h2>
    916 
    917 <p>Android 4.2 includes a variety of <strong>font and character
    918 optimizations</strong> for international users:</p>
    919 <ul>
    920 <li>For Korean users, a new font choice is available &mdash; Nanum ()
    921 Gothic, a unicode font designed especially for the Korean-language script.</li>
    922 <li>Improved support for Japanese vertical text displayed in WebViews.</li>
    923 <li>Improved font kerning and positioning for Indic, Thai, Arabic, and Hebrew
    924 default fonts.</li>
    925 </ul>
    926 
    927 <p>The default Android keyboard also includes an updated set of
    928 dictionaries:</p>
    929 <ul>
    930 <li>Improved dictionaries for French (with bigram support), English, and
    931 Russian</li>
    932 <li>New dictionaries for Danish, Greek, Finnish, Lithuanian, Latvian, Polish,
    933 Slovenian, Serbian, Swedish, Turkish</li>
    934 </ul>
    935 
    936 
    937 <h2 id="42-ui-tools">New ways to create beautiful UI</h2>
    938 
    939 <h3 id="42-nested-fragments">Nested Fragments</h3>
    940 
    941 <p>For more control over your UI components and to make them more modular,
    942 Android 4.2 lets you <strong>nest Fragments inside of Fragments</strong>. For
    943 any Fragment, a new Fragment manager lets you insert other Fragments as child
    944 nodes in the View hierarchy.</p>
    945 
    946 <p>You can use nested Fragments in a variety of ways, but they are especially
    947 useful for implementing dynamic and reusable UI components inside of a UI
    948 component that is itself dynamic and reusable. For example, if you use ViewPager
    949 to create fragments that swipe left and right, you can now insert fragments into
    950 each Fragment of the view pager.</p>
    951 
    952 <p>To let you take advantage of nested Fragments more broadly in your app, this
    953 capability is added to the latest version of the <strong>Android Support
    954 Library</strong>.</p>
    955 
    956 
    957 <h2 id="42-accessibility">Accessibility</h2>
    958 
    959 <p>The system now helps accessibility services <strong>distinguish between touch
    960 exploration and accessibility gestures</strong> while in touch-exploration mode.
    961 When a user touches the screen, the system notifies the service that a generic
    962 touch interaction has started. It then tracks the speed of the touch interaction
    963 and determines whether it is a touch exploration (slow) or accessibility gesture
    964 (fast) and notifies the service. When the touch interaction ends, the system
    965 notifies the service.</p>
    966 
    967 <p>The system provides a new global accessibility option that lets an
    968 accessibility service open the Quick Settings menu based on an action by the
    969 user. Also added in Android 4.2 is a new accessibility feedback type for
    970 <strong>Braille devices</strong>.</p>
    971 
    972 <p>To give accessibility services insight into the meaning of Views for
    973 accessibility purposes, the framework provides new APIs for associating a View
    974 as the label for another View. The label for each View is available to
    975 accessibility services through AccessibilityNodeInfo.</p>
    976 
    977 
    978 <h2 id="42-camera">Improved Camera with HDR</h2>
    979 
    980 <p>Android 4.2 introduces a <strong>new camera hardware interface and
    981 pipeline</strong> for improved performance. On supported devices, apps can use a
    982 new <strong>HDR camera scene mode</strong> to capture an image using high
    983 dynamic range imaging techniques. </p>
    984 
    985 <p>Additionally, the framework now provides an API to let apps check whether the
    986 camera shutter sound can be disabled. Apps can then let the user disable the
    987 sound or choose an alternative sound  in place of the standard shutter sound,
    988 which is recommended.</p>
    989 
    990 
    991 <h2 id="42-renderscript">Renderscript Computation</h2>
    992 
    993 <p>In Android 4.2, Renderscript Compute introduces new scripting features, new
    994 optimizations, and direct GPU integration for the highest performance in
    995 computation operations.</p>
    996 
    997 <h3 id="42-filterscript">Filterscript</h3>
    998 
    999 <p>Filterscript is a subset of Renderscript that is focused on <strong>optimized
   1000 image processing across a broad range of device chipsets</strong>. Developers
   1001 can write their image processing operations in Filterscript using the standard
   1002 Renderscript runtime API, but within stricter constraints that ensure wider
   1003 compatibility and improved optimization across CPUs, GPUs, and DSPs.</p>
   1004 
   1005 <p>Filterscript is ideal for hardware-accelerating simple image-processing and
   1006 computation operations such as those that might be written for OpenGL ES
   1007 fragment shaders. Because it places a relaxed set of constraints on hardware,
   1008 your operations are optimized and accelerated on more types of device chipsets. 
   1009 Any app targeting API level 17 or higher can make use of Filterscript.</p>
   1010 
   1011 <h3 id="42-rs-intrinsics">Script intrinsics</h3>
   1012 
   1013 <p>In Android 4.2, Renderscript adds support for a set of script intrinsics
   1014 &mdash; pre-implemented <strong>filtering primitives that are
   1015 accelerated</strong> to reduce the amount of code that you need to write and to
   1016 ensure that your app gets the maximum performance gain possible.</p>
   1017 
   1018 <p>Intrinsics are available for blends, blur, color matrix, 3x3  and 5x5 convolve,
   1019 per-channel lookup table, and converting an Android YUV buffer to RGB.</p>
   1020 
   1021 <h3 id="42-rs-groups">Script groups</h3>
   1022 
   1023 <p>You can now create <strong>groups of Renderscript scripts</strong> and
   1024 execute them all with a single call as though they were part of a single script.
   1025 This allows Renderscript to optimize execution of the scripts in ways that it
   1026 could not do if the scripts were executed individually.</p>
   1027 
   1028 <div style="float:right;padding-top:1em;width:400px;margin-left:2em;">
   1029 <img src="{@docRoot}images/jb-rs-chart-versions.png" alt="Renderscipt optimizations chart" width="360" height="252"
   1030 style="border:1px solid #ddd;border-radius: 6px;" />
   1031 <p style="image-caption">Renderscript image-processing 
   1032 benchmarks run on different Android platform versions (Android 4.0, 4.1, and 4.2)
   1033 in CPU only on a Galaxy Nexus device.</p>
   1034 <img src="{@docRoot}images/jb-rs-chart-gpu.png" style="border:1px solid #ddd;border-radius: 6px; alt="" width="360" height="252" />
   1035 <p style="image-caption">Renderscript image-processing benchmarks comparing operations run with GPU + CPU to those run in CPU only on the same Nexus 10 device.</p>
   1036 </div>
   1037 
   1038 <p>If you have a directed acyclic graph of Renderscript operations to run, you can
   1039 use a builder class to create a script group defining the operations. At
   1040 execution time, Renderscript optimizes the run order and the connections between
   1041 these operations for best performance.</p>
   1042 
   1043 
   1044 <h3 id="42-rs-optimization">Ongoing optimization improvements</h3>
   1045 
   1046 <p>When you use Renderscript for computation operations, you apps benefit from
   1047 <strong>ongoing performance and optimization improvements</strong> in the
   1048 Renderscript engine itself, without any impact on your app code or any need for
   1049 recompilation.</p>
   1050 
   1051 <p>As optimization improves, your operations execute faster and on more
   1052 chipsets, without any work on your part. The chart at right highlights
   1053 the performance gain delivered by ongoing Renderscript optimization improvements
   1054 across successive versions of the Android platform.</p>
   1055 
   1056 <h3 id="42-gpu-compute">GPU Compute</h3>
   1057 
   1058 <p>Renderscript Compute is the first computation platform ported to run directly on a mobile device GPU. It now
   1059 automatically takes advantage of <strong>GPU computation</strong> resources
   1060 whenver possible to improve performance. With GPU integration, even the most
   1061 complex computations for graphics or image processing can execute with
   1062 dramatically improved performance.</p>
   1063 
   1064 <p>Any app using Renderscript on a supported device can benefit immediately from
   1065 this GPU integration, without recompiling. The Nexus 10 tablet is the first
   1066 device to support this integration.</p>
   1067 
   1068 <h2  id="42-dev-options" style="clear:right;margin-top:1em;">New built-in developer options</h2>
   1069 
   1070 <p>The Android 4.2 system includes a variety of new developer options that make
   1071 it easier to create great looking apps that perform well. The new options expose
   1072 features for <strong>debugging and profiling</strong> your app from any device
   1073 or emulator.</p>
   1074 
   1075 <p class="caution" style="clear:right;">On devices running Android 4.2,
   1076 developer options are hidden by default, helping to create a better experience
   1077 for users. You can reveal the developer options at any time by tapping 7 times
   1078 on <strong>Settings</strong> > <strong>About phone</strong> > <strong>Build
   1079 number</strong> on any compatible Android device.</p>
   1080 
   1081 <div style="float:left;margin:20px 42px 0px 0px;width:290px;">
   1082 <div>
   1083 <img src="{@docRoot}images/jb-dev-options-device.png" width="280" height="548">
   1084 </div>
   1085 <p class="image-caption" style="padding:.5em">New <span
   1086 style="font-weight:500;">developer options</span> give you more ways to profile and debug on a device.</p>
   1087 </div>
   1088 
   1089 <p style="margin-top:2em;">New developer options in Android 4.2 include:</p>
   1090 
   1091 <ul>
   1092 <li><strong>Take bug report</strong> &mdash; immediately takes a screen shot and
   1093 dumps device state information to local file storage, then attaches them to a
   1094 new outgoing email message.</li>
   1095 <li><strong>Power menu bug reports</strong> &mdash; Adds a new option to the
   1096 device power menu and quick settings to take a bug report (see above).</li>
   1097 <li><strong>Verify apps over usb</strong> &mdash; Allows you to disable app
   1098 checks for sideloading apps over USB, while still checking apps from other
   1099 sources like the browser. This can speed up the development process while
   1100 keeping the security feature enabled.</li>
   1101 <li><strong>Show hardware layers updates</strong> &mdash; Flashes hardware
   1102 layers green when they update.</li>
   1103 <li><strong>Show GPU overdraw</strong> &mdash; Highlights GPU overdraw
   1104 areas.</li>
   1105 <li><strong>Force 4x MSAA</strong> &mdash; Enables 4x MSAA in Open GL ES 2.0
   1106 apps.</li>
   1107 <li><strong>Simulate secondary displays</strong> &mdash; Creates one or more
   1108 non-secure overlay windows on the current screen for use as a simulated remote
   1109 display. You can control the simulated displays size and density.</li>
   1110 <li><strong>Enable OpenGL traces</strong> &mdash; Lets you trace OpenGL
   1111 execution using Logcat, Systrace, or callstack on glGetError.</li>
   1112 </ul>
   1113 
   1114 <h2 id="42-platform-tech" style="padding-top:1em;clear:left;">New Platform Technologies</h2>
   1115 
   1116 <p>Android 4.2 includes a variety of new and <strong>enhanced platform technologies</strong> to
   1117 support innovative communications use-cases across a broad range of hardware
   1118 devices. In most cases, the new platform technologies and enhancements do not directly
   1119 affect your apps, so you can benefit from them without any modification.</p>
   1120 
   1121 <h3 id="42-security">Security enhancements</h3>
   1122 
   1123 <p>Every Android release includes dozens of security enhancements to protect
   1124 users.  Here are some of the enhancements in Android 4.2:</p>
   1125 
   1126 <ul>
   1127 <li><strong>Application verification</strong> &mdash; Users can choose to enable
   1128 Verify Apps" and have applications screened by an application verifier, prior
   1129 to installation.  App verification can alert the user if they try to install an
   1130 app that might be harmful; if an application is especially bad, it can block
   1131 installation.</li>
   1132 <li><strong>More control of premium SMS</strong> &mdash; Android will provide a
   1133 notification if an application attempts to send SMS to a short code that uses
   1134 premium services which might cause additional charges.  The user can choose
   1135 whether to allow the application to send the message or block it.</li>
   1136 <li><strong>Always-on VPN</strong> &mdash;  VPN can be configured so that
   1137 applications will not have access to the network until a VPN connection is
   1138 established.  This prevents applications from sending data across other
   1139 networks.</li>
   1140 <li><strong>Certificate Pinning</strong> &mdash; The libcore SSL implementation
   1141 now supports certificate pinning.  Pinned domains will receive a certificate
   1142 validation failure if the certificate does not chain to a set of expected
   1143 certificates.  This protects against possible compromise of Certificate
   1144 Authorities.</li>
   1145 <li><strong>Improved display of Android permissions</strong> &mdash; Permissions
   1146 have been organized into groups that are more easily understood by users. 
   1147 During review of the permissions, the user can click on the permission to see
   1148 more detailed information about the permission.</li>
   1149 <li><strong>installd hardening</strong> &mdash; The installd daemon does not run
   1150 as the root user, reducing potential attack surface for root privilege
   1151 escalation.</li>
   1152 <li><strong>init script hardening</strong> &mdash;  init scripts now apply
   1153 O_NOFOLLOW semantics to prevent symlink related attacks.</li>
   1154 <li><strong>FORTIFY_SOURCE</strong> &mdash;  Android now implements
   1155 FORTIFY_SOURCE. This is used by system libraries and applications to prevent
   1156 memory corruption.</li>
   1157 <li><strong>ContentProvider default configuration</strong> &mdash; Applications
   1158 which target API level 17 will have export set to false by default for each
   1159 ContentProvider, reducing default attack surface for applications.</li>
   1160 <li><strong>Cryptography</strong> &mdash; Modified the default implementations
   1161 of SecureRandom and Cipher.RSA to use OpenSSL.  Added  SSLSocket support for
   1162 TLSv1.1 and TLSv1.2 using OpenSSL 1.0.1</li>
   1163 <li><strong>Security Fixes</strong> &mdash; Upgraded open source libraries with
   1164 security fixes include WebKit, libpng, OpenSSL, and LibXML. Android 4.2 also
   1165 includes fixes for Android-specific vulnerabilities. Information about these
   1166 vulnerabilities has been provided to Open Handset Alliance members and fixes are
   1167 available in Android Open Source Project.  To improve security, some devices
   1168 with earlier versions of Android may also include these fixes.</li>
   1169 </ul>
   1170 
   1171 <h3 id="42-bt-stack">New Bluetooth stack</h3>
   1172 
   1173 Android 4.2 introduces a new Bluetooth stack optimized for use with Android
   1174 devices. The new Bluetooth stack developed in collaboration between Google and
   1175 Broadcom replaces the stack based on BlueZ and provides improved compatibility
   1176 and reliability.
   1177 
   1178 <h3 id="42-audio">Low-latency audio</h3>
   1179 
   1180 <p>Android 4.2 improves support for low-latency audio playback, starting from the
   1181 improvements made in Android 4.1 release for audio output latency using OpenSL
   1182 ES, Soundpool and tone generator APIs. These improvements depend on hardware
   1183 support &mdash; devices that offer these low-latency audio features can
   1184 advertise their support to apps through a hardware feature constant. New
   1185 AudioManager APIs are provided to query the native audio sample rate and buffer
   1186 size, for use on devices which claim this feature.</p>
   1187 
   1188 <h3 id="42-camera-interface">New camera hardware interface</h3>
   1189 
   1190 Android 4.2 introduces a new implementation of the camera stack. The camera
   1191 subsystem includes the implementations for components in the camera pipeline
   1192 such as burst mode capture with processing controls.
   1193 
   1194 <h3 id="42-nfc-interface">New NFC hardware interface and controller interface</h3>
   1195 
   1196 Android 4.2 introduces support for controllers based on the NCI standard from
   1197 the NFC-Forum. NCI provides a standard communication protocol between an NFC
   1198 Controller (NFCC) and a device Host, and the new NFC stack developed in
   1199 collaboration between Google and Broadcom supports it.  
   1200 
   1201 <h3 id="42-dalvik">Dalvik runtime optimizations</h3>
   1202 
   1203 <p>The Dalvik runtime includes enhancements for performance and security across
   1204 a wider range of architectures:</p>
   1205 <ul>
   1206 <li>x86 JIT support from Intel and MIPS JIT support from MIPS</li>
   1207 <li>Optimized garbage-collection parameters for devices with > 512MB</li>
   1208 <li>Default implementations of SecureRandom and Cipher.RSA now use OpenSSL</li>
   1209 <li>SSLSocket support for TLSv1.1 and TLSv1.2 via OpenSSL 1.0.1</li>
   1210 <li>New intrinsic support for StrictMath methods abs, min, max, and sqrt</li>
   1211 <li>BouncyCastle updated to 1.47</li>
   1212 <li>zlib updated to 1.27</li>
   1213 <li>dlmalloc updated to 2.8.6</li>
   1214 </ul>
   1215 
   1216 </div> <!-- END ANDROID 4.2 -->
   1217 
   1218 
   1219 
   1220 
   1221 
   1222 
   1223 
   1224 
   1225 
   1226 
   1227 
   1228 
   1229 
   1230 
   1231 
   1232 
   1233 
   1234 
   1235 
   1236 
   1237 
   1238 
   1239 
   1240 
   1241 <!-- BEGIN ANDROID 4.1 -->
   1242 <div id="android-41" class="version-section">
   1243 
   1244 <div style="float:right;width:320px;padding:0px 0px 0px 34px;clear:both">
   1245 <div>
   1246 <img src="{@docRoot}images/jb-android-4.1.png" height="426" width="320">
   1247 </div>
   1248 </div>
   1249 <p>Welcome to Android 4.1 the first version of Jelly Bean!</p>
   1250 
   1251 <p>Android 4.1 is the fastest and smoothest version of Android yet. Weve made 
   1252 improvements throughout the platform and added great new features
   1253 for users and developers. This document provides a glimpse of what's new for developers.
   1254 
   1255 <p>See the <a href="{@docRoot}about/versions/android-4.1.html">Android 4.1 APIs</a> document for a detailed look at the new developer APIs.</p>
   1256 
   1257 <p>Find out more about the Jelly Bean features for users at <a href="http://www.android.com/whatsnew">www.android.com</a>.</p>
   1258 
   1259 
   1260 <h2 id="performance">Faster, Smoother, More Responsive</h2>
   1261 
   1262 <p>Android 4.1 is optimized to deliver Android's best performance and lowest touch latency, in an effortless, intuitive UI.</p>
   1263 
   1264 <p>To ensure a consistent framerate, Android 4.1 extends <strong>vsync timing</strong> across all drawing and animation done by the Android framework. Everything runs in lockstep against a 16 millisecond vsync heartbeat &mdash; application rendering, touch events, screen composition, and display refresh &mdash; so frames dont get ahead or behind.</p>
   1265 
   1266 <p>Android 4.1 also adds <strong>triple buffering</strong> in the graphics pipeline, for more consistent rendering that makes everything feel smoother, from scrolling to paging and animations.</p>
   1267 
   1268 <p>Android 4.1 reduces touch latency not only by <strong>synchronizing touch</strong> to vsync timing, but also by actually <strong>anticipating</strong> where your finger will be at the time of the screen refresh. This results in a more reactive and uniform touch response. In addition, after periods of inactivity, Android applies a <strong>CPU input boost</strong> at the next touch event, to make sure theres no latency.</p>
   1269 
   1270 <p><strong>Tooling</strong> can help you get the absolute best performance out of your apps. Android 4.1 is designed to work with a new tool called <strong>systrace</strong>, which collects data directly from the Linux kernel to produce an overall picture of system activities. The data is represented as a group of vertically stacked time series graphs, to help isolate rendering interruptions and other issues. The tool is available now in the <a href="{@docRoot}tools/index.html">Android SDK</a> (Tools R20 or higher)</p>
   1271 
   1272 
   1273 <div style="float:left;margin:12px 24px 0px 0px;">
   1274 <img src="{@docRoot}images/jb-accessibility-focus-250.png" width="240px" height="469">
   1275 </div>
   1276 
   1277 <div style="width:85%;padding-top:16px;">
   1278 <h2 id="accessibility">Enhanced Accessibility</h2>
   1279 
   1280 <p>New APIs for accessibility services let you handle gestures and manage <strong>accessibility focus</strong> as the user moves through the on-screen elements and navigation buttons using accessibility gestures, accessories, and other input. The Talkback system and explore-by-touch are redesigned to use accessibility focus for easier use and offer a complete set of APIs for developers.</p>
   1281 
   1282 <p>Accessibility services can link their own <strong>tutorials</strong> into the Accessibility settings, to help users configure and use their services.</p>
   1283 
   1284 <p>Apps that use standard View components <strong>inherit support</strong> for the new accessibility features automatically, without any changes in their code. Apps that use custom Views can use new accessibility node APIs to indicate the parts of the View that are of interest to accessibility services. </p>
   1285 
   1286 </div>
   1287 
   1288 <div style="clear:both;padding-top:1px;">
   1289 
   1290 <h2 id="intl">Support for International Users</h2>
   1291 
   1292 <div style="clear:both;padding-top:16px;float:right;">
   1293 
   1294 <div style="float:right;margin-left:18px;fpadding-top:90px;padding-bottom:60px">
   1295 <img src="{@docRoot}images/jb-r2l.png" width="280" height="356">
   1296 </div>
   1297 </div>
   1298 
   1299 <h3>Bi-Directional Text and Other Language Support</h3>
   1300 
   1301 <p>Android 4.1 helps you to reach more users through support for <strong>bi-directional text</strong> in TextView and EditText elements. Apps can display text or handle text editing in left-to-right or right-to-left scripts. Apps can make use of new Arabic and Hebrew locales and associated fonts.</p>
   1302 
   1303 <p>Other types of new language support include:</p>
   1304 <ul>
   1305 <li>Additional Indic languages: Kannada, Telugu, and Malayalam</li>
   1306 <li>The new Emoji characters from Unicode version 6.0</li>
   1307 <li>Better glyph support for Japanese users (renders Japanese-specific versions of glyphs when system language is set to Japanese)</li>
   1308 <li>Arabic glyphs optimized for WebViews in addition to the Arabic glyphs for TextViews</li>
   1309 <li>Vertical Text support in WebViews, including Ruby Text and additional Vertical Text glyphs</li>
   1310 <li>Synthetic Bold is now available for all fonts that don't have dedicated bold glyphs</li>
   1311 </ul>
   1312 
   1313 <h3>User-installable keymaps</h3>
   1314 
   1315 <p>The platform now supports <strong>user-installable keyboard maps</strong>, such as for additional international keyboards and special layout types. By default, Android 4.1 includes 27 international keymaps for keyboards, including Dvorak. When users connect a keyboard, they can go to the Settings app and select one or more keymaps that they want to use for that keyboard. When typing, users can switch between keymaps using a shortcut (ctrl-space).</p>
   1316 
   1317 <p>You can create an app to <strong>publish additional keymaps</strong> to the system. The APK would include the keyboard layout resources in it, based on standard Android keymap format. The application can offer additional keyboard layouts to the user by declaring a suitable broadcast receiver for ACTION_QUERY_KEYBOARD_LAYOUTS in its manifest. </p>
   1318 </div>
   1319 
   1320 
   1321 <h2 id="ui">New Ways to Create Beautiful UI</h2>
   1322 
   1323 
   1324 <div style="float:right;margin:22px 0px 0px 24px;width:280px;">
   1325 <div>
   1326 <!-- <img src="{@docRoot}images/jd-notif-cd.png" style="width:200px"> -->
   1327 <img src="{@docRoot}images/jb-notif-ex1.png" width="280" height="548">
   1328 </div>
   1329 <p class="image-caption" style="padding:.5em">Developers can create custom notification styles
   1330 like those shown in the examples above to display rich content and actions.</p>
   1331 </div>
   1332 
   1333 <h3>Expandable notifications</h3>
   1334 
   1335 <p>Notifications have long been a unique and popular feature on Android. Developers can use them to place important or time-based information in front of users in the notification bar, outside of the apps normal UI.</p>
   1336 
   1337 <p>Android 4.1 brings a major update to the Android notifications framework. Apps can now display <strong>larger, richer notifications</strong> to users that can be expanded and collapsed with a pinch or swipe. Notifications support <strong>new types of content</strong>, including photos, have configurable priority, and can even include multiple actions.</p>
   1338 
   1339 <p>Through an improved <strong>notification builder</strong>, apps can create notifications that use a larger area, up to 256 dp in height. Three <strong>templated notification styles</strong> are available:</p>
   1340 
   1341 <ul>
   1342 <li>BigTextStyle &mdash; a notification that includes a multiline TextView object.</li>
   1343 <li>BigInboxStyle &mdash; a notification that shows any kind of list such as messages, headlines, and so on.</li>
   1344 <li>BigPictureStyle &mdash; a notification that showcases visual content such as a bitmap.</li>
   1345 </ul>
   1346 
   1347 <p>In addition to the templated styles, you can create your own notification styles <strong>using any remote View</strong>.</p>
   1348 
   1349 <p>Apps can add up to three <strong>actions</strong> to a notification, which are displayed below the notification content. The actions let the users respond directly to the information in the notification in alternative ways. such as by email or by phone call, without visiting the app.</p>
   1350 
   1351 <p>With expandable notifications, apps can give more information to the user, effortlessly and on demand. Users remain in control and can long-press any notification to get information about the sender and optionally  disable further notifications from the app.</p>
   1352 
   1353 <div style="float:left;margin:66px 30px 0px 0px;width:280px;">
   1354 <div>
   1355 <img src="{@docRoot}images/jb-appwidgets.png" width="280" height="548">
   1356 </div>
   1357 <p class="image-caption" style="padding:.5em"><span
   1358 style="font-weight:500;">App Widgets</span> can resize automatically to fit the home screen and load different content as their sizes change.</p>
   1359 </div>
   1360 
   1361 <div style="padding-top:1px;clear:right;">
   1362 
   1363 
   1364 <h3>Resizable app widgets</h3>
   1365 
   1366 <p>Android 4.1 introduces improved App Widgets that can <strong>automatically resize</strong>, based on where the user drops them on the home screen, the size to which the user expands them, and the amount of room available on the home screen. New App Widget APIs let you take advantage of this to <strong>optimize your app widget content</strong> as the size of widgets changes.</p>
   1367 
   1368 <p>When a widget changes size, the system notifies the host apps widget provider, which can reload the content in the widget as needed. For example, a widget could display larger, richer graphics or additional functionality or options. Developers can still maintain control over maximum and minimum sizes and can update other widget options whenever needed. </p>
   1369 
   1370 <p>You can also supply separate landscape and portrait layouts for your widgets, which the system inflates as appropriate when the screen orientation changes.</p>
   1371 
   1372 <p>App widgets can now be displayed in third party launchers and other host apps through a new bind Intent (AppWidgetManager.ACTION_APPWIDGET_BIND).</p>
   1373 
   1374 </div>
   1375 
   1376 <h3>Simplified task navigation</h3>
   1377 
   1378 <p>Android 4.1 makes it easy for you to manage the Up navigation thats available to users from inside of your apps and helps ensure a consistent experience for users.</p>
   1379 
   1380 <p>You can <strong>define the intended Up navigation</strong> for individual Activity components of your UI by adding a new <strong>XML attribute</strong> in the apps manifest file. At run time, as Activities are launched, the system extracts the Up navigation tree from the manifest file and automatically creates the Up affordance navigation in the action bar. Developers who declare Up navigation in the manifest no longer need to manage navigation by callback at run time, although they can also do so if needed.</p>
   1381 
   1382 <p>Also available is a new <strong>TaskStackBuilder</strong> class that lets you quickly put together a synthetic task stack to start immediately or to use when an Activity is launched from a PendingIntent. Creating a synthetic task stack is especially useful when users launch Activities from remote views, such as from Home screen widgets and notifications, because it lets the developer provide a managed, consistent experience on Back navigation.</p>
   1383 
   1384 <h3>Easy animations for Activity launch</h3>
   1385 
   1386 <p>You can use a new helper class, <strong>ActivityOptions</strong>, to create and control the animation displayed when you launch your Activities. Through the helper class, you can specify custom animation resources to be used when the activity is launched, or request new zoom animations that start from any rectangle you specify on screen and that optionally include a thumbnail bitmap.</p>
   1387 
   1388 <h3>Transitions to Lights Out and Full Screen Modes</h3>
   1389 
   1390 <p>New system UI flags in View let you to cleanly transition from a normal application UI (with action bar, navigation bar, and system bar visible), to "lights out mode" (with status bar and action bar hidden and navigation bar dimmed) or "full screen mode" (with status bar, action bar, and navigation bar all hidden). </p>
   1391 
   1392 <h3>New types of remoteable Views</h3>
   1393 
   1394 <p>Developers can now use <strong>GridLayout</strong> and <strong>ViewStub</strong> views in Home screen widgets and notifications. GridLayout lets you structure the content of your remote views and manage child views alignments with a shallower UI hierarchy. ViewStub is an invisible, zero-sized View that can be used to lazily inflate layout resources at runtime.</p>
   1395 
   1396 <h3>Live wallpaper preview</h3>
   1397 
   1398 <p>Android 4.1 makes it easier for users to <strong>find and install Live Wallpapers</strong> from apps that include them. If your app includes Live Wallpapers, you can now start an Activity (ACTION_CHANGE_LIVE_WALLPAPER) that shows the user a preview of the Live Wallpaper from your own app. From the preview, users can directly load the Live Wallpaper.</p>
   1399 
   1400 <h3>Higher-resolution contact photos</h3>
   1401 
   1402 <p>With Android 4.1, you can store <strong>contact photos</strong> that are as large as <strong>720 x 720</strong>, making contacts even richer and more personal. Apps can store and retrieve contact photos at that size or use any other size needed. The maximum photo size supported on specific devices may vary, so apps should <strong>query the built-in contacts provider</strong> at run time to obtain the max size for the current device. </p>
   1403 
   1404 
   1405 <h2 id="input">New Input Types and Capabilities</h2>
   1406 
   1407 <h3>Find out about devices being added and removed</h3>
   1408 
   1409 <p>Apps can <strong>register to be notified</strong> when any new input devices are attached, by USB, Bluetooth, or any other connection type. They can use this information to change state or capabilities as needed. For example, a game could receive notification that a new keyboard or joystick is attached, indicating the presence of a new player.</p>
   1410 
   1411 <h3>Query the capabilities of input devices</h3>
   1412 
   1413 <p>Android 4.1 includes APIs that let apps and games take full advantage of all input devices that are connected and available.</p>
   1414 
   1415 <p>Apps can query the device manager to enumerate all of the input devices currently attached and learn about the capabilities of each.</p>
   1416 
   1417 <h3>Control vibrator on input devices</h3>
   1418 
   1419 <p>Among other capabilities, apps can now make use of any <strong>vibrator service</strong> associated with an attached input device, such as for <strong>Rumble Pak</strong> controllers.</p>
   1420 
   1421 
   1422 <h2 id="graphics">Animation and Graphics</h2>
   1423 
   1424 <h3>Vsync for apps</h3>
   1425 
   1426 <p>Extending vsync across the Android framework leads to a more consistent framerate and a smooth, steady UI. So that apps also benefit, Android 4.1 <strong>extends vsync timing</strong> to all drawing and animations initiated by apps. This lets them optimize operations on the UI thread and provides a stable timebase for synchronization.</p>
   1427 
   1428 <p>Apps can take advantage of vsync timing for free, through Androids <strong>animation framework</strong>. The animation framework now uses vsync timing to automatically handle synchronization across animators.</p>
   1429 
   1430 <p>For specialized uses, apps can access vsync timing through APIs exposed by a new Choreographer class. Apps can request invalidation on the next vsync frame &mdash; a good way to schedule animation when the app is not using the animation framework. For more advanced uses, apps can post a callback that the Choreographer class will run on the next frame. </p>
   1431 
   1432 <h3>New animation actions and transition types</h3>
   1433 
   1434 <p>The animation framework now lets you define start and end actions to take when running ViewPropertyAnimator animations, to help synchronize them with other animations or actions in the application. The action can run any runnable object. For example, the runnable might specify another animation to start when the previous one finishes.</p>
   1435 
   1436 <p>You can also now specify that a ViewPropertyAnimator use a layer during the course of its animation. Previously, it was a best practice to animate complicated views by setting up a layer prior to starting an animation and then handling an onAnimationEnd() event to remove the layer when the animation finishes. Now, the withLayer() method on ViewPropertyAnimator simplifies this process with a single method call.</p>
   1437 
   1438 <p>A new transition type in LayoutTransition enables you to automate animations in response to all layout changes in a ViewGroup.</p>
   1439 
   1440 
   1441 <h2 id="connectivity">New Types of Connectivity</h2>
   1442 
   1443 <h3>Android Beam</h3>
   1444 
   1445 <p>Android Beam is a popular NFC-based technology that lets users instantly share, just by touching two NFC-enabled phones together.</p>
   1446 
   1447 <p>In Android 4.1, Android Beam makes it easier to share images, videos, or other payloads by <strong>leveraging Bluetooth for the data transfer</strong>. When the user triggers a transfer, Android Beam hands over from NFC to Bluetooth, making it really easy to manage the transfer of a file from one device to another.</p>
   1448 
   1449 <h3>Wi-Fi Network Service Discovery</h3>
   1450 
   1451 <p>Android 4.1 introduces support for multicast <strong>DNS-based service discovery</strong>, which lets applications find and connect to services offered by peer devices over Wi-Fi networks &mdash; including mobile devices, printers, cameras, media players, and others. Developers can take advantage of Wi-Fi network service discovery to build cross-platform or multiplayer games and application experiences.</p>
   1452 
   1453 <p>Using the service discovery API, apps can create and register any kind of service, for any other NSD-enabled device to discover. The service is advertised by multicast across the network using a human-readable string identifier, which lets user more easily identify the type of service.  </p>
   1454 
   1455 <p>Consumer devices can use the API to scan and discover services available from devices connected to the local Wi-Fi network. After discovery, apps can use the API to resolve the service to an IP address and port through which it can establish a socket connection.</p>
   1456 
   1457 <p>You can take advantage of this API to build new features into your apps. For example, you could let users connect to a webcam, a printer, or an app on another mobile device that supports Wi-Fi peer-to-peer connections.  </p>
   1458 
   1459 <h3>Wi-Fi P2P Service Discovery</h3>
   1460 
   1461 <p><a href="{@docRoot}about/versions/android-4.0-highlights.html">Ice Cream Sandwich</a> introduced
   1462 support for Wi-Fi Peer-to-Peer (P2P), a technology that lets apps <strong>discover and pair
   1463 directly</strong>, over a high-bandwidth peer-to-peer connection (in compliance with the Wi-Fi
   1464 Alliance's <a href="http://www.wi-fi.org/discover-and-learn/wi-fi-direct"
   1465  class="external-link">Wi-Fi Direct&trade;</a>
   1466 certification program). Wi-Fi P2P is an ideal way to share media, photos, files and other types of
   1467 data and sessions, even where there is no cell network or Wi-Fi available.</p>
   1468 
   1469 
   1470 <p>Android 4.1 takes Wi-Fi P2P further, adding API support for <strong>pre-associated service discovery</strong>. Pre-associated service discovery lets your apps get more useful information from nearby devices about the services they support, before they attempt to connect.  Apps can initiate discovery for a specific service and filter the list of discovered devices to those that actually support the target service or application.</p>
   1471 
   1472 <p>For example, this means that your app could discover only devices that are printers or that have a specific game available, instead of discovering all nearby Wi-Fi P2P devices. On the other hand, your app can advertise the service it provides to other devices, which can discover it and then negotiate a connection. This greatly simplifies discovery and pairing for users and lets apps take advantage of Wi-Fi P2P more effectively.</p>
   1473 
   1474 <p>With Wi-Fi P2P service discovery, you can create apps and <strong>multiplayer games</strong> that can share photos, videos, gameplay, scores, or almost anything else &mdash; all without requiring any Internet or mobile network. Your users can connect using only a direct p2p connection, which avoids using mobile bandwidth.</p>
   1475 
   1476 <h3>Network Bandwidth Management</h3>
   1477 
   1478 <p>Android 4.1 helps apps <strong>manage data usage</strong> appropriately when the device is <strong>connected to a metered network</strong>, including tethering to a mobile hotspot. Apps can query whether the current network is metered before beginning a large download that might otherwise be relatively expensive to the user. Through the API, you can now get a clear picture of which networks are sensitive to data usage and manage your network activity accordingly.</p>
   1479 
   1480 
   1481 <h2 id="media">New Media Capabilities</h2>
   1482 
   1483 <h3>Media codec access</h3>
   1484 
   1485 <p>Android 4.1 provides low-level access to platform hardware and software codecs. Apps can query the system to discover what <strong>low-level media codecs</strong> are available on the device and then and use them in the ways they need. For example, you can now create multiple instances of a media codec, queue input buffers, and receive output buffers in return. In addition, the media codec framework supports protected content. Apps can query for an available codec that is able to play protected content with a DRM solution available on the device.</p>
   1486 
   1487 <h3>USB Audio</h3>
   1488 
   1489 <p>USB audio output support allows hardware vendors to build hardware such as <strong>audio docks</strong> that interface with Android devices. This functionality is also exposed with the Android <strong>Open Accessory Development Kit</strong> (ADK) to give all developers the chance to create their own hardware.</p>
   1490 
   1491 <h3>Audio record triggering</h3>
   1492 
   1493 <p>Android now lets you <strong>trigger audio recording</strong> based on the completion of an audio playback track. This is useful for  situations such as playing back a tone to cue your users to begin speaking to record their voices. This feature helps you sync up recording so you dont record audio that is currently being played back and prevents recordings from beginning too late.</p>
   1494 
   1495 <h3>Multichannel audio</h3>
   1496 
   1497 <p>Android 4.1 supports <strong>multichannel audio</strong> on devices that have hardware multichannel audio out through the <strong>HDMI port</strong>. Multichannel audio lets you deliver rich media experiences to users for applications such as games, music apps, and video players. For devices that do not have the supported hardware, Android automatically downmixes the audio to the number of channels that are supported by the device (usually stereo).</p>
   1498 
   1499 <p>Android 4.1 also adds built-in support for encoding/decoding AAC 5.1 audio.</p>
   1500 
   1501 <h3>Audio preprocessing</h3>
   1502 
   1503 <p>Developers can apply <strong>preprocessing effects</strong> to audio being recorded, such as to apply noise suppression for improving speech recording quality, echo cancellation for acoustic echo, and auto gain control for audio with inconsistent volume levels. Apps that require high quality and clean audio recording will benefit from these preprocessors.</p>
   1504 
   1505 <h3>Audio chaining</h3>
   1506 
   1507 <p>MediaPlayer supports <strong>chaining audio streams together</strong> to play audio files without pauses. This is useful for apps that require seamless transitions between audio files such as music players to play albums with continuous tracks or games.</p>
   1508 
   1509 <h3 id="media-router">Media Router</h3>
   1510 
   1511 <p>The new APIs MediaRouter, MediaRouteActionProvider, and MediaRouteButton provide standard mechanisms and UI for <strong>choosing where to play media</strong>. Support is built-in for wired headsets and a2dp bluetooth headsets and speakers, and you can add your own routing options within your own app.</p>
   1512 
   1513 <h2 id="renderscript">Renderscript Computation</h2>
   1514 
   1515 <p>Android 4.1 extends Renderscript computation to give you more flexibility. You can now <strong>sample textures</strong> in your Renderscript compute scripts, and <strong>new pragmas</strong> are available to define the floating point precision required by your scripts. This lets you enable <strong>NEON instructions</strong> such as fast vector math operations on the CPU path, that wouldnt otherwise be possible with the full IEEE 754-2008 standard.</p>
   1516 
   1517 <p>You can now <strong>debug</strong> your Renderscript compute scripts on <strong>x86-based emulator and hardware devices</strong>. You can also define multiple root-style kernels in a single Renderscript source file.</p>
   1518 
   1519 
   1520 <h2 id="browser">Android Browser and WebView</h2>
   1521 
   1522 <p>In Android 4.1, the Android Browser and WebViews include these enhancements:</p>
   1523 <ul>
   1524 <li>Better HTML5 video user experience, including touch-to-play/pause and smooth transition from inline to full screen mode. </li>
   1525 <li>Improved rendering speed and reduced memory usage for better scrolling and zooming performance.</li>
   1526 <li>Improved HTML5/CSS3/Canvas animation performance.</li>
   1527 <li>Improved text input.</li>
   1528 <li>Updated JavaScript Engine (V8) for better JavaScript performance.</li>
   1529 <li>Support for the updated HTML5 Media Capture specification (the "capture" attribute on input type=file elements).</li>
   1530 </ul>
   1531 
   1532 
   1533 <h2 id="google">Google APIs and services</h2>
   1534 
   1535 <p>To extend the capabilities of Android even further, several new services for Android are available.</p>
   1536 
   1537 <h3 id="gcm">Google Cloud Messaging for Android</h3>
   1538 
   1539 <p>Google Cloud Messaging (GCM) is a service that lets developers send <strong>short message data</strong> to their users on Android devices, without needing a proprietary sync solution. </p>
   1540 
   1541 <p>GCM handles all the details of <strong>queuing messages and delivering them</strong> efficiently to the targeted Android devices. It supports message <strong>multicasting</strong> and can reach up to 1000 connected devices simultaneously with a single request. It also supports message <strong>payloads</strong>, which means that in addition to sending tickle messages to an app on the device, developers can send up to 4K of data. </p>
   1542 
   1543 <p>Google Cloud Messaging is completely <strong>free for all developers</strong> and sign-up is easy. See the <a href="{@docRoot}google/gcm/index.html">Google Cloud Messaging</a> page for registration, downloads, and documentation.</p>
   1544 
   1545 <h3>App Encryption</h3>
   1546 
   1547 <p>Starting with Android 4.1, Google Play will help protect application assets by encrypting all paid apps with a device-specific key before they are delivered and stored on a device.</p>
   1548 
   1549 <h3>Smart App Updates</h3>
   1550 
   1551 <p>Smart app updates is a new feature of Google Play that introduces a better way of delivering <strong>app updates</strong> to devices. When developers publish an update, Google Play now delivers only the <strong>bits that have changed</strong> to devices, rather than the entire APK. This makes the updates much lighter-weight in most cases, so they are faster to download, save the devices battery, and conserve bandwidth usage on users mobile data plan. On average, a smart app update is about <strong>1/3 the size</strong> of a full APK update.</p>
   1552 
   1553 <h3 id="gps">Google Play services</h3>
   1554 
   1555 <p>Google Play services helps developers to <strong>integrate Google services</strong> such as authentication and Google+ into their apps delivered through Google Play.</p> 
   1556 
   1557 <p>Google Play services is automatically provisioned to end user devices by Google Play, so all you need is a <strong>thin client library</strong> in your apps.</p>
   1558 
   1559 <p>Because your app only contains the small client library, you can take advantage of these services without a big increase in download size and storage footprint. Also, Google Play will <strong>deliver regular updates</strong> to the services, without developers needing to publish app updates to take advantage of them.</p>
   1560 
   1561 <p>For more information about the APIs included in Google Play Services, see the <a href="http://developers.google.com/android/google-play-services/index.html">Google Play services</a> developer page.</p>
   1562 
   1563 </div> <!-- END ANDROID 4.1 -->
   1564 
   1565 
   1566 
   1567 
   1568 
   1569 
   1570