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 id="qv-wrapper"> 62 <div id="qv"> 63 <h2 id="features" >Key Developer Features</h3> 64 <ul style="list-style-type:none;"> 65 <li><a href="#44-hce">Host Card Emulation</a></li> 66 <li><a href="#44-printing">Printing framework</a></li> 67 <li><a href="#44-storage-access">Storage access framework</a></li> 68 <li><a href="#44-sensors">Low-power sensors</a></li> 69 <li><a href="#44-sms-provider">SMS provider</a></li> 70 <li><a href="#44-immersive">Full-screen Immersive mode</a></li> 71 <li><a href="#44-transitions">Transitions framework</a></li> 72 <li><a href="#44-webview">Chromium WebView</a></li> 73 <li><a href="#44-screen-recording">Screen recording</a></li> 74 <li><a href="#44-renderscript-ndk">RenderScript NDK</a></li> 75 <li><a href="#44-bluetooth">Bluetooth HOGP and MAP</a></li> 76 <li><a href="#44-ir-blasters">IR Blasters</a></li> 77 <li><a href="#44-closed-captioning">Closed captioning settings</a></li> 78 <li><a href="#44-international-users">RTL features</a></li> 79 <li><a href="#44-security">Security enhancements</a></li> 80 <li><a href="#44-tools">Tools for analyzing memory use</a></li> 81 </ul> 82 </div> 83</div> 84 85<p>Welcome to Android 4.4 KitKat!</p> 86 87<p> 88 Android KitKat brings all of Android's most innovative, most beautiful, and 89 most useful features to more devices everywhere. 90</p> 91 92<p> 93 This document provides a glimpse of what's new for developers. 94</p> 95 96<p> 97 Find out more about KitKat for consumers at <a href= 98 "http://www.android.com/versions/kit-kat-4-4/">www.android.com</a>. 99</p> 100 101 102<h2 id="svelte" style="line-height:1.25em;">Making Android for everyone</h2> 103 104<p> 105 <span style="white-space:nowrap;">Android 4.4</span> is designed to run fast, 106 smooth, and responsively on a much broader range of devices than ever before 107 — including on millions of entry-level devices around the world that 108 have as little as <strong>512MB RAM</strong>. 109</p> 110 111<p> 112 KitKat streamlines every major component to reduce memory use and introduces 113 new APIs and tools to help you create innovative, responsive, 114 memory-efficient applications. 115</p> 116 117<p> 118 OEMs building the next generation of Android devices can take advantage of 119 <strong>targeted recommendations and options</strong> to run <span style= 120 "white-space:nowrap;">Android 4.4</span> efficiently, even on low-memory 121 devices. Dalvik JIT code cache tuning, kernel samepage merging (KSM), swap to 122 zRAM, and other optimizations help manage memory. New configuration options 123 let OEMs tune out-of-memory levels for processes, set graphics cache sizes, 124 control memory reclaim, and more. 125</p> 126 127<p> 128 In Android itself, changes across the system improve memory management and 129 reduce memory footprint. Core system processes are trimmed to <strong>use 130 less heap</strong>, and they now more <strong>aggressively protect system 131 memory</strong> from apps consuming large amounts of RAM. When multiple 132 services start at once — such as when network connectivity changes 133 — Android now <strong>launches the services serially</strong>, in small 134 groups, to avoid peak memory demands. 135</p> 136 137<p> 138 For developers, <span style="white-space:nowrap;">Android 4.4</span> helps 139 you deliver <strong>apps that are efficient and responsive</strong> on all 140 devices. A new API, <span style= 141 "font-size:11.5px;font-family:monospace;">ActivityManager.isLowRamDevice()</span>, 142 lets you tune your app's behavior to match the device's memory configuration. 143 You can modify or disable large-memory features as needed, depending on the 144 use-cases you want to support on entry-level devices. Learn more about 145 optimizing your apps for low-memory devices <a 146 href="{@docRoot}training/articles/memory.html">here</a>. 147</p> 148 149<p> 150 New tools 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:490px;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://developers.google.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 start and stop recording on a device that's 616 connected to your Android SDK environment over USB. It's a great new way to 617 create walkthroughs and tutorials for your app, testing materials, marketing 618 videos, and more. 619</p> 620 621<p> 622 With the screen recording utility, you can capture video of your device screen 623 contents and store the video as an MP4 file on the device. You can record at any 624 device-supported resolution and bitrate you want, and the output retains the 625 aspect ratio of the display. By default, the utility selects a resolution 626 equal or close to the device's display resolution in the current orientation. 627 When you are done recording, you can share the video directly from your 628 device or pull the MP4 file to your host computer for post-production. 629</p> 630 631<p> 632 If your app plays video or other protected content that you don’t want to be 633 captured by the screen recorder, you can use <span style= 634 "font-size:11.5px;font-family:monospace;white-space:nowrap;">SurfaceView.setSecure()</span> 635 to mark the content as secure. 636</p> 637 638<p> 639 You can access screen recording through the adb tool included in the Android 640 SDK, using the command <span style= 641 "font-size:11.5px;font-family:monospace;white-space:nowrap;">adb shell 642 screenrecord</span>. You can also launch it through the DDMS panel in Android 643 Studio. 644</p> 645 646<h4 id="44-adaptive-playback">Resolution switching through adaptive playback</h4> 647 648<p> 649 <span style="white-space:nowrap;">Android 4.4</span> brings formal support 650 for adaptive playback into the Android media framework. Adaptive playback is 651 an optional feature of video decoders for MPEG-DASH and other formats that 652 enables <strong>seamless change in resolution during playback</strong>. The 653 client can start to feed the decoder input video frames of a new resolution 654 and the resolution of the output buffers change automatically, and without a 655 significant gap. 656</p> 657 658<p> 659 Resolution switching in <span style="white-space:nowrap;">Android 4.4</span> 660 lets media apps offer a significantly better streaming video experience. Apps 661 can check for adaptive playback support at runtime using existing APIs and 662 implement resolution-switching using new APIs introduced in <span style= 663 "white-space:nowrap;">Android 4.4</span>. 664</p> 665 666<h4 id="44-cenc">Common Encryption for DASH</h4> 667 668<p> 669 Android now supports the <strong>Common Encryption (CENC)</strong> for 670 MPEG-DASH, providing a standard, multiplatform DRM scheme for managing 671 protecting content. Apps can take advantage of CENC through Android's modular 672 DRM framework and platform APIs for supporting DASH. 673</p> 674 675<h4 id="44-hls">HTTP Live Streaming</h4> 676 677<p> 678 <span style="white-space:nowrap;">Android 4.4</span> updates the platform's 679 HTTP Live Streaming (HLS) support to a superset of version 7 of the HLS 680 specification (version 4 of the protocol). See the <a href= 681 "http://tools.ietf.org/html/draft-pantos-http-live-streaming-07" class= 682 "external-link">IETF draft</a> for details. 683</p> 684<h4 id="44-audio-tunneling">Audio Tunneling to DSP</h4> 685 686<p> 687 For high-performance, lower-power audio playback, <span style= 688 "white-space:nowrap;">Android 4.4</span> adds platform support for 689 audio tunneling to a digital signal processor (DSP) in the 690 device chipset. With tunneling, audio decoding and output effects are 691 off-loaded to the DSP, waking the application processor less often and using 692 less battery. 693</p> 694 695<p> 696 Audio tunneling can <strong>dramatically improve battery life</strong> for 697 use-cases such as listening to music over a headset with the screen off. For 698 example, with audio tunneling, Nexus 5 offers a total off-network audio 699 playback time of up to 60 hours, an increase of over 50% over non-tunneled 700 audio. 701</p> 702 703<p> 704 Media applications can take advantage of audio tunneling on supported devices 705 without needing to modify code. The system applies tunneling to optimize 706 audio playback whenever it's available on the device. 707</p> 708 709<div style="float:right;padding-top:1em;width:372px;margin-left:2em;"> 710 <img src="{@docRoot}images/kk-loudnessEnhancerAnnotated.png" alt= 711 "Visualizer showing loudness enhancer audio effect" width="360" height="252" 712 style="border:1px solid #ddd;border-radius: 6px;"> 713 <p class="img-caption" style="margin-left:6px;line-height:1.25em;"> 714 Visualization of how the LoudnessEnhancer effect can make speech content 715 more audible. 716 </p> 717</div> 718 719<p> 720 Audio tunneling requires support in the device hardware. Currently audio 721 tunneling is available on Nexus 5 and we're working with our chipset partners 722 to make it available on more devices as soon as possible. 723</p> 724 725<h4 id="44-audio-monitoring">Audio monitoring</h4> 726 727<p> 728 Apps can use new monitoring tools in the Visualizer effect to get updates on 729 the <strong>peak and RMS levels</strong> of any currently playing audio on 730 the device. For example, you could use this creatively in music visualizers 731 or to implement playback metering in a media player. 732</p> 733 734<h4 id="44-loudness">Loudness enhancer</h4> 735 736<p> 737 Media playback applications can <strong>increase the loudness of spoken 738 content</strong> by using the new LoudnessEnhancer effect, which acts as 739 compressor with time constants that are specifically tuned for speech. 740</p> 741 742<h4 id="44-audio-timestamps">Audio timestamps for improved AV sync</h4> 743 744<p> 745 The audio framework can now report <strong>presentation timestamps</strong> 746 from the audio output HAL to applications, for better audio-video 747 synchronization. Audio timestamps let your app determine when a specific 748 audio frame will be (or was) presented off-device to the user; you can use 749 the timestamp information to more accurately synchronize audio with video 750 frames. 751</p> 752 753<h4 id="44-miracast">Wi-Fi CERTIFIED Miracast™</h4> 754 755<p> 756 <span style="white-space:nowrap;">Android 4.4</span> devices can now be 757 certified to the Wi-Fi Alliance Wi-Fi Display Specification as Miracast 758 compatible. To help with testing, a new Wireless Display developer option 759 exposes advanced configuration controls and settings for Wireless Display 760 certification. You can access the option at <strong>Settings > Developer 761 options > Wireless display certification</strong>. Nexus 5 is a Miracast 762 certified wireless display device. 763</p> 764 765<h2 id="44-renderscript">RenderScript Compute</h2> 766 767<div style="float:right;padding-top:1em;width:372px;margin-left:2em;"> 768 <img src="{@docRoot}images/kk-rs-chart-versions.png" alt= 769 "Renderscipt optimizations chart" width="360" height="252" style= 770 "border:1px solid #ddd;border-radius: 6px;"> 771 <p class="img-caption" style="margin-left:6px;line-height:1.25em;"> 772 Performance benchmarks for Android 4.4 relative to Android 4.3, 773 run on the same devices (Nexus 7, Nexus 10). 774 </p> 775</div> 776 777<h4>Ongoing performance improvements</strong></h4> 778 779<p> 780 When your apps use RenderScript, they'll benefit from <strong>ongoing 781 performance tuning</strong> in the RenderScript runtime itself, without the 782 need for recompilation. The chart at right shows performance gains in Android 783 4.4 on two popular chipsets. 784</p> 785 786<h4>GPU acceleration</h4> 787 788<p> 789 Any app using RenderScript on a supported device benefits from GPU 790 acceleration, without code changes or recompiling. Since the Nexus 10 first 791 debuted RenderScript GPU acceleration, various other hardware partners have 792 added support. 793</p> 794 795<p> 796 Now with <span style="white-space:nowrap;">Android 4.4</span>, GPU 797 acceleration is available on the Nexus 5, as well as the Nexus 4, Nexus 7 798 (2013), and Nexus 10, and we're working with our partners to bring it to more 799 devices as soon as possible. 800</p> 801 802<h4 id="44-renderscript-ndk">RenderScript in the Android NDK</h4> 803 804<p> 805 Now you can take advantage of RenderScript <strong>directly from your native 806 code</strong>. A new C++ API in the Android Native Development Kit (NDK) lets 807 you access the same RenderScript functionality available through the 808 framework APIs, including script intrinsics, custom kernels, and more. 809</p> 810 811<p> 812 If you have large, performance-intensive tasks to handle in native code, you 813 can perform those tasks using RenderScript and integrate them with your 814 native code. RenderScript offers great performance across a wide range of 815 devices, with automatic support for multi-core CPUs, GPUs, and other 816 processors. 817</p> 818 819<p> 820 When you build an app that uses the RenderScript through the NDK, you can 821 distribute it to any device running Android 2.2 or or higher, just like with 822 the RenderScript support library available for framework APIs. 823</p> 824 825 826<h2 id="44-graphics">Graphics</h2> 827 828<h4 id="44-surfaceflinger">GLES2.0 SurfaceFlinger</h4> 829 830<p> 831 <span style="white-space:nowrap;">Android 4.4</span> upgrades its 832 SurfaceFlinger from OpenGL ES 1.0 to OpenGL ES 2.0. 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 The <strong>Force RTL layout</strong> option makes 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">Force RTL Layout</h4> 1006 1007<p> 1008 To make it easier to test and debug layout mirroring issues without switching 1009 to an RTL language, Android includes a new developer option to force RTL layout 1010 direction in all apps. 1011</p> 1012 1013<p> 1014 The Force RTL layout option switches the device to RTL layout for all locales and 1015 displays text in your current language. This can help you find layout issues 1016 across your app, without having to display the app in an RTL language. You 1017 can access the option in <strong>Settings > Developer 1018 options > Force RTL layout direction</strong>. 1019</p> 1020 1021 1022<h2 id="44-security">Security enhancements</h2> 1023 1024<h4 id="44-selinux">SELinux (enforcing mode)</h4> 1025 1026<p> 1027 <span style="white-space:nowrap;">Android 4.4</span> updates its SELinux 1028 configuration from "permissive" to "enforcing." This means potential policy 1029 violations within a SELinux domain that has an enforcing policy will be 1030 blocked. 1031</p> 1032 1033<h4 id="44-crytpo">Improved cryptographic algorithms</h4> 1034 1035<p> 1036 Android has improved its security further by adding support for two more 1037 cryptographic algorithms. Elliptic Curve Digital Signature Algorithm (ECDSA) 1038 support has been added to the keystore provider improving security of digital 1039 signing, applicable to scenarios such as signing of an application or a data 1040 connection. The Scrypt key derivation function is implemented to protect the 1041 cryptographic keys used for full-disk encryption. 1042</p> 1043 1044<h4 id="44-other">Other enhancements</h4> 1045 1046<p> 1047 On multiuser devices, VPNs are now applied per user. This can allow a user to 1048 route all network traffic through a VPN without affecting other users on the 1049 device. Also, Android now supports FORTIFY_SOURCE level 2, and all code is 1050 compiled with those protections. FORTIFY_SOURCE has been enhanced to work 1051 with clang. 1052</p> 1053 1054 1055<h2 id="44-tools">Tools for analyzing memory use</h2> 1056 1057<h4 id="44-procstats">Procstats</h4> 1058 1059<p> 1060 A new tool called <strong>procstats</strong> helps you analyze the memory 1061 resources your app uses, as well as the resources used by other apps and 1062 services running on the system. 1063</p> 1064 1065<p> 1066 Procstats keeps track of <strong>how apps are running over time</strong>, 1067 providing data about their execution durations and memory use to help 1068 determine how efficiently they are performing. This is most important for 1069 apps that start services that run in the background, since it lets you 1070 monitor how long they are running and how much RAM they are using while doing 1071 so. Procstats will also collect data for foreground applications about memory 1072 use over time to determine the overall memory profile of the app. 1073</p> 1074 1075<p> 1076 Procstats can help you identify background services started by your app. You 1077 can keep track of how long those services continue running and how much RAM 1078 they use while doing so. Procstats also lets you profile your app while it's 1079 in the foreground, using its memory use over time to determine its overall 1080 memory profile. 1081</p> 1082 1083<div style="margin:2em 0em;width:780px;"> 1084 <div style="float:left;width:390px;"> 1085 <img src="{@docRoot}images/kk-procstats.png" alt="" width="360" style= 1086 "margin-bottom:0;box-shadow: 3px 10px 18px 1px #eee;border:1px solid #ddd;border-radius: 6px;"> 1087 <p class="img-caption" style= 1088 "padding-top:1.5em;line-height:1.25em;width:360px;"> 1089 The new <strong>procstats</strong> tool lets you check the memory use of 1090 apps and services over time. 1091 </p> 1092 </div> 1093 1094 <div style="float:right;width:390px;"> 1095 <img src="{@docRoot}images/kk-meminfo.png" alt="" width="360" style= 1096 "margin-bottom:0;box-shadow: 3px 10px 12px 1px #eee;border:1px solid #ddd;border-radius: 6px;"> 1097 <p class="img-caption" style= 1098 "padding-top:1.5em;line-height:1.25em;width:360px;"> 1099 The enhanced <strong>meminfo</strong> tool lets you see details of memory 1100 use for an app. 1101 </p> 1102 </div> 1103</div> 1104 1105<p style="clear:both;"> 1106 You can access procstats from the adb tool included in the Android SDK, 1107 <span style="font-size:11.5px;font-family:monospace;white-space:nowrap;">adb 1108 shell dumpsys procstats</span>. Also, for on-device profiling, see the 1109 Process Stats developer option, below. 1110</p> 1111 1112 1113<h4 id="44-procstats-ondevice" style="clear:both">On-device memory status and profiling</h4> 1114 1115<p> 1116 <span style="white-space:nowrap;">Android 4.4</span> includes a new developer 1117 option to make it easier to analyze your app's memory profile while it's 1118 running on any device or emulator. It's especially useful to get a view of 1119 how your app uses memory and performs on devices with low RAM. You can access 1120 the option at <strong>Settings > Developer options > Process 1121 stats</strong> 1122</p> 1123 1124<div style="float:right;margin:22px 0px 0px 24px;width:490px;"> 1125 <img src="{@docRoot}images/kk-proc-device-overview-n5.jpg" alt="" width="240" style= 1126 "margin-bottom:0;"> <img src="{@docRoot}images/kk-proc-device-detail-n5.jpg" alt="" 1127 width="240" style="margin-bottom:0;padding-left:6px;"> 1128 <p class="img-caption" style= 1129 "padding-top:1.5em;margin-left:6px;line-height:1.25em;width:480px;"> 1130 <strong>Process stats</strong> is a convenient way to check your app's 1131 memory use. You can see how your app compares to other apps and zoom in on 1132 specific data about your app or it's background services. 1133 </p> 1134</div> 1135 1136<p> 1137 The <strong>Process Stats</strong> option shows you a variety of high-level 1138 metrics on your app's memory use, based on data collected using the new 1139 procstats service. On the main screen you can see a summary of system memory 1140 status. Green indicates relative amount of time spent with low RAM usage, 1141 yellow indicates moderate RAM usage, and red indicates high (critical) RAM 1142 usage 1143</p> 1144 1145<p> 1146 Below the summary is a list summarizing each app's <strong>memory load on the 1147 system</strong>. For each app, a blue bar indicates the relative computed 1148 memory load (runtime x avg_pss) of its process, and a percentage number 1149 indicates the relative amount of time spent in the background. You can filter 1150 the list to show only foreground, background, or cached processes, and you 1151 can include or exclude system processes. You can also change the duration of 1152 the data collected to 3, 6, 12, or 24 hours, and you can include or exclude 1153 uss memory. 1154</p> 1155 1156<p> 1157 To take a closer look at a specific app's memory usage in isolation, tap the 1158 app. For each app, you can now see a summary of the memory consumed and the 1159 percentage of the collection interval that the app has been running. You can 1160 also see the average and maximum usage over the collection period, and below 1161 the app's services and the percentage of time they've been running. 1162</p> 1163 1164<p> 1165 Analyzing your app using the data in Process Stats can reveal issues and 1166 suggest possible optimizations for your app. For example, if your app is 1167 running longer than it should or using too much memory over a period of time, 1168 there could be bugs in your code that you can resolve to improve your app's 1169 performance, especially when running on a device with low RAM. 1170</p> 1171 1172</div><!-- END ANDROID 4.4 --> 1173