kitkat.jd revision b08447ba51e17d02ca9173bb638c6b1c840ac3c4
1page.title=Android KitKat 2 3@jd:body 4 5 6<style> 7</style> 8 9<script> 10function revealSection(hashy) { 11 if (hashy != "" && !$(hashy).is(":visible")) { 12 sectionId = $(hashy).closest(".version-section").attr("id"); 13 link = $("#title-tabs a[href$="+sectionId+"]"); 14 link.parent().addClass("selected"); 15 link.parent().siblings().removeClass("selected"); 16 17 sectionDiv = $(".version-section"+link.attr("href")); 18 if (sectionDiv.length) { 19 $(".version-section").hide(); 20 sectionDiv.show(); 21 } 22 23 $('html, body').animate({ 24 scrollTop: $(hashy).offset().top 25 }, 100); 26 } 27} 28 29$(document).ready(function() { 30 $("#title-tabs li a").each(function() { 31 $(this).click(function(){ 32 $(this).parent().addClass("selected"); 33 $(this).parent().siblings().removeClass("selected"); 34 $(".version-section").hide(); 35 $($(this).attr("href")).show(); 36 return false; 37 }); 38 }); 39 40 hashy = escapeHTML(location.hash); 41 revealSection(hashy); 42}); 43 44window.onhashchange = function () { 45 revealSection(escapeHTML(location.hash)); 46} 47 48</script> 49 50<style> 51 52</style> 53 54<!-- BEGIN ANDROID 4.4 --> 55<div id="44-android-44" class="version-section"> 56 57 <div style="padding:0px 0px 0px 60px;margin-top:-3px;float:right;"> 58 <img src="{@docRoot}images/kk-android-44.png" alt="Android 4.4 on phone and tablet" width="380"> 59 </div> 60 61 <div class="landing-docs" style="float:right;clear:both;margin:22px 0 2em 3em;"> 62 <div class="col-4 normal-links highlights" style="font-size:12px;"> 63 <h3 id="thisd" >Key Developer Features</h3> 64 <ul style="list-style-type:none;"> 65 <!--<li><a href="#44-ui">UI refresh</a></li>--> 66 <li><a href="#44-hce">Host Card Emulation</a></li> 67 <li><a href="#44-printing">Printing framework</a></li> 68 <li><a href="#44-storage-access">Storage access framework</a></li> 69 <li><a href="#44-sensors">Low-power sensors</a></li> 70 <li><a href="#44-sms-provider">SMS provider</a></li> 71 <li><a href="#44-immersive">Full-screen Immersive mode</a></li> 72 <li><a href="#44-transitions">Transitions framework</a></li> 73 <li><a href="#44-webview">Chromium WebView</a></li> 74 <li><a href="#44-screen-recording">Screen recording</a></li> 75 <li><a href="#44-renderscript-ndk">RenderScript NDK</a></li> 76 <li><a href="#44-bluetooth">Bluetooth HOGP and MAP</a></li> 77 <li><a href="#44-ir-blasters">IR Blasters</a></li> 78 <li><a href="#44-closed-captioning">Closed captioning settings</a></li> 79 <li><a href="#44-international-users">RTL features</a></li> 80 <li><a href="#44-security">Security enhancements</a></li> 81 <li><a href="#44-tools">Tools for analyzing memory use</a></li> 82 </ul> 83 </div> 84</div> 85 86<p>Welcome to Android 4.4 KitKat!</p> 87 88<p> 89 Android KitKat brings all of Android's most innovative, most beautiful, and 90 most useful features to more devices everywhere. 91</p> 92 93<p> 94 This document provides a glimpse of what's new for developers. 95</p> 96 97<p> 98 Find out more about KitKat for consumers at <a href= 99 "http://www.android.com/versions/kit-kat-4-4/">www.android.com</a>. 100</p> 101 102 103<h2 id="svelte" style="line-height:1.25em;">Making Android for everyone</h2> 104 105<p> 106 <span style="white-space:nowrap;">Android 4.4</span> is designed to run fast, 107 smooth, and responsively on a much broader range of devices than ever before 108 — including on millions of entry-level devices around the world that 109 have as little as <strong>512MB RAM</strong>. 110</p> 111 112<p> 113 KitKat streamlines every major component to reduce memory use and introduces 114 new APIs and tools to help you create innovative, responsive, 115 memory-efficient applications. 116</p> 117 118<p> 119 OEMs building the next generation of Android devices can take advantage of 120 <strong>targeted recommendations and options</strong> to run <span style= 121 "white-space:nowrap;">Android 4.4</span> efficiently, even on low-memory 122 devices. Dalvik JIT code cache tuning, kernel samepage merging (KSM), swap to 123 zRAM, and other optimizations help manage memory. New configuration options 124 let OEMs tune out-of-memory levels for processes, set graphics cache sizes, 125 control memory reclaim, and more. 126</p> 127 128<p> 129 In Android itself, changes across the system improve memory management and 130 reduce memory footprint. Core system processes are trimmed to <strong>use 131 less heap</strong>, and they now more <strong>aggressively protect system 132 memory</strong> from apps consuming large amounts of RAM. When multiple 133 services start at once — such as when network connectivity changes 134 — Android now <strong>launches the services serially</strong>, in small 135 groups, to avoid peak memory demands. 136</p> 137 138<p> 139 For developers, <span style="white-space:nowrap;">Android 4.4</span> helps 140 you deliver <strong>apps that are efficient and responsive</strong> on all 141 devices. A new API, <span style= 142 "font-size:11.5px;font-family:monospace;">ActivityManager.isLowRamDevice()</span>, 143 lets you tune your app's behavior to match the device's memory configuration. 144 You can modify or disable large-memory features as needed, depending on the 145 use-cases you want to support on entry-level devices. Learn more about 146 optimizing your apps for low-memory devices <a href="">here</a>. 147</p> 148 149<p> 150 New tools give also give you powerful insight into your app's memory use. The 151 <strong>procstats tool</strong> details memory use over time, with run times 152 and memory footprint for foreground apps and background services. An 153 on-device view is also available as a new developer option. The 154 <strong>meminfo tool</strong> is enhanced to make it easier to spot memory 155 trends and issues, and it reveals additional memory overhead that hasn't 156 previously been visible. 157</p> 158 159 160<h2 id="44-hce">New NFC capabilities through Host Card Emulation</h2> 161 162<p> 163 <span style="white-space:nowrap;">Android 4.4</span> introduces new platform 164 support for secure NFC-based transactions through <strong>Host Card 165 Emulation</strong> (HCE), for payments, loyalty programs, card access, 166 transit passes, and other custom services. With HCE, any app on an Android 167 device can emulate an NFC smart card, letting users tap to initiate 168 transactions with an app of their choice — no provisioned secure 169 element (SE) in the device is needed. Apps can also use a new <strong>Reader 170 Mode</strong> to act as readers for HCE cards and other NFC-based 171 transactions. 172</p> 173 174<div style="float:right;margin:32px;width:200px;"> 175 <img src="{@docRoot}images/kk-contactless-card.png" alt="" width="200" style= 176 "margin-bottom:0;"> 177</div> 178 179<p> 180 Android HCE emulates ISO/IEC 7816 based smart cards that use the contactless 181 ISO/IEC 14443-4 (ISO-DEP) protocol for transmission. These cards are used by 182 many systems today, including the existing EMVCO NFC payment infrastructure. 183 Android uses Application Identifiers (AIDs) as defined in ISO/IEC 7816-4 as 184 the basis for routing transactions to the correct Android applications. 185</p> 186 187<p> 188 Apps declare the AIDs they support in their manifest files, along with a 189 category identifier that indicates the type of support available (for 190 example, "payments"). In cases where multiple apps support the same AID in 191 the same category, Android displays a dialog that lets the user choose which 192 app to use. 193</p> 194 195<p> 196 When the user taps to pay at a point-of-sale terminal, the system extracts 197 the preferred AID and routes the transaction to the correct application. The 198 app reads the transaction data and can use any local or network-based 199 services to verify and then complete the transaction. 200</p> 201 202<p> 203 Android HCE requires an NFC controller to be present in the device. Support 204 for HCE is already widely available on most NFC controllers, which offer 205 dynamic support for both HCE and SE transactions. <span style= 206 "white-space:nowrap;">Android 4.4</span> devices that support NFC will 207 include Tap & Pay for easy payments using HCE. 208</p> 209 210 211<h2 id="44-printing">Printing framework</h2> 212 213<p> 214 Android apps can now print any type of content over Wi-Fi or 215 cloud-hosted services such as Google Cloud Print. In print-enabled apps, 216 users can discover available printers, change paper sizes, choose specific 217 pages to print, and print almost any kind of document, image, or file. 218</p> 219 220<p> 221 <span style="white-space:nowrap;">Android 4.4</span> introduces native 222 platform support for printing, along with APIs for managing printing and 223 adding new types of printer support. The platform provides a print manager 224 that mediates between apps requesting printing and installed print services 225 that handle print requests. The print manager provides shared services and a 226 system UI for printing, giving users consistent control over printing from 227 any app. The print manager also ensures the security of content as it's 228 passed across processes, from an app to a print service. 229</p> 230 231<div style="float:right;margin:22px 0px 0px 24px;width:490px;"> 232 <img src="{@docRoot}images/kk-print-land-n5.jpg" alt="" width="471" style= 233 "margin-bottom:0;"> 234 <p class="img-caption" style= 235 "padding-top:1.5em;margin-left:6px;line-height:1.25em;width:480px;"> 236 You can add printing support to your apps or develop print services to 237 support specific types of printers. 238 </p> 239</div> 240 241<p> 242 Printer manufacturers can use new APIs to develop their own <strong>print 243 services</strong> — pluggable components that add vendor-specific logic 244 and services for communicating with specific types of printers. They can 245 build print services and distribute them through Google Play, making it easy 246 for users to find and install them on their devices. Just as with other apps, 247 you can update print services over-the-air at any time. 248</p> 249 250<p> 251 <strong>Client apps</strong> can use new APIs to add printing capabilities to 252 their apps with minimal code changes. In most cases, you would add a print 253 action to your Action Bar and a UI for choosing items to print. You would 254 also implement APIs to create print jobs, query the print manager for status, 255 and cancel jobs. This lets you print nearly any type of content, from local 256 images and documents to network data or a view rendered to a canvas. 257</p> 258 259<p> 260 For broadest compatibility, Android uses PDF as its primary file format for 261 printing. Before printing, your app needs to generate a properly paginated 262 PDF version of your content. For convenience, the printing API provides 263 native and WebView helper classes to let you create PDFs using standard 264 Android drawing APIs. If your app knows how to draw the content, it can 265 quickly create a PDF for printing. 266</p> 267 268<p> 269 Most devices running <span style="white-space:nowrap;">Android 4.4</span> 270 will include Google Cloud Print pre-installed as a print service, as well as 271 several Google apps that support printing, including Chrome, Drive, Gallery, 272 and QuickOffice. 273</p> 274 275<h2 id="44-storage-access">Storage access framework</h2> 276 277<p> 278 A new <strong>storage access framework</strong> makes it simple for users to 279 browse and open documents, images, and other files across all of their their 280 preferred document storage providers. A standard, easy-to-use UI lets users 281 browse files and access recents in a consistent way across apps and 282 providers. 283</p> 284 285<div style="float:right;margin:22px 0px 0px 24px;width:490px;"> 286 <img src="{@docRoot}images/kk-saf2-n5.jpg" alt="" width="240" style= 287 "margin-bottom:0;"> <img src="{@docRoot}images/kk-saf1-n5.jpg" alt="" width="240" 288 style="margin-bottom:0;padding-left:6px;"> 289 <p class="img-caption" style= 290 "padding-top:1.5em;margin-left:6px;line-height:1.25em;width:480px;"> 291 Box and others have integrated their services into the storage access 292 framework, giving users easy access to their documents from apps across the 293 system. 294 </p> 295</div> 296 297<p> 298 Cloud or local storage services can participate in this ecosystem by 299 implementing a new document provider class that encapsulates their services. 300 The provider class includes all of the APIs needed to register the provider 301 with the system and manage browsing, reading, and writing documents in the 302 provider. The document provider can give users access to any remote or local 303 data that can be represented as files — from text, photos, and 304 wallpapers to video, audio, and more. 305</p> 306 307<p> 308 If you build a <strong>document provider</strong> for a cloud or local 309 service, you can deliver it to users as part of your existing Android app. 310 After downloading and installing the app, users will have instant access to 311 your service from any app that participates in the framework. This can help 312 you gain exposure and user engagement, since users will find your services 313 more easily. 314</p> 315 316<p> 317 If you develop a <strong>client app</strong> that manages files or documents, 318 you can integrate with the storage access framework just by using new 319 <span style="font-size:11.5px;">CREATE_DOCUMENT</span> or <span style= 320 "font-size:11.5px;">OPEN_DOCUMENT</span> intents to open or create files 321 — the system automatically displays the standard UI for browsing 322 documents, including all available document providers. 323</p> 324 325<p> 326 You can integrate your client app one time, for all providers, without any 327 vendor-specific code. As users add or remove providers, they’ll continue to 328 have access to their preferred services from your app, without changes or 329 updates needed in your code. 330</p> 331 332<p> 333 The storage access framework is integrated with the existing <span style= 334 "font-size:11.5px;">GET_CONTENT</span> intent, so users also have access to 335 all of their previous content and data sources from the new system UI for 336 browsing. Apps can continue using <span style= 337 "font-size:11.5px;">GET_CONTENT</span> as a way to let users import data. The 338 storage access framework and system UI for browsing make it easier for users 339 to find and import their data from a wider range of sources. 340</p> 341<p> 342 Most devices running <span style="white-space:nowrap;">Android 4.4</span> 343 will include Google Drive and local storage pre-integrated as document 344 providers, and Google apps that work with files also use the new framework. 345</p> 346 347 348<h2 id="44-sensors">Low-power sensors</h2> 349 350<h4 id="44-sensor-batching">Sensor batching</h4> 351 352<p> 353 <span style="white-space:nowrap;">Android 4.4</span> introduces platform 354 support for <strong>hardware sensor batching</strong>, a new optimization 355 that can dramatically reduce power consumed by ongoing sensor activities. 356</p> 357 358<p> 359 With sensor batching, Android works with the device hardware to collect and 360 deliver sensor events efficiently in batches, rather than individually as 361 they are detected. This lets the device's application processor remain in a 362 low-power idle state until batches are delivered. You can request batched 363 events from any sensor using a standard event listener, and you can control 364 the interval at which you receive batches. You can also request immediate 365 delivery of events between batch cycles. 366</p> 367 368<p> 369 Sensor batching is ideal for low-power, long-running use-cases such as 370 fitness, location tracking, monitoring, and more. It can makes your app more 371 efficient and it lets you track sensor events continuously — even while 372 the screen is off and the system is asleep. 373</p> 374 375<p> 376 Sensor batching is currently available on Nexus 5, and we're working with our 377 chipset partners to bring it to more devices as soon as possible. 378</p> 379 380<div style="float:right;margin:1em 0em 0em 3em;width:484px;clear:both"> 381 <img src="{@docRoot}images/kk-sensors-moves-n5.jpg" alt="" width="240" style= 382 "margin-bottom:0;"> <img src="{@docRoot}images/kk-sensors-runtastic-n5.jpg" alt="" 383 width="240" style="margin-bottom:0;padding-left:4px;"> 384 <p class="img-caption" style= 385 "padding-top:1.5em;margin-left:6px;line-height:1.25em;"> 386 <strong>Moves</strong> and <strong>Runtastic Pedometer</strong> are using 387 the hardware step-detector to offer long-running, low-power services. 388 </p> 389</div> 390 391<h4 id="44-step-detector">Step Detector and Step Counter</h4> 392 393<p> 394 <span style="white-space:nowrap;">Android 4.4</span> also adds platform 395 support for two new composite sensors — step detector 396 and step counter — that let your app track steps when 397 the user is walking, running, or climbing stairs. These new sensors are 398 implemented in hardware for low power consumption. 399</p> 400 401<p> 402 The step detector analyzes accelerometer input to recognize when the user has 403 taken a step, then triggers an event with each step. The step counter tracks 404 the total number of steps since the last device reboot and triggers an event 405 with each change in the step count. Because the logic and sensor management 406 is built into the platform and underlying hardware, you don't need to 407 maintain your own detection algorithms in your app. 408</p> 409 410<p> 411 Step detector and counter sensors are available on Nexus 5, and we're working 412 with our chipset partners to bring them to new devices as soon as possible. 413</p> 414 415 416<h2 id="44-sms-provider">SMS provider</h2> 417 418<p> 419 If you develop a messaging app that uses SMS or MMS, you can now use a 420 <strong>shared SMS provider and new APIs</strong> to manage your app's 421 message storage and retrieval. The new SMS provider and APIs define a 422 standardized interaction model for all apps that handle SMS or MMS messages. 423</p> 424 425<p> 426 Along with the new provider and APIs, <span style= 427 "white-space:nowrap;">Android 4.4</span> introduces <strong>new 428 semantics</strong> for receiving messages and writing to the provider. When a 429 message is received, the system routes it directly to the user's default 430 messaging app using the new <span style= 431 "font-size:11.5px;">SMS_DELIVER</span> intent. Other apps can still listen 432 for incoming messages using the <span style= 433 "font-size:11.5px;">SMS_RECEIVED</span> intent. Also, the system now allows 434 only the default app to write message data to the provider, although other 435 apps can read at any time. Apps that are not the user's default can still 436 send messages — the system handles writing those messages to the 437 provider on behalf of the app, so that users can see them in the default app. 438</p> 439 440<p> 441 The new provider and semantics help to improve the user's experience when 442 multiple messaging apps are installed, and they help you to build new 443 messaging features with fully-supported, forward-compatible APIs. 444</p> 445 446 447<h2 id="44-beautiful-apps">New ways to build beautiful apps</h2> 448 449<div style="float:right;margin:14px 0px 0px 24px;width:246px;"> 450 <img src="{@docRoot}images/kk-immersive-n5.jpg" alt="" width="240" style= 451 "margin-bottom:0;"> 452 <p class="img-caption" style= 453 "padding-top:1.5em;margin-left:6px;line-height:1.25em;"> 454 A new <strong>immersive mode</strong> lets apps use every pixel on the 455 screen to show content and capture touch events. 456 </p> 457</div> 458 459<h4 id="44-immersive">Full-screen Immersive mode</h4> 460<p> 461 Now your apps can use <strong>every pixel on the device screen</strong> to 462 showcase your content and capture touch events. <span style= 463 "white-space:nowrap;">Android 4.4</span> adds a new full-screen immersive 464 mode that lets you create full-bleed UIs reaching from edge to edge on phones 465 and tablets, <strong>hiding all system UI</strong> such as the status bar and 466 navigation bar. It's ideal for rich visual content such as photos, videos, 467 maps, books, and games. 468</p> 469 470<p> 471 In the new mode, the system UI stays hidden, even while users are interacting 472 with your app or game — you can capture touch events from anywhere 473 across the screen, even areas that would otherwise be occupied by the system 474 bars. This gives you a great way to create a larger, richer, more immersive 475 UI in your app or game and also reduce visual distraction. 476</p> 477 478<p> 479 To make sure that users always have easy, consistent access to system UI from 480 full-screen immersive mode, <span style="white-space:nowrap;">Android 481 4.4</span> supports a new gesture — in immersive mode, an edge swipe 482 from the top or bottom of the screen now reveals the system UI. 483</p> 484 485<p> 486 To return to immersive mode, users can touch the screen outside of the bar 487 bounds or wait for a short period for the bars to auto-hide. For a consistent 488 user experience, the new gesture also works with previous methods of hiding 489 the status bar. 490</p> 491 492<h4 id="44-transitions">Transitions framework for animating scenes</h4> 493 494<p> 495 Most apps structure their flows around several key UI states that expose 496 different actions. Many apps also use animation to help users understand 497 their progress through those states and the actions available in each. To 498 make it easier to create <strong>high-quality animations</strong> in your 499 app, <span style="white-space:nowrap;">Android 4.4</span> introduces a new 500 transitions framework. 501</p> 502 503<p> 504 The transitions framework lets you define <strong>scenes</strong>, typically 505 view hierarchies, and transitions, which describe how to animate or transform 506 the scenes when the user enters or exits them. You can use several predefined 507 transition types to animate your scenes based on specific properties, such as 508 layout bounds, or visibility. There's also an auto-transition type that 509 automatically fades, moves, and resizes views during a scene change. In 510 addition, you can define custom transitions that animate the properties that 511 matter most to your app, and you can plug in your own animation styles if 512 needed. 513</p> 514 515<p> 516 With the transitions framework you can also <strong>animate changes to your 517 UI on the fly</strong>, without needing to define scenes. For example, you 518 can make a series of changes to a view hierarchy and then have the 519 TransitionManager automatically run a delayed transition on those changes. 520</p> 521 522<p> 523 Once you've set up transitions, it's straightforward to invoke them from your 524 app. For example, you can call a single method to begin a transition, make 525 various changes in your view hierarchy, and on the next frame animations will 526 automatically begin that animate the changes you specified. 527</p> 528 529<div style="float:right;margin:0px 0px 22px 32px;width:340px;"> 530 <img src="{@docRoot}images/kk-home.jpg" alt="translucent system UI" widtdh="340" 531 style="margin-bottom:0"> 532 <p class="img-caption" style= 533 "padding-top:1.5em;line-height:1.25em;margin-bottom:0;"> 534 Apps can use new window styles to request translucent system bars. 535 </p> 536</div> 537 538<p> 539 For custom control over the transitions that run between specific scenes in 540 your application flow, you can use the TransitionManager. The 541 TransitionManager lets you define the relationship between scenes and the 542 transitions that run for specific scene changes. 543</p> 544 545<h4 id="44-translucent-system-ui">Translucent system UI styling</h4> 546 547<p> 548 To get the most impact out of your content, you can now use new window styles 549 and themes to request <strong>translucent system UI</strong>, including both 550 the status bar and navigation bar. To ensure the legibility of navigation bar 551 buttons or status bar information, subtle gradients is shown behind the 552 system bars. A typical use-case would be an app that needs to show through to 553 a wallpaper. 554</p> 555 556<h4 id="44-notification-access">Enhanced notification access</h4> 557 558<p> 559 Notification listener services can now see <strong>more information about 560 incoming notifications</strong> that were constructed using the notification 561 builder APIs. Listener services can access a notification's actions as well 562 as new extras fields — text, icon, picture, progress, chronometer, and 563 many others — to extract cleaner information about the notification and 564 present the information in a different way. 565</p> 566 567<div style="float:left;margin:1em 2em 1em 2em;"> 568 <a href=""><img src="{@docRoot}images/kk-chromium-icon.png" alt="" height="160" style= 569 "margin-bottom:0em;"></a> 570</div> 571 572<h4 id="44-webview">Chromium WebView</h4> 573 574<p> 575 <span style="white-space:nowrap;">Android 4.4</span> includes a completely 576 new implementation of WebView that's based on <a href= 577 "http://www.chromium.org/Home" class="external-link">Chromium</a>. The new 578 Chromium WebView gives you the latest in standards support, performance, and 579 compatibility to build and display your web-based content. 580</p> 581 582<p> 583 Chromium WebView provides broad support for HTML5, CSS3, and JavaScript. It 584 supports most of the HTML5 features available in Chrome for Android 30. It 585 also brings an updated version of the JavaScript Engine (V8) that delivers 586 dramatically improved JavaScript performance. 587</p> 588 589<p stydle="clear:both;"> 590 In addition, the new Chromium WebView supports remote debugging using 591 <a class="external-link" href= 592 "https://devsite.googleplex.com/chrome-developer-tools/docs/remote-debugging#debugging-webviews"> 593 Chrome DevTools</a>. For example, you can use Chrome DevTools on your 594 development machine to inspect, debug, and analyze your WebView content live 595 on a mobile device. 596</p> 597 598<p> 599 The new Chromium WebView is included on all compatible devices running 600 <span style="white-space:nowrap;">Android 4.4</span> and higher. You can take 601 advantage of the new WebView right away, and with minimum modifications to 602 existing apps and content. In most cases, your content will migrate to the 603 new implementation seamlessly. 604</p> 605 606 607<h2 id="44-media">New media capabilities</h2> 608 609<h4 id="44-screen-recording">Screen recording</h4> 610 611<p> 612 Now it's easy to create high-quality video of your app, directly from your 613 Android device. <span style="white-space:nowrap;">Android 4.4</span> adds 614 support for screen recording and provides a <strong>screen recording 615 utility</strong> that lets you capture video as you use the device and store 616 it as an MP4 file. It's a great new way to create walkthroughs and tutorials 617 for your app, testing materials, marketing videos, and much more. 618</p> 619 620<p> 621 You can record at any device-supported resolution and bitrate you want, and 622 the output retains the aspect ratio of the display. By default, the utility 623 selects a resolution equal or close to the device's display resolution in the 624 current orientation. When you are done recording, you can share the video 625 directly from your device or pull the MP4 file to your host computer for 626 post-production. 627</p> 628 629<p> 630 If your app plays video or other protected content that you don’t want to be 631 captured by the screen recorder, you can use <span style= 632 "font-size:11.5px;font-family:monospace;white-space:nowrap;">SurfaceView.setSecure()</span> 633 to mark the content as secure. 634</p> 635 636<p> 637 You can access screen recording through the adb tool included in the Android 638 SDK, using the command <span style= 639 "font-size:11.5px;font-family:monospace;white-space:nowrap;">adb shell 640 screenrecord</span>. You can also launch it through the DDMS panel in Android 641 Studio. 642</p> 643 644<h4 id="44-adaptive-playback">Resolution switching through adaptive playback</h4> 645 646<p> 647 <span style="white-space:nowrap;">Android 4.4</span> brings formal support 648 for adaptive playback into the Android media framework. Adaptive playback is 649 an optional feature of video decoders for MPEG-DASH and other formats that 650 enables <strong>seamless change in resolution during playback</strong>. The 651 client can start to feed the decoder input video frames of a new resolution 652 and the resolution of the output buffers change automatically, and without a 653 significant gap. 654</p> 655 656<p> 657 Resolution switching in <span style="white-space:nowrap;">Android 4.4</span> 658 lets media apps offer a significantly better streaming video experience. Apps 659 can check for adaptive playback support at runtime using existing APIs and 660 implement resolution-switching using new APIs introduced in <span style= 661 "white-space:nowrap;">Android 4.4</span>. 662</p> 663 664<h4 id="44-cenc">Common Encryption for DASH</h4> 665 666<p> 667 Android now supports the <strong>Common Encryption (CENC)</strong> for 668 MPEG-DASH, providing a standard, multiplatform DRM scheme for managing 669 protecting content. Apps can take advantage of CENC through Android's modular 670 DRM framework and platform APIs for supporting DASH. 671</p> 672 673<h4 id="44-hls">HTTP Live Streaming</h4> 674 675<p> 676 <span style="white-space:nowrap;">Android 4.4</span> updates the platform's 677 HTTP Live Streaming (HLS) support to a superset of version 7 of the HLS 678 specification (version 4 of the protocol). See the <a href= 679 "http://tools.ietf.org/html/draft-pantos-http-live-streaming-07" class= 680 "external-link">IETF draft</a> for details. 681</p> 682<h4 id="44-audio-tunneling">Audio Tunneling to DSP</h4> 683 684<p> 685 For high-performance, lower-power audio playback, <span style= 686 "white-space:nowrap;">Android 4.4</span> adds platform support for 687 audio tunneling to a digital signal processor (DSP) in the 688 device chipset. With tunneling, audio decoding and output effects are 689 off-loaded to the DSP, waking the application processor less often and using 690 less battery. 691</p> 692 693<p> 694 Audio tunneling can <strong>dramatically improve battery life</strong> for 695 use-cases such as listening to music over a headset with the screen off. For 696 example, with audio tunneling, Nexus 5 offers a total off-network audio 697 playback time of up to 60 hours, an increase of over 50% over non-tunneled 698 audio. 699</p> 700 701<p> 702 Media applications can take advantage of audio tunneling on supported devices 703 without needing to modify code. The system applies tunneling to optimize 704 audio playback whenever it's available on the device. 705</p> 706 707<div style="float:right;padding-top:1em;width:372px;margin-left:2em;"> 708 <img src="{@docRoot}images/kk-loudnessEnhancerAnnotated.png" alt= 709 "Visualizer showing loudness enhancer audio effect" width="360" height="252" 710 style="border:1px solid #ddd;border-radius: 6px;"> 711 <p class="img-caption" style="margin-left:6px;line-height:1.25em;"> 712 Visualization of how the LoudnessEnhancer effect can make speech content 713 more audible. 714 </p> 715</div> 716 717<p> 718 Audio tunneling requires support in the device hardware. Currently audio 719 tunneling is available on Nexus 5 and we're working with our chipset partners 720 to make it available on more devices as soon as possible. 721</p> 722 723<h4 id="44-audio-monitoring">Audio monitoring</h4> 724 725<p> 726 Apps can use new monitoring tools in the Visualizer effect to get updates on 727 the <strong>peak and RMS levels</strong> of any currently playing audio on 728 the device. For example, you could use this creatively in music visualizers 729 or to implement playback metering in a media player. 730</p> 731 732<h4 id="44-loudness">Loudness enhancer</h4> 733 734<p> 735 Media playback applications can <strong>increase the loudness of spoken 736 content</strong> by using the new LoudnessEnhancer effect, which acts as 737 compressor with time constants that are specifically tuned for speech. 738</p> 739 740<h4 id="44-audio-timestamps">Audio timestamps for improved AV sync</h4> 741 742<p> 743 The audio framework can now report <strong>presentation timestamps</strong> 744 from the audio output HAL to applications, for better audio-video 745 synchronization. Audio timestamps let your app determine when a specific 746 audio frame will be (or was) presented off-device to the user; you can use 747 the timestamp information to more accurately synchronize audio with video 748 frames. 749</p> 750 751<h4 id="44-miracast">Wi-Fi CERTIFIED Miracast™</h4> 752 753<p> 754 <span style="white-space:nowrap;">Android 4.4</span> devices can now be 755 certified to the Wi-Fi Alliance Wi-Fi Display Specification as Miracast 756 compatible. To help with testing, a new Wireless Display developer option 757 exposes advanced configuration controls and settings for Wireless Display 758 certification. You can access the option at <strong>Settings > Developer 759 options > Wireless display certification</strong>. Nexus 5 is a Miracast 760 certified wireless display device. 761</p> 762 763<h2 id="44-renderscript">RenderScript Compute</h2> 764 765<div style="float:right;padding-top:1em;width:372px;margin-left:2em;"> 766 <img src="{@docRoot}images/kk-rs-chart-versions.png" alt= 767 "Renderscipt optimizations chart" width="360" height="252" style= 768 "border:1px solid #ddd;border-radius: 6px;"> 769 <p class="img-caption" style="margin-left:6px;line-height:1.25em;"> 770 Performance benchmarks for Android 4.4 relative to Android 4.3, 771 run on the same devices (Nexus 7, Nexus 10). 772 </p> 773</div> 774 775<h4>Ongoing performance improvements</strong></h4> 776 777<p> 778 When your apps use RenderScript, they'll benefit from <strong>ongoing 779 performance tuning</strong> in the RenderScript runtime itself, without the 780 need for recompilation. The chart at right shows performance gains in Android 781 4.4 on two popular chipsets. 782</p> 783 784<h4>GPU acceleration</h4> 785 786<p> 787 Any app using RenderScript on a supported device benefits from GPU 788 acceleration, without code changes or recompiling. Since the Nexus 10 first 789 debuted RenderScript GPU acceleration, various other hardware partners have 790 added support. 791</p> 792 793<p> 794 Now with <span style="white-space:nowrap;">Android 4.4</span>, GPU 795 acceleration is available on the Nexus 5, as well as the Nexus 4, Nexus 7 796 (2013), and Nexus 10, and we're working with our partners to bring it to more 797 devices as soon as possible. 798</p> 799 800<h4 id="44-renderscript-ndk">RenderScript in the Android NDK</h4> 801 802<p> 803 Now you can take advantage of RenderScript <strong>directly from your native 804 code</strong>. A new C++ API in the Android Native Development Kit (NDK) lets 805 you access the same RenderScript functionality available through the 806 framework APIs, including script intrinsics, custom kernels, and more. 807</p> 808 809<p> 810 If you have large, performance-intensive tasks to handle in native code, you 811 can perform those tasks using RenderScript and integrate them with your 812 native code. RenderScript offers great performance across a wide range of 813 devices, with automatic support for multi-core CPUs, GPUs, and other 814 processors. 815</p> 816 817<p> 818 When you build an app that uses the RenderScript through the NDK, you can 819 distribute it to any device running Android 2.2 or or higher, just like with 820 the RenderScript support library available for framework APIs. 821</p> 822 823 824<h2 id="44-graphics">Graphics</h2> 825 826<h4 id="44-surfaceflinger">GLES2.0 SurfaceFlinger</h4> 827 828<p> 829 <span style="white-space:nowrap;">Android 4.4</span> upgrades its 830 SurfaceFlinger from OpenGL ES 1.0 to OpenGL ES 2.0. This boosts performance 831 by using multi-texturing, and it improves color calibration and supports more 832 advanced special effects. 833</p> 834 835<h4 id="44-composer">New Hardware Composer support for virtual displays</h4> 836 837<p> 838 The latest version of Android Hardware Composer, HWComposer 1.3, supports 839 hardware composition of one virtual display in addition to the primary, 840 external (e.g. HDMI) display, and has improved OpenGL ES interoperability. 841</p> 842 843 844<h2 id="44-connectivity">New Types of Connectivity</h2> 845 846<h4 id="44-bluetooth">New Bluetooth profiles</h4> 847 848<p> 849 <span style="white-space:nowrap;">Android 4.4</span> support for two new 850 Bluetooth profiles to let apps support a broader range of low-power and media 851 interactions. <strong>Bluetooth HID over GATT</strong> (HOGP) gives apps a 852 low-latency link with low-power peripheral devices such as mice, joysticks, 853 and keyboards. <strong>Bluetooth MAP</strong> lets your apps exchange 854 messages with a nearby device, for example an automotive terminal for 855 handsfree use or another mobile device. As an <strong>extension to Bluetooth 856 AVRCP 1.3</strong>, users can now set absolute volume on the system from 857 their Bluetooth devices. 858</p> 859 860<p> 861 Platform support for HOGP, MAP, and AVRCP is built on the Bluedroid Bluetooth 862 stack introduced by Google and Broadcom in Android 4.2. Support is available 863 right away on Nexus devices and other Android-compatible devices that offer 864 compatible Bluetooth capabilities. 865</p> 866 867<h4 id="44-ir-blasters">IR Blasters</h4> 868 869<p> 870 <span style="white-space:nowrap;">Android 4.4</span> introduces platform 871 support for built-in <strong>IR blasters</strong>, along with a new API and 872 system service that let you create apps to take advantage them. 873</p> 874 875<p> 876 Using the new API, you can build apps that let users remotely control nearby 877 TVs, tuners, switches, and other electronic devices. The API lets your app 878 check whether the phone or tablet has an infrared emitter, query it's carrier 879 frequencies, and then send infrared signals. 880</p> 881 882<p> 883 Because the API is standard across Android devices running <span style= 884 "white-space:nowrap;">Android 4.4</span> or higher, your app can support the 885 broadest possible range of vendors without writing custom integration code. 886</p> 887 888<h4 id="44-wifi-tdls">Wi-Fi TDLS support</h4> 889 890<p> 891 <span style="white-space:nowrap;">Android 4.4</span> introduces a seamless 892 way to stream media and other data faster between devices already on the same 893 Wi-Fi network by supporting Wi-Fi Tunneled Direct Link Setup (TDLS). 894</p> 895 896 897<h2 id="44-accessibility">Accessibility</h2> 898 899<h4 id="44-closed-captioning">System-wide settings for closed captioning</h4> 900 901<p> 902 <span style="white-space:nowrap;">Android 4.4</span> now supports a better 903 accessibility experience across apps by adding system-wide preferences for 904 Closed Captioning. Users can go to <strong>Settings</strong> > 905 <strong>Accessibility</strong> > <strong>Captions</strong> to set global 906 captioning preferences, such as whether to show captions and what language, 907 text size, and text style to use. 908</p> 909 910<p> 911 Apps that use video can now access the user's captioning settings and 912 <strong>adjust presentation to meet the user's preferences</strong>. A new 913 captioning manager API lets you check and monitor the user's captioning 914 preferences. The captioning manager provides you with the user's preferred 915 captioning state as well as preferred locale, scaling factor, and text style. 916 The text style includes foreground and background colors, edge properties, 917 and typeface. 918</p> 919 920<div style="float:right;margin:22px 0px 0px 24px;width:490px;"> 921 <img src="{@docRoot}images/kk-captions-n5.jpg" alt="" width="471" style= 922 "margin-bottom:0;"> 923 <p class="img-caption" style= 924 "padding-top:1.5em;margin-left:6px;line-height:1.25em;width:480px;"> 925 Apps can now refer to the user's <strong>system-wide captions 926 preferences</strong>. An example of the expected display style is shown 927 right in the settings. 928 </p> 929</div> 930 931<p> 932 In addition, apps that use <strong>VideoView</strong> can use a new API to 933 pass a captioning stream along with a video stream for rendering. The system 934 automatically handles the display of the captions on video frames according 935 to the user's systemwide settings. Currently, VideoView supports auto-display 936 of captions in WebVTT format only. 937</p> 938 939<p> 940 <strong>All apps that show captions</strong> should make sure to check the 941 user's systemwide captioning preferences and render captions as closely as 942 possible to those preferences. For more insight into how specific 943 combinations of settings should look, you can look at a preview of captions 944 in different languages, sizes, and styles right in the Settings app. 945</p> 946 947<h4 id="44-enhanced-apis">Enhanced Accessibility APIs</h4> 948 949<p> 950 <span style="white-space:nowrap;">Android 4.4</span> extends the 951 accessibility APIs to support <strong>more precise structural and semantic 952 description</strong> and observation of onscreen elements. With the new APIs, 953 developers can improve the quality of accessible feedback by providing 954 accessibility services with more information about on-screen elements. 955</p> 956 957<p> 958 In accessibility nodes, developers can now determine whether a node is a 959 popup, get its input type, and more. You can also use new APIs to work with 960 nodes that contain grid-like information, such as lists and tables. For 961 example, you can now specify new supported actions, collection information, 962 live region modes, and more. 963</p> 964 965<p> 966 New accessibility events let developers more closely follow the changes that 967 are taking place in window content, and they can now listen for changes in 968 the touch exploration mode on the device. 969</p> 970 971 972<h2 id="44-international-users">Support for international Users</h2> 973 974<h4 id="44-drawable-mirroring">Drawable mirroring for RTL locales</h4> 975 976<p> 977 If your app is targeting users who use RTL scripts, you can use a new API to 978 declare that a <strong>drawable should be auto-mirrored</strong> when the 979 user's locale setting includes an RTL language. 980</p> 981 982<p> 983 Declaring a drawable as auto-mirrored helps you <strong>prevent duplication 984 of assets</strong> in your app and reduces the the size of your APK. When you 985 have drawables that are the reusable for both LTR and RTL presentations, you 986 can declare the default versions as auto-mirrored and then omit those 987 Drawables from your RTL resources. 988</p> 989 990<div style="float:right;margin:16px 12px 0px 32px;width:260px;clear:both;"> 991 <img src="{@docRoot}images/kk-pseudolocale-rtl.png" alt="" width="260" style= 992 "margin-bottom:0;"> 993 <p class="img-caption" style="padding-top:1.5em;line-height:1.25em;"> 994 Pseudo-locales make it easier to test your app's localization. 995 </p> 996</div> 997 998<p> 999 You can declare various types of drawables as auto-mirrored in your 1000 application code, such as bitmap, nine-patch, layer, state list, and other 1001 drawables. You can also declare a drawable as auto-mirrored in your resource 1002 files by using a new attribute. 1003</p> 1004 1005<h4 id="44-pseudolocale-rtl">RTL pseudo-locale</h4> 1006 1007<p> 1008 To make it easier to test and debug your layouts, Android includes an RTL 1009 pseudo-locale as a new developer option. 1010</p> 1011 1012<p> 1013 The RTL pseudo-locale switches the device to RTL layout for all locales and 1014 displays text in your current language. This can help you find layout issues 1015 across your app, without having to display the app in an RTL language. You 1016 can access the RTL pseudo-localed as in <strong>Settings > Developer 1017 options > Force RTL layout direction</strong>. 1018</p> 1019 1020 1021<h2 id="44-security">Security enhancements</h2> 1022 1023<h4 id="44-selinux">SELinux (enforcing mode)</h4> 1024 1025<p> 1026 <span style="white-space:nowrap;">Android 4.4</span> updates its SELinux 1027 configuration from "permissive" to "enforcing." This means potential policy 1028 violations within a SELinux domain that has an enforcing policy will be 1029 blocked. 1030</p> 1031 1032<h4 id="44-crytpo">Improved cryptographic algorithms</h4> 1033 1034<p> 1035 Android has improved its security further by adding support for two more 1036 cryptographic algorithms. Elliptic Curve Digital Signature Algorithm (ECDSA) 1037 support has been added to the keystore provider improving security of digital 1038 signing, applicable to scenarios such as signing of an application or a data 1039 connection. The Scrypt key derivation function is implemented to protect the 1040 cryptographic keys used for full-disk encryption. 1041</p> 1042 1043<h4 id="44-other">Other enhancements</h4> 1044 1045<p> 1046 On multiuser devices, VPNs are now applied per user. This can allow a user to 1047 route all network traffic through a VPN without affecting other users on the 1048 device. Also, Android now supports FORTIFY_SOURCE level 2, and all code is 1049 compiled with those protections. FORTIFY_SOURCE has been enhanced to work 1050 with clang. 1051</p> 1052 1053 1054<h2 id="44-tools">Tools for analyzing memory use</h2> 1055 1056<h4 id="44-procstats">Procstats</h4> 1057 1058<p> 1059 A new tool called <strong>procstats</strong> helps you analyze the memory 1060 resources your app uses, as well as the resources used by other apps and 1061 services running on the system. 1062</p> 1063 1064<p> 1065 Procstats keeps track of <strong>how apps are running over time</strong>, 1066 providing data about their execution durations and memory use to help 1067 determine how efficiently they are performing. This is most important for 1068 apps that start services that run in the background, since it lets you 1069 monitor how long they are running and how much RAM they are using while doing 1070 so. Procstats will also collect data for foreground applications about memory 1071 use over time to determine the overall memory profile of the app. 1072</p> 1073 1074<p> 1075 Procstats can help you identify background services started by your app. You 1076 can keep track of how long those services continue running and how much RAM 1077 they use while doing so. Procstats also lets you profile your app while it's 1078 in the foreground, using its memory use over time to determine its overall 1079 memory profile. 1080</p> 1081 1082<div style="margin:2em 0em;width:780px;"> 1083 <div style="float:left;width:390px;"> 1084 <img src="{@docRoot}images/kk-procstats.png" alt="" width="360" style= 1085 "margin-bottom:0;box-shadow: 3px 10px 18px 1px #eee;border:1px solid #ddd;border-radius: 6px;"> 1086 <p class="img-caption" style= 1087 "padding-top:1.5em;line-height:1.25em;width:360px;"> 1088 The new <strong>procstats</strong> tool lets you check the memory use of 1089 apps and services over time. 1090 </p> 1091 </div> 1092 1093 <div style="float:right;width:390px;"> 1094 <img src="{@docRoot}images/kk-meminfo.png" alt="" width="360" style= 1095 "margin-bottom:0;box-shadow: 3px 10px 12px 1px #eee;border:1px solid #ddd;border-radius: 6px;"> 1096 <p class="img-caption" style= 1097 "padding-top:1.5em;line-height:1.25em;width:360px;"> 1098 The enhanced <strong>meminfo</strong> tool lets you see details of memory 1099 use for an app. 1100 </p> 1101 </div> 1102</div> 1103 1104<p style="clear:both;"> 1105 You can access procstats from the adb tool included in the Android SDK, 1106 <span style="font-size:11.5px;font-family:monospace;white-space:nowrap;">adb 1107 shell dumpsys procstats</span>. Also, for on-device profiling, see the 1108 Process Stats developer option, below. 1109</p> 1110 1111 1112<h4 id="44-procstats-ondevice" style="clear:both">On-device memory status and profiling</h4> 1113 1114<p> 1115 <span style="white-space:nowrap;">Android 4.4</span> includes a new developer 1116 option to make it easier to analyze your app's memory profile while it's 1117 running on any device or emulator. It's especially useful to get a view of 1118 how your app uses memory and performs on devices with low RAM. You can access 1119 the option at <strong>Settings > Developer options > Process 1120 stats</strong> 1121</p> 1122 1123<div style="float:right;margin:22px 0px 0px 24px;width:490px;"> 1124 <img src="{@docRoot}images/kk-proc-device-overview-n5.jpg" alt="" width="240" style= 1125 "margin-bottom:0;"> <img src="{@docRoot}images/kk-proc-device-detail-n5.jpg" alt="" 1126 width="240" style="margin-bottom:0;padding-left:6px;"> 1127 <p class="img-caption" style= 1128 "padding-top:1.5em;margin-left:6px;line-height:1.25em;width:480px;"> 1129 <strong>Process stats</strong> is a convenient way to check your app's 1130 memory use. You can see how your app compares to other apps and zoom in on 1131 specific data about your app or it's background services. 1132 </p> 1133</div> 1134 1135<p> 1136 The <strong>Process Stats</strong> option shows you a variety of high-level 1137 metrics on your app's memory use, based on data collected using the new 1138 procstats service. On the main screen you can see a summary of system memory 1139 status. Green indicates relative amount of time spent with low RAM usage, 1140 yellow indicates moderate RAM usage, and red indicates high (critical) RAM 1141 usage 1142</p> 1143 1144<p> 1145 Below the summary is a list summarizing each app's <strong>memory load on the 1146 system</strong>. For each app, a blue bar indicates the relative computed 1147 memory load (runtime x avg_pss) of its process, and a percentage number 1148 indicates the relative amount of time spent in the background. You can filter 1149 the list to show only foreground, background, or cached processes, and you 1150 can include or exclude system processes. You can also change the duration of 1151 the data collected to 3, 6, 12, or 24 hours, and you can include or exclude 1152 uss memory. 1153</p> 1154 1155<p> 1156 To take a closer look at a specific app's memory usage in isolation, tap the 1157 app. For each app, you can now see a summary of the memory consumed and the 1158 percentage of the collection interval that the app has been running. You can 1159 also see the average and maximum usage over the collection period, and below 1160 the app's services and the percentage of time they've been running. 1161</p> 1162 1163<p> 1164 Analyzing your app using the data in Process Stats can reveal issues and 1165 suggest possible optimizations for your app. For example, if your app is 1166 running longer than it should or using too much memory over a period of time, 1167 there could be bugs in your code that you can resolve to improve your app's 1168 performance, especially when running on a device with low RAM. 1169</p> 1170 1171</div><!-- END ANDROID 4.4 --> 1172