blob: 478f068670c22acb5a4c77ff2834bdf74b29d1b6 [file] [log] [blame]
Trevor Johns682c24e2016-04-12 10:13:47 -07001page.title=Android N for Developers
2meta.tags="preview", "androidn"
3page.tags="preview", "developer preview"
4page.image=images/cards/card-n-apis_2x.png
Joe Fernandez306f1ce2015-05-01 12:51:21 -07005@jd:body
6
7
Trevor Johns682c24e2016-04-12 10:13:47 -07008
9
Joe Fernandez306f1ce2015-05-01 12:51:21 -070010<div id="qv-wrapper">
11<div id="qv">
Trevor Johns682c24e2016-04-12 10:13:47 -070012 <h2>Key developer features</h2>
13 <ol>
14 <ul style="list-style-type:none;">
15 <li><a href="#multi-window_support">Multi-window support</a></li>
16 <li><a href="#notification_enhancements">Notifications</a></li>
17 <li><a href="#jit_aot">JIT/AOT compilation</a></li>
18 <li><a href="#quick_path_to_app_install">Quick path to app install</a></li>
19 <li><a href="#doze_on_the_go">Doze on the go</a></li>
20 <li><a href="#background_optimizations">Background optimizations</a></li>
21 <li><a href="#data_saver">Data Saver</a></li>
22 <li><a href="#tile_api">Quick Settings Tile API</a></li>
23 <li><a href="#number-blocking">Number-blocking</a></li>
24 <li><a href="#call_screening">Call screening</a></li>
25 <li><a href="#multi-locale_languages">Locales and languages</a></li>
26 <li><a href="#icu4">ICU4J APIs in Android</a></li>
27 <li><a href="#gles_32">OpenGL ES 3.2 API</a></li>
28 <li><a href="#android_tv_recording">Android TV recording</a></li>
29 <li><a href="#android_for_work">Android for Work</a></li>
30 <li><a href="#accessibility_enhancements">Accessibility</a></li>
31 <li><a href="#direct_boot">Direct Boot</a></li>
32 <li><a href="#key_attestation">Key Attestation</a></li>
33 <li><a href="#network_security_config">Network Security Config</a></li>
34 <li><a href="#default_trusted_ca">Default Trusted CA</a></li>
35 <li><a href="apk_signature_v2">APK signature scheme v2</a></li>
36 <li><a href="#scoped_directory_access">Scoped directory access</a></li>
37 </ol>
Joe Fernandez306f1ce2015-05-01 12:51:21 -070038</div>
39</div>
40
Trevor Johns682c24e2016-04-12 10:13:47 -070041
42
43<p>Android N is still in active development, but you can try it
44now as part of the N Developer Preview. The sections below highlight some of
45the new features for developers. </p>
Joe Fernandez306f1ce2015-05-01 12:51:21 -070046
Joe Fernandezbd4ed322015-08-16 16:56:02 -070047<p>
Trevor Johns682c24e2016-04-12 10:13:47 -070048 Make sure to check out the <a href=
49 "{@docRoot}preview/behavior-changes.html">Behavior Changes</a> to learn about
50 areas where platform changes may affect your apps, take a look at the
51 developer guides to learn more about key features, and download the <a href=
52 "{@docRoot}preview/setup-sdk.html#docs-dl">API Reference</a> for details on
53 new APIs.
Joe Fernandezbd4ed322015-08-16 16:56:02 -070054</p>
Joe Fernandez306f1ce2015-05-01 12:51:21 -070055
Trevor Johns682c24e2016-04-12 10:13:47 -070056<h2 id="multi-window_support">Multi-window support</h2>
Joe Fernandez306f1ce2015-05-01 12:51:21 -070057
Joe Fernandezbd4ed322015-08-16 16:56:02 -070058
Trevor Johns682c24e2016-04-12 10:13:47 -070059<p>In Android N, we're introducing a new and much-requested multitasking feature
60into the platform &mdash; multi-window support. </p>
Joe Fernandez306f1ce2015-05-01 12:51:21 -070061
Trevor Johns682c24e2016-04-12 10:13:47 -070062 <p>Users can now pop open two apps on the screen at once. </p>
Joe Fernandeza06ac3a2015-05-15 15:42:17 -070063 <ul>
Trevor Johns682c24e2016-04-12 10:13:47 -070064 <li>On phones and tablets
65running Android N, users can run two apps side-by-side or
66one-above-the-other in splitscreen mode. Users can resize the apps by dragging
67the divider between them. </li>
68
69<li>On Android TV devices, apps can put themselves in <a
70href="{@docRoot}preview/features/picture-in-picture.html">picture-in-picture
71mode</a>, allowing them to continue showing content while the user browses or
72interacts with other apps.</li>
Joe Fernandeza06ac3a2015-05-15 15:42:17 -070073 </ul>
Trevor Johns682c24e2016-04-12 10:13:47 -070074
75<div class="col-4of10">
76<img src="{@docRoot}preview/images/mw-portrait.png" alt="" style="height:460px;padding-left:1em;"
77 id="img-split-screen" />
78<p class="img-caption">
79 <strong>Figure 1.</strong> Apps running in split-screen mode.
80</p>
81 </div>
82
83<p>Especially on tablets and other larger-screen devices, multi-window support
84gives you new ways to engage users. You can even enable drag-and-drop in
85your app to let users conveniently drag content to or from your app &mdash; a great
86way to enhance your user experience. </p>
87
88<p>It's straightforward to add multi-window support to your app and configure how it
89handles multi-window display. For example, you can specify your activity's
90minimum allowable dimensions, preventing users from resizing the activity below
91that size. You can also disable multi-window display for your app, which
92 ensures that the system will only show your app in full-screen mode.</p>
93
94<p>
95 For more information, see the <a href=
96 "{@docRoot}preview/features/multi-window.html">Multi-Window Support</a>
97 developer documentation.
98</p>
99
100<h2 id="notification_enhancements">Notification enhancements</h2>
101
102<p>In Android N we've redesigned notifications to make them easier and faster to
103use. Some of the changes include:</p>
104
Joe Fernandeza06ac3a2015-05-15 15:42:17 -0700105<ul>
Trevor Johns682c24e2016-04-12 10:13:47 -0700106 <li>
107 <strong>Template updates</strong>: We're updating notification templates to
108 put a new emphasis on hero image and avatar. Developers will be able to
109 take advantage of the new templates with minimal adjustments in their code.
110 </li>
111
112 <li>
113 <strong>Bundled notifications</strong>: The system can group messages
114 together, for example by message topic, and display the group. A user can
115 take actions, such as Dismiss or Archive, on them in place. If you’ve
116 implemented notifications for Android Wear, you’ll already be familiar with
117 this model.
118 </li>
119
120 <li>
121 <strong>Direct reply</strong>: For real-time communication apps, the
122 Android system supports inline replies so that users can quickly respond to
123 an SMS or text message directly within the notification interface.
124 </li>
125
126 <li>
127 <strong>Custom views</strong>: Two new APIs enable you to leverage system
128 decorations, such as notification headers and actions, when using custom
129 views in notifications.
130 </li>
Joe Fernandeza06ac3a2015-05-15 15:42:17 -0700131</ul>
Joe Fernandez306f1ce2015-05-01 12:51:21 -0700132
Trevor Johns682c24e2016-04-12 10:13:47 -0700133<div class="col-4of12">
134 <img src="{@docRoot}preview/images/notifications-1.png" alt=""
135 style="padding:.5em;max-width:226px">
136</div>
137
138<div class="col-4of12">
139 <img src="{@docRoot}preview/images/notifications-3.png" alt=""
140 style="padding:.5em;max-width:226px">
141</div>
142
143<div class="col-4of12">
144 <img src="{@docRoot}preview/images/notifications-2.png" alt=""
145 style="padding:.5em;max-width:226px">
146</div>
147
148
149<p class="img-caption">
150 <strong>Figure 2.</strong> Bundled notifications and direct reply.
Glenn Kastendedc7682015-05-29 08:11:24 -0700151</p>
Trevor Johns682c24e2016-04-12 10:13:47 -0700152
153<p>To learn how to implement the new features, see the
154 <a href="{@docRoot}preview/features/notification-updates.html">Notifications</a>
155 guide.</p>
156
157
158
159<h2 id="jit_aot">Profile-guided JIT/AOT compilation</h2>
160
161<p>In Android N, we've added a Just in Time (JIT) compiler with code profiling to
162ART, which lets it constantly improve the performance of Android apps as they
163run. The JIT compiler complements ART's current Ahead of Time (AOT) compiler
164and helps improve runtime performance, save storage space, and speed up app
165updates and system updates.</p>
166
167<p>Profile-guided compilation lets ART manage the AOT/JIT compilation for each app
168according to its actual usage, as well as conditions on the device. For
169example, ART maintains a profile of each app's hot methods and can precompile
170and cache those methods for best performance. It leaves other parts of the app
171uncompiled until they are actually used.</p>
172
173<p>Besides improving performance for key parts of the app, profile-guided
174compilation helps reduce an app's overall RAM footprint, including associated
175binaries. This feature is especially important on low-memory devices.</p>
176
177<p>ART manages profile-guided compilation in a way that minimizes impact on the
178device battery. It does precompilation only when then the device is idle and
179charging, saving time and battery by doing that work in advance.</p>
180
181<h2 id="quick_path_to_app_install">Quick path to app install</h2>
182
183<p>One of the most tangible benefits of ART's JIT compiler is the speed of app
184installs and system updates. Even large apps that required several minutes to
185optimize and install in Android 6.0 can now install in just a matter of
186seconds. System updates are also faster, since there's no more optimizing step. </p>
187
188<h2 id="doze_on_the_go">Doze on the go...</h2>
189
190<p>Android 6.0 introduced Doze, a system mode that saves battery by deferring
191apps' CPU and network activities when the device is idle, such as when it's
192sitting on a table or in a drawer. </p>
193
194<p>Now in Android N, Doze takes a step further and saves battery while on the go.
195Any time the screen is off for a period of time and the device is unplugged,
196Doze applies a subset of the familiar CPU and network restrictions to apps.
197This means users can save battery even when carrying their devices in their
198pockets.</p>
199
200
201<img src="/preview/images/doze-diagram-1.png"
202 alt="" id="figure1" />
203<p class="img-caption">
204 <strong>Figure 3.</strong> Doze now applies
205 restrictions to improve battery life even when the device is not stationary.
206</p>
207
208
209<p>A short time after the screen turns off while the device is on battery, Doze
210restricts network access and defers jobs and syncs. During brief maintenance
211windows, applications are allowed network access and any of their deferred
212jobs/syncs are executed. Turning the screen on or plugging in the device brings
213the device out of Doze.</p>
214
215<p>When the device is stationary again, with screen off and on battery for a
216period of time, Doze applies the full CPU and network restrictions on {@link
217android.os.PowerManager.WakeLock}, {@link android.app.AlarmManager} alarms, and
218GPS/Wi-Fi scans.</p>
219
220<p>The best practices for adapting your app to Doze are the same whether the
221device is moving or not, so if you already updated your app to gracefully
222handle Doze, you're all set. If not, start <a
223href="{@docRoot}training/monitoring-device-state/doze-standby.html#assessing_your_app">adapting
224your app to Doze</a> now.</p>
225
226<h2 id="background_optimizations">Project Svelte: Background optimizations</h2>
227
228<p>Project Svelte is an ongoing effort to minimize RAM use by system and apps
229across the range of Android devices in the ecosystem. In Android N, Project
230Svelte is focused on optimizing the way apps run in the background. </p>
231
232<p>Background processing is an essential part of most apps. When handled right, it
233can make your user experience amazing &mdash; immediate, fast, and context-aware.
234When not handled right, background processing can needlessly consume RAM (and
235battery) and affect system performance for other apps. </p>
236
237<p>Since Android 5.0, {@link android.app.job.JobScheduler} has been the
238preferred way of performing background work in a way that's good
239for users. Apps can schedule jobs while letting the system optimize based on
240memory, power, and connectivity conditions. JobScheduler offers control and
241simplicity, and we want all apps to use it. </p>
242
243<p>
244 Another good option is <a href=
245 "https://developers.google.com/android/reference/com/google/android/gms/gcm/GcmNetworkManager">
246 <code>GCMNetworkManager</code></a>, part of Google Play Services, which
247 offers similar job scheduling with compatibility across legacy versions of
248 Android.
249</p>
250
251<p>We're continuing to extend <code>JobScheduler</code> and
252<code>GCMNetworkManager</code> to meet more of
253your use cases &mdash; for example, in Android N you can now schedule background
254work based on changes in Content Providers. At the same time we're starting to
255deprecate some of the older patterns that can reduce system performance,
256especially on low-memory devices.</p>
257
258<p>In Android N we're removing three commonly-used implicit broadcasts &mdash;
259 {@link android.net.ConnectivityManager#CONNECTIVITY_ACTION}, {@link
260 android.hardware.Camera#ACTION_NEW_PICTURE}, and {@link
261 android.hardware.Camera#ACTION_NEW_VIDEO} &mdash; since those can wake the
262background processes of multiple apps at once and strain memory and battery. If
263your app is receiving these, take advantage of the N Developer Preview to
264 migrate to <code>JobScheduler</code> and related APIs instead. </p>
265
266<p>
267 Take a look at the <a href=
268 "{@docRoot}preview/features/background-optimization.html">Background
269 Optimizations</a> documentation for details.
270</p>
271
272
273<h2 id="data_saver">Data Saver</h2>
274
275<div class="col-5of12" style="margin-right:1.5em;">
276<img src="{@docRoot}preview/images/datasaver.png" style="border:2px solid #ddd">
277
278<p class="img-caption" style="padding-right:2em;">
279 <strong>Figure 4.</strong> Data Saver in Settings.
280</p>
281 </div>
282
283<p>Over the life of a mobile device, the cost of a cellular data plan typically
284exceeds the cost of the device itself. For many users, cellular data is an
285expensive resource that they want to conserve. </p>
286
287<p>Android N introduces Data Saver mode, a new system service that helps reduce
288cellular data use by apps, whether roaming, near the end of the billing cycle,
289or on a small prepaid data pack. Data Saver gives users control over how apps
290use cellular data and lets developers provide more efficient service when Data
291Saver is on. </p>
292
293<p>When a user enables Data Saver in <strong>Settings</strong> and the device is
294on a metered network, the system blocks background data usage and signals apps
295to use less data in the foreground wherever possible &mdash; such as by limiting
296bit rate for streaming, reducing image quality, deferring optimistic precaching,
297and so on. Users can whitelist specific apps to allow background metered data
298usage even when Data Saver is turned on.</p>
299
300<p>Android N extends the {@link android.net.ConnectivityManager} to provide apps a
301way to <a href="{@docRoot}preview/features/data-saver.html#status">retrieve the
302user's Data Saver preferences</a> and <a
303href="{@docRoot}preview/features/data-saver.html#monitor-changes">monitor
304preference changes</a>. All apps should check whether the user has enabled Data
305Saver and make an effort to limit foreground and background data usage.</p>
306
307
308<h2 id="tile_api">Quick Settings Tile API</h2>
309
310
311<div style="float:right;max-width:320px">
312<img src="{@docRoot}preview/images/quicksettings.png" style="padding-left:1.5em;">
313
314<p class="img-caption" style="padding-left:2em;">
315 <strong>Figure 5.</strong> Quick Settings tiles in the notification shade.
316</p>
317
318
319 </div><p>Quick Settings is a popular and simple way to expose key settings and actions,
320directly from the notification shade. In Android N, we've expanded the scope of
321Quick Settings to make it even more useful and convenient. </p>
322
323<p>We've added more room for additional Quick Settings tiles, which users can
324access across a paginated display area by swiping left or right. We've also
325given users control over what Quick Settings tiles appear and where they are
326displayed &mdash; users can add or move tiles just by dragging and dropping them. </p>
327
328<p>For developers, Android N also adds a new API that lets you define your own
329 Quick Settings tiles to give users easy access to key controls and actions in your app.</p>
330
331<p>
332 Quick Settings tiles are reserved for controls or actions that are either
333 urgently required or frequently used, and should not be used as shortcuts to
334 launching an app.
335</p>
336
337<p>
338 Once you’ve defined your tiles, you can surface them to users, who can add
339 them to Quick Settings just by drag and drop.
340</p>
341
342<p>
343 For information about creating an app tile, see the
344 <code>android.service.quicksettings.Tile</code> in the downloadable <a href=
345 "{@docRoot}preview/setup-sdk.html#docs-dl">API Reference</a>.
346</p>
347
348
349
350<h2 id="number-blocking">Number-blocking</h2>
351
352<p>Android N now supports number-blocking in the platform and provides a
353framework API to let service providers maintain a blocked-number list. The
354default SMS app, the default phone app, and carrier apps can read from and
355write to the blocked-number list. The list is not accessible to other apps.</p>
356
357<p>By making number-blocking a standard feature of the platform, Android provides
358a consistent way for apps to support number-blocking across a wide range of
359devices. Among the other benefits that apps can take advantage of are:</p>
360
361<ul>
362 <li> Numbers blocked on calls are also blocked on texts
363 <li> Blocked numbers can persist across resets and devices through the Backup &amp;
364Restore feature
365 <li> Multiple apps can use the same blocked numbers list
366</ul>
367
368<p>Additionally, carrier app integration through Android means that carriers can
369read the blocked numbers list on the device and perform service-side blocking
370for the user in order to stop unwanted calls and texts from reaching the user
371through any medium, such as a VOIP endpoint or forwarding phones.</p>
372
373<p>
374 For more information, see <code>android.provider.BlockedNumberContract</code>
375 in the downloadable <a href="{@docRoot}preview/setup-sdk.html#docs-dl">API
376 Reference</a>.
377</p>
378
379<h2 id="call_screening">Call screening</h2>
380
381<p>
382 Android N allows the default phone app to screen incoming calls. The phone
383 app does this by implementing the new <code>CallScreeningService</code>,
384 which allows the phone app to perform a number of actions based on an
385 incoming call's {@link android.telecom.Call.Details Call.Details}, such as:
386</p>
387
388<ul>
389 <li> Reject the incoming call
390 <li> Do not allow the call to the call log
391 <li> Do not show the user a notification for the call
392</ul>
393
394<p>
395 For more information, see <code>android.telecom.CallScreeningService</code>
396 in the downloadable <a href="{@docRoot}preview/setup-sdk.html#docs-dl">API
397 Reference</a>.
398</p>
399
400
401<h2 id="multi-locale_languages">Multi-locale support, more languages</h2>
402
403
404<p>Android N now lets users select <strong>multiple locales</strong> in Settings,
405to better support bilingual use-cases. Apps can use
406a new API to get the user's selected locales and then offer more sophisticated
407user experiences for multi-locale users &mdash; such as showing search results in
408multiple languages and not offering to translate webpages in a language the
409user already knows.</p>
410
411<p>Along with multi-locale support, Android N also expands the range of languages
412available to users. It offers more than 25 variants each for commonly used
413languages such as English, Spanish, French, and Arabic. It also adds partial
414support for more than 100 new languages.</p>
415
416<p>Apps can get the list of locales set by the user by calling <code>LocaleList.GetDefault()</code>. To support the expanded number of locales, Android N is changing the way
417that it resolves resources. Make sure that you test and verify that your apps
418working as expected with the new resource resolution logic.</p>
419
420<p>To learn about the new resource-resolution behavior and the best practices you
421should follow, see <a href="{@docRoot}preview/features/multilingual-support.html"
422>Multilingual Support</a>.</p>
423
424<h2 id="icu4">ICU4J APIs in Android</h2>
425
426<p>
427 Android N now offers a subset of <a href=
428 "http://site.icu-project.org/">ICU4J</a> APIs in the Android framework under
429 the <code>android.icu</code> package. Migration is easy, and mostly entails
430 simply changing from the <code>com.java.icu</code> namespace to
431 <code>android.icu</code>. If you are already using an ICU4J bundle in your
432 apps, switching to the <code>android.icu</code> APIs provided in the Android
433 framework can produce substantial savings in APK size.
434</p>
435
436<p>
437 To learn more about the Android ICU4J APIs, see <a href=
438 "{@docRoot}preview/features/icu4j-framework.html">ICU4J Support</a>.
439</p>
440
441
442
443<h2 id="gles_32">OpenGL&trade; ES 3.2 API</h2>
444
445<p>Android N adds framework interfaces and platform support for OpenGL ES 3.2, including:</p>
446
447<ul>
448 <li> All extensions from the <a class="external-link"
449href="https://www.khronos.org/registry/gles/extensions/ANDROID/ANDROID_extension_pack_es31a.txt">Android Extension Pack</a></a> (AEP) except for <code>EXT_texture_sRGB_decode</code>.
450 <li> Floating-point framebuffers for HDR and deferred shading.
451 <li> BaseVertex draw calls to enable better batching and streaming.
452 <li> Robust buffer access control to reduce WebGL overhead.
453</ul>
454
455<p>The framework API for OpenGL ES 3.2 on Android N is provided with the
456<code>GLES32</code> class. When using OpenGL ES 3.2, be sure to declare the
457requirement in your manifest file, using the <code>&lt;uses-feature&gt;</code> tag and
458the <code>android:glEsVersion</code> attribute. </p>
459
460<p>For information about using OpenGL ES, including how to check a device's
461supported OpenGL ES version at runtime, see the <a
462href="{@docRoot}guide/topics/graphics/opengl.html">OpenGL ES API guide</a>.</p>
463
464
465<h2 id="android_tv_recording">Android TV recording</h2>
466
467<p>Android N adds the ability to record and playback content from Android TV input
468services via new recording APIs. Building on top of existing time-shifting
469APIs, TV input services can control what channel data can be recorded, how
470recorded sessions are saved, and manage user interaction with recorded content. </p>
471
472<p>For more information, see <a
473href="{@docRoot}preview/features/tv-recording-api.html">Android TV Recording APIs</a>.</p>
474
475
476<h2 id="android_for_work">Android for Work</h2>
477
478<p>Android for Work adds many new features and APIs for devices running Android N.
479Some highlights are below &mdash; for a complete list of changes, see
480<a href="{@docRoot}preview/features/afw.html">Android for Work Updates</a>.</p>
481
482<h3 id="work_profile_security_challenge">Work profile security challenge </h3>
483
484<p>
485 Profile owners can specify a separate security challenge for apps running in
486 the work profile. The work challenge is shown when a user attempts to open
487 any work apps. Successful completion of the security challenge unlocks the
488 work profile and decrypts it if necessary. For profile owners,
489 <code>ACTION_SET_NEW_PASSWORD</code> prompts the user to set a work
490 challenge, and <code>ACTION_SET_NEW_PARENT_PROFILE_PASSWORD</code> prompts
491 the user to set a device lock.
492</p>
493
494<p>
495 Profile owners can set distinct password policies for the work challenge
496 (such as how long the PIN needs to be, or whether a fingerprint can be used
497 to unlock the profile) using the <code>setPasswordQuality()</code>,
498 <code>setPasswordMinimumLength()</code> and related methods. The profile
499 owner can also set the device lock using the <code>DevicePolicyManager</code>
500 instance returned by the new <code>getParentProfileInstance()</code> method.
501 Additionally, profile owners can customize the credentials screen for the
502 work challenge using the new <code>setOrganizationColor()</code> and
503 <code>setOrganizationName()</code> methods.
504</p>
505<h3 id="turn_off_work">Turn off work </h3>
506
507<p>On a device with a work profile, users can toggle work mode. When work mode is
508off the managed user is temporarily shut down, which disables work profile
509apps, background sync, and notifications. This includes the profile owner
510application. When work mode is off, the system displays a persistent status
511icon to remind the user that they can't launch work apps. The launcher
512indicates that work apps and widgets are not accessible. </p>
513
514<h3 id="always_on_vpn">Always on VPN </h3>
515
516<p>Device owners and profile owners can ensure that work apps always connect
517through a specified VPN. The system automatically starts that VPN after the
518device boots.</p>
519
520<p>
521 New <code>DevicePolicyManager</code> methods are
522 <code>setAlwaysOnVpnPackage()</code> and
523 <code>getAlwaysOnVpnPackage()</code>.
524</p>
525
526<p>Because VPN services can be bound directly by the system without app
527interaction, VPN clients need to handle new entry points for Always on VPN. As
528before, services are indicated to the system by an intent filter matching
529action <code>android.net.VpnService</code>. </p>
530
531<p>
532 Users can also manually set Always on VPN clients that implement
533 <code>VPNService</code> methods in the primary user using
534 <strong>Settings&gt;More&gt;Vpn</strong>.
535</p>
536
537<h2 id="accessibility_enhancements">Accessibility enhancements</h2>
538
539<p>Android N now offers Vision Settings directly on the Welcome screen for new
540device setup. This makes it much easier for users to discover and configure
541accessibility features on their devices, including magnification gesture, font
542size, display size, and TalkBack. </p>
543
544<p>With these accessibility features getting more prominent placement, your users
545are more likely to try your app with them enabled. Make sure you test your apps
546early with these settings enabled. You can enable them from Settings >
547Accessibility.</p>
548
549<p>Also in Android N, accessibility services can now help users with motor
550impairments to touch the screen. The new API allows building services with
551features such as face-tracking, eye-tracking, point scanning, and so on, to
552meet the needs of those users.</p>
553
554<p>For more information, see <code>android.accessibilityservice.GestureDescription</code>
555 in the downloadable <a href="{@docRoot}preview/setup-sdk.html#docs-dl">API Reference</a>.</p>
556
557
558<h2 id="direct_boot">Direct boot</h2>
559
560<p>Direct boot improves device startup times and lets registered
561apps have limited functionality even after an unexpected reboot.
562For example, if an encrypted device reboots while the user is sleeping,
563registered alarms, messages and incoming calls can now continue notify
564the user as normal. This also means accessibility services can also be
565 available immediately after a restart.</p>
566
567<p>Direct boot takes advantage of file based encryption in Android N
568to enable fine grained encryption policies for both system and app data.
569The system uses a device-encrypted store for select system data and explicitly
570registered app data. By default a credential-encrypted store is used for all
571 other system data, user data, apps, and app data. </p>
572
573<p>At boot, the system starts in a restricted mode with access to
574device-encrypted data only, and without general access to apps or data.
575If you have components that you want to run in this mode, you can register
576them by setting a flag in the manifest. After restart, the system activates
577registered components by broadcasting the <code>LOCKED_BOOT_COMPLETED</code>
578intent. The system ensures registered device-encrypted app data is available
579before unlock. All other data is unavailable until the User confirms their lock
580 screen credentials to decrypt it. </p>
581
582For more information, see <a href="{@docRoot}preview/features/direct-boot.html">Direct Boot</a>.</p>
583</p>
584
585
586<h2 id="key_attestation">Key Attestation</h2>
587
588<p>Hardware-backed keystores provide a much safer method to create, store,
589and use cryptographic keys on Android devices. They protect keys from the
590Linux kernel, potential Android vulnerabilities, and extraction
591from rooted devices.</p>
592
593<p>To make it easier and more secure to use hardware-backed keystores,
594Android N introduces Key Attestation. Apps and off-devices can use Key
595Attestation to strongly determine whether an RSA or EC key pair is
596hardware-backed, what the properties of the key pair are, and what
597 constraints are applied to its usage and validity. </p>
598
599<p>Apps and off-device services can request information about a key pair
600through an X.509 attestation certificate which must be signed by a valid
601attestation key. The attestation key is an ECDSA signing key which is
602injected into the device’s hardware-backed keystore at the factory.
603Therefore, an attestation certificate signed by a valid attestation
604key confirms the existence of a hardware-backed keystore, along with
605 details of key pairs in that keystore.</p>
606
607<p>To ensure that the device is using a secure, official Android factory
608image, Key Attestation requires that the device <a
609class="external-link"
610href="https://source.android.com/security/verifiedboot/verified-boot.html#bootloader_requirements">bootloader</a>
611provide the following information to the <a class="external-link"
612href="https://source.android.com/security/trusty/index.html">Trusted
613Execution Environment (TEE)</a>:</p>
614
615<ul>
616<li>The OS version and patch level installed on the device</li>
617<li>The <a href="https://source.android.com/security/verifiedboot/index.html"
618class="external-link" >Verified Boot</a> public key and lock status</li>
619 </ul>
620
621<p>For more information about the hardware-backed keystore feature,
622see the guide for <a href="https://source.android.com/security/keystore/"
623class="external-link">Hardware-backed Keystore</a>.</p>
624
625<p>In addition to Key Attestation, Android N also introduces
626 fingerprint-bound keys that are not revoked on fingerprint enrollment.</p>
627
628<h2 id="network_security_config">Network Security Config</h2>
629
630<p>In Android N, apps can customize the behavior of their secure (HTTPS, TLS)
631connections safely, without any code modification, by using the declarative
632<em>Network Security Config</em> instead of using the conventional
633error-prone programmatic APIs (e.g. X509TrustManager).</p>
634
635 <p>Supported features:</p>
636<ul>
637<li><b>Custom trust anchors.</b> Lets an application customize which
638Certificate Authorities (CA) are trusted for its secure connections. For
639example, trusting particular self-signed certificates or a restricted set of public CAs.
640</li>
641<li><b>Debug-only overrides.</b> Lets an application developer safely debug
642secure connections of their application without added risk to the installed
643base.
644</li>
645<li><b>Cleartext traffic opt-out.</b> Lets an application protect itself from
646accidental usage of cleartext traffic.</li>
647<li><b>Certificate pinning.</b> An advanced feature that lets an application
648 limit which server keys are trusted for secure connections.</li>
649</ul>
650
651<p>For more information, see <a
652href="{@docRoot}preview/features/security-config.html">Network Security
653Config</a>.</p>
654
655<h2 id="default_trusted_ca">Default Trusted Certificate Authority</h2>
656
657<p>By default, apps that target Android N only trust system-provided certificates
658and no longer trust user-added Certificate Authorities (CA). Apps targeting Android
659N that wish to trust user-added CAs should use the
660<a href="{@docRoot}preview/features/security-config.html">Network Security Config</a> to
661specify how user CAs should be trusted.</p>
662
663<h2 id="apk_signature_v2">APK signature scheme v2</h2>
664
665<p>The PackageManager class now supports verifying apps using the APK
666signature scheme v2. The APK signature scheme v2 is a whole-file signature scheme
667that significantly improves verification speed and strengthens integrity
668 guarantees by detecting any unauthorized changes to APK files.</p>
669
670<p>To maintain backward-compatibility, an APK must be signed with the v1 signature
671scheme (JAR signature scheme) before being signed with the v2 signature scheme.
672With the v2 signature scheme, verification fails if you sign the APK with an
673 additional certificate after signing with the v2 scheme. </p>
674
675<p>APK signature scheme v2 support will be available later in the N Developer
676Preview.</p>
677
678<h2 id="scoped_directory_access">Scoped directory access</h2>
679
680<p>In Android N, apps can use new APIs to request access to specific <a
681href="{@docRoot}guide/topics/data/data-storage.html#filesExternal">external
682storage</a> directories, including directories on removable media such as SD
683cards. The new APIs greatly simplify how your application accesses standard
684external storage directories, such as the <code>Pictures</code> directory. Apps
685like photo apps can use these APIs instead of using
686<code>READ_EXTERNAL_STORAGE</code>, which grants access to all storage
687directories, or the Storage Access Framework, which makes the user navigate to
688the directory.</p>
689
690<p>Additionally, the new APIs simplify the steps a user takes to grant external
691storage access to your app. When you use the new APIs, the system uses a simple
692permissions UI that clearly details what directory the application is
693requesting access to.</p>
694
695<p>For more information, see the
696<a href="{@docRoot}preview/features/scoped-folder-access.html">Scoped
697Directory Access</a> developer documentation.</p>
698
699
700
701
702
703