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