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