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