Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 1 | page.title=Android N for Developers |
Dirk Dougherty | 43eb951 | 2016-03-03 14:53:16 -0800 | [diff] [blame] | 2 | meta.tags="preview", "androidn" |
| 3 | page.tags="preview", "developer preview" |
Dirk Dougherty | a6495a92 | 2016-03-04 15:21:59 -0800 | [diff] [blame] | 4 | page.image=images/cards/card-n-apis_2x.png |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 5 | @jd:body |
| 6 | |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 7 | |
| 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 Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 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> |
Dirk Dougherty | 5942892 | 2016-03-10 18:54:49 -0800 | [diff] [blame] | 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> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 37 | </ol> |
| 38 | </div> |
| 39 | </div> |
| 40 | |
| 41 | |
| 42 | |
| 43 | <p>Android N is still in active development, but you can try it |
| 44 | now as part of the N Developer Preview. The sections below highlight some of |
| 45 | the new features for developers. </p> |
| 46 | |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 47 | <p> |
| 48 | 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. |
| 54 | </p> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 55 | |
| 56 | <h2 id="multi-window_support">Multi-window support</h2> |
| 57 | |
| 58 | |
| 59 | <p>In Android N, we're introducing a new and much-requested multitasking feature |
| 60 | into the platform — multi-window support. </p> |
| 61 | |
| 62 | <p>Users can now pop open two apps on the screen at once. </p> |
| 63 | <ul> |
| 64 | <li>On phones and tablets |
| 65 | running Android N, users can run two apps side-by-side or |
| 66 | one-above-the-other in splitscreen mode. Users can resize the apps by dragging |
| 67 | the divider between them. </li> |
| 68 | |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 69 | <li>On Android TV devices, apps can put themselves in <a |
| 70 | href="{@docRoot}preview/features/picture-in-picture.html">picture-in-picture |
| 71 | mode</a>, allowing them to continue showing content while the user browses or |
Daniel Yu | 0ab19aa | 2016-03-14 15:35:38 -0700 | [diff] [blame^] | 72 | interacts with other apps.</li> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 73 | </ul> |
| 74 | |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 75 | <div class="col-4of10"> |
Dirk Dougherty | 5942892 | 2016-03-10 18:54:49 -0800 | [diff] [blame] | 76 | <img src="{@docRoot}preview/images/mw-portrait.png" alt="" style="height:460px;padding-left:1em;" |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 77 | id="img-split-screen" /> |
| 78 | <p class="img-caption"> |
Dirk Dougherty | 5942892 | 2016-03-10 18:54:49 -0800 | [diff] [blame] | 79 | <strong>Figure 1.</strong> Apps running in split-screen mode. |
Dirk Dougherty | 5748bc4 | 2016-02-06 18:24:32 -0800 | [diff] [blame] | 80 | </p> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 81 | </div> |
| 82 | |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 83 | <p>Especially on tablets and other larger-screen devices, multi-window support |
| 84 | gives you new ways to engage users. You can even enable drag-and-drop in |
| 85 | your app to let users conveniently drag content to or from your app — a great |
| 86 | way to enhance your user experience. </p> |
| 87 | |
| 88 | <p>It's straightforward to add multi-window support to your app and configure how it |
| 89 | handles multi-window display. For example, you can specify your activity's |
| 90 | minimum allowable dimensions, preventing users from resizing the activity below |
| 91 | that 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 | |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 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> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 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 |
| 103 | use. Some of the changes include:</p> |
| 104 | |
| 105 | <ul> |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 106 | <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 |
Andrew Solovay | 069ac63 | 2016-03-11 11:23:27 -0800 | [diff] [blame] | 117 | this model. |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 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> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 131 | </ul> |
| 132 | |
| 133 | <div class="col-4of12"> |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 134 | <img src="{@docRoot}preview/images/notifications-1.png" alt="" |
| 135 | style="padding:.5em;max-width:226px"> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 136 | </div> |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 137 | |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 138 | <div class="col-4of12"> |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 139 | <img src="{@docRoot}preview/images/notifications-3.png" alt="" |
| 140 | style="padding:.5em;max-width:226px"> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 141 | </div> |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 142 | |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 143 | <div class="col-4of12"> |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 144 | <img src="{@docRoot}preview/images/notifications-2.png" alt="" |
| 145 | style="padding:.5em;max-width:226px"> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 146 | </div> |
| 147 | |
| 148 | |
| 149 | <p class="img-caption"> |
Adarsh Fernando | 3760156 | 2016-03-09 09:53:57 -0800 | [diff] [blame] | 150 | <strong>Figure 2.</strong> Bundled notifications and direct reply. |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 151 | </p> |
| 152 | |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 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> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 156 | |
| 157 | |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 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 |
| 162 | ART, which lets it constantly improve the performance of Android apps as they |
| 163 | run. The JIT compiler complements ART's current Ahead of Time (AOT) compiler |
| 164 | and helps improve runtime performance, save storage space, and speed up app |
| 165 | updates and system updates.</p> |
| 166 | |
| 167 | <p>Profile-guided compilation lets ART manage the AOT/JIT compilation for each app |
| 168 | according to its actual usage, as well as conditions on the device. For |
| 169 | example, ART maintains a profile of each app's hot methods and can precompile |
| 170 | and cache those methods for best performance. It leaves other parts of the app |
| 171 | uncompiled until they are actually used.</p> |
| 172 | |
| 173 | <p>Besides improving performance for key parts of the app, profile-guided |
| 174 | compilation helps reduce an app's overall RAM footprint, including associated |
| 175 | binaries. 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 |
| 178 | device battery. It does precompilation only when then the device is idle and |
| 179 | charging, saving time and battery by doing that work in advance.</p> |
| 180 | |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 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 |
| 184 | installs and system updates. Even large apps that required several minutes to |
| 185 | optimize and install in Android 6.0 can now install in just a matter of |
| 186 | seconds. 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 |
| 191 | apps' CPU and network activities when the device is idle, such as when it's |
| 192 | sitting 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. |
| 195 | Any time the screen is off for a period of time and the device is unplugged, |
| 196 | Doze applies a subset of the familiar CPU and network restrictions to apps. |
| 197 | This means users can save battery even when carrying their devices in their |
| 198 | pockets.</p> |
| 199 | |
| 200 | |
Dirk Dougherty | 5942892 | 2016-03-10 18:54:49 -0800 | [diff] [blame] | 201 | <img src="/preview/images/doze-diagram-1.png" |
| 202 | alt="" id="figure1" /> |
| 203 | <p class="img-caption"> |
Andrew Solovay | 069ac63 | 2016-03-11 11:23:27 -0800 | [diff] [blame] | 204 | <strong>Figure 3.</strong> Doze now applies |
Dirk Dougherty | 5942892 | 2016-03-10 18:54:49 -0800 | [diff] [blame] | 205 | restrictions to improve battery life even when the device is not stationary. |
| 206 | </p> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 207 | |
| 208 | |
| 209 | <p>A short time after the screen turns off while the device is on battery, Doze |
| 210 | restricts network access and defers jobs and syncs. During brief maintenance |
| 211 | windows, applications are allowed network access and any of their deferred |
| 212 | jobs/syncs are executed. Turning the screen on or plugging in the device brings |
| 213 | the device out of Doze.</p> |
| 214 | |
| 215 | <p>When the device is stationary again, with screen off and on battery for a |
| 216 | period of time, Doze applies the full CPU and network restrictions on {@link |
| 217 | android.os.PowerManager.WakeLock}, {@link android.app.AlarmManager} alarms, and |
| 218 | GPS/Wi-Fi scans.</p> |
| 219 | |
| 220 | <p>The best practices for adapting your app to Doze are the same whether the |
| 221 | device is moving or not, so if you already updated your app to gracefully |
| 222 | handle Doze, you're all set. If not, start <a |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 223 | href="{@docRoot}training/monitoring-device-state/doze-standby.html#assessing_your_app">adapting |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 224 | your 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 |
| 229 | across the range of Android devices in the ecosystem. In Android N, Project |
| 230 | Svelte 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 |
| 233 | can make your user experience amazing — immediate, fast, and context-aware. |
| 234 | When not handled right, background processing can needlessly consume RAM (and |
| 235 | battery) and affect system performance for other apps. </p> |
| 236 | |
Andrew Solovay | d6a6f96 | 2016-03-10 15:01:29 -0800 | [diff] [blame] | 237 | <p>Since Android 5.0, {@link android.app.job.JobScheduler} has been the |
| 238 | preferred way of performing background work in a way that's good |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 239 | for users. Apps can schedule jobs while letting the system optimize based on |
| 240 | memory, power, and connectivity conditions. JobScheduler offers control and |
| 241 | simplicity, and we want all apps to use it. </p> |
| 242 | |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 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> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 250 | |
Andrew Solovay | d6a6f96 | 2016-03-10 15:01:29 -0800 | [diff] [blame] | 251 | <p>We're continuing to extend <code>JobScheduler</code> and |
| 252 | <code>GCMNetworkManager</code> to meet more of |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 253 | your use cases — for example, in Android N you can now schedule background |
| 254 | work based on changes in Content Providers. At the same time we're starting to |
| 255 | deprecate some of the older patterns that can reduce system performance, |
| 256 | especially on low-memory devices.</p> |
| 257 | |
| 258 | <p>In Android N we're removing three commonly-used implicit broadcasts — |
Adarsh Fernando | 3760156 | 2016-03-09 09:53:57 -0800 | [diff] [blame] | 259 | {@link android.net.ConnectivityManager#CONNECTIVITY_ACTION}, {@link |
| 260 | android.hardware.Camera#ACTION_NEW_PICTURE}, and {@link |
| 261 | android.hardware.Camera#ACTION_NEW_VIDEO} — since those can wake the |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 262 | background processes of multiple apps at once and strain memory and battery. If |
| 263 | your app is receiving these, take advantage of the N Developer Preview to |
| 264 | migrate to <code>JobScheduler</code> and related APIs instead. </p> |
| 265 | |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 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> |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 271 | |
Dirk Dougherty | 5942892 | 2016-03-10 18:54:49 -0800 | [diff] [blame] | 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 |
| 284 | exceeds the cost of the device itself. For many users, cellular data is an |
| 285 | expensive resource that they want to conserve. </p> |
| 286 | |
| 287 | <p>Android N introduces Data Saver mode, a new system service that helps reduce |
| 288 | cellular data use by apps, whether roaming, near the end of the billing cycle, |
| 289 | or on a small prepaid data pack. Data Saver gives users control over how apps |
| 290 | use cellular data and lets developers provide more efficient service when Data |
| 291 | Saver is on. </p> |
| 292 | |
| 293 | <p>When a user enables Data Saver in <strong>Settings</strong> and the device is |
| 294 | on a metered network, the system blocks background data usage and signals apps |
| 295 | to use less data in the foreground wherever possible — such as by limiting |
| 296 | bit rate for streaming, reducing image quality, deferring optimistic precaching, |
| 297 | and so on. Users can whitelist specific apps to allow background metered data |
| 298 | usage even when Data Saver is turned on.</p> |
| 299 | |
| 300 | <p>Android N extends the {@link android.net.ConnectivityManager} to provide apps a |
| 301 | way to <a href="{@docRoot}preview/features/data-saver.html#status">retrieve the |
| 302 | user's Data Saver preferences</a> and <a |
| 303 | href="{@docRoot}preview/features/data-saver.html#monitor-changes">monitor |
| 304 | preference changes</a>. All apps should check whether the user has enabled Data |
| 305 | Saver 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, |
| 320 | directly from the notification shade. In Android N, we've expanded the scope of |
| 321 | Quick 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 |
| 324 | access across a paginated display area by swiping left or right. We've also |
| 325 | given users control over what Quick Settings tiles appear and where they are |
| 326 | displayed — 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 |
| 353 | framework API to let service providers maintain a blocked-number list. The |
| 354 | default SMS app, the default phone app, and provider apps can read from and |
| 355 | write 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 |
| 358 | a consistent way for apps to support number-blocking across a wide range of |
| 359 | devices. 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 & |
| 364 | Restore 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 |
| 369 | read the blocked numbers list on the device and perform service-side blocking |
| 370 | for the user in order to stop unwanted calls and texts from reaching the user |
| 371 | through 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, |
| 405 | to better support bilingual use-cases. Apps can use |
| 406 | a new API to get the user's selected locales and then offer more sophisticated |
| 407 | user experiences for multi-locale users — such as showing search results in |
| 408 | multiple languages and not offering to translate webpages in a language the |
| 409 | user already knows.</p> |
| 410 | |
| 411 | <p>Along with multi-locale support, Android N also expands the range of languages |
| 412 | available to users. It offers more than 25 variants each for commonly used |
| 413 | languages such as English, Spanish, French, and Arabic. It also adds partial |
| 414 | support 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 |
| 417 | that it resolves resources. Make sure that you test and verify that your apps |
| 418 | working 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 |
| 421 | should 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 | |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 443 | <h2 id="gles_32">OpenGL™ 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" |
| 449 | href="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 |
Andrew Solovay | 9b21857 | 2016-03-09 11:17:07 -0800 | [diff] [blame] | 457 | requirement in your manifest file, using the <code><uses-feature></code> tag and |
Dirk Dougherty | cf65e484 | 2016-03-07 22:31:57 -0800 | [diff] [blame] | 458 | the <code>android:glEsVersion</code> attribute. </p> |
| 459 | |
| 460 | <p>For information about using OpenGL ES, including how to check a device's |
| 461 | supported OpenGL ES version at runtime, see the <a |
| 462 | href="{@docRoot}guide/topics/graphics/opengl.html">OpenGL ES API guide</a>.</p> |
| 463 | |
| 464 | |
Dirk Dougherty | 5942892 | 2016-03-10 18:54:49 -0800 | [diff] [blame] | 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 |
| 468 | services via new recording APIs. Building on top of existing time-shifting |
| 469 | APIs, TV input services can control what channel data can be recorded, how |
| 470 | recorded sessions are saved, and manage user interaction with recorded content. </p> |
| 471 | |
| 472 | <p>For more information, see <a |
| 473 | href="{@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. |
| 479 | Some highlights are below — for a complete list of Android for Work updates |
| 480 | related to Android N, please see Android for Work Changes.</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 |
| 508 | off the managed user is temporarily shut down, which disables work profile |
| 509 | apps, background sync, and notifications. This includes the profile owner |
| 510 | application. When work mode is off, the system displays a persistent status |
| 511 | icon to remind the user that they can't launch work apps. The launcher |
| 512 | indicates 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 |
| 517 | through a specified VPN. The system automatically starts that VPN after the |
| 518 | device 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 |
| 527 | interaction, VPN clients need to handle new entry points for Always on VPN. As |
| 528 | before, services are indicated to the system by an intent filter matching |
| 529 | action <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>More>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 |
| 540 | device setup. This makes it much easier for users to discover and configure |
| 541 | accessibility features on their devices, including magnification gesture, font |
| 542 | size, display size, and TalkBack. </p> |
| 543 | |
| 544 | <p>With these accessibility features getting more prominent placement, your users |
| 545 | are more likely to try your app with them enabled. Make sure you test your apps |
| 546 | early with these settings enabled. You can enable them from Settings > |
| 547 | Accessibility.</p> |
| 548 | |
| 549 | <p>Also in Android N, accessibility services can now help users with motor |
| 550 | impairments to touch the screen. The new API allows building services with |
| 551 | features such as face-tracking, eye-tracking, point scanning, and so on, to |
| 552 | meet 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 |
| 561 | apps have limited functionality even after an unexpected reboot. |
| 562 | For example, if an encrypted device reboots while the user is sleeping, |
| 563 | registered alarms, messages and incoming calls can now continue notify |
| 564 | the 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 |
| 568 | to enable fine grained encryption policies for both system and app data. |
| 569 | The system uses a device-encrypted store for select system data and explicitly |
| 570 | registered 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 |
| 574 | device-encrypted data only, and without general access to apps or data. |
| 575 | If you have components that you want to run in this mode, you can register |
| 576 | them by setting a flag in the manifest. After restart, the system activates |
| 577 | registered components by broadcasting the <code>LOCKED_BOOT_COMPLETED</code> |
| 578 | intent. The system ensures registered device-encrypted app data is available |
| 579 | before unlock. All other data is unavailable until the User confirms their lock |
| 580 | screen credentials to decrypt it. </p> |
| 581 | |
| 582 | For 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, |
| 589 | and use cryptographic keys on Android devices. They protect keys from the |
| 590 | Linux kernel, potential Android vulnerabilities, and extraction |
| 591 | from rooted devices.</p> |
| 592 | |
| 593 | <p>To make it easier and more secure to use hardware-backed keystores, |
| 594 | Android N introduces Key Attestation. Apps and off-devices can use Key |
| 595 | Attestation to strongly determine whether an RSA or EC key pair is |
| 596 | hardware-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 |
| 600 | through an X.509 attestation certificate which must be signed by a valid |
| 601 | attestation key. The attestation key is an ECDSA signing key which is |
| 602 | injected into the device’s hardware-backed keystore at the factory. |
| 603 | Therefore, an attestation certificate signed by a valid attestation |
| 604 | key 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 |
| 608 | image, Key Attestation requires that the device <a |
| 609 | class="external-link" |
| 610 | href="https://source.android.com/security/verifiedboot/verified-boot.html#bootloader_requirements">bootloader</a> |
| 611 | provide the following information to the <a class="external-link" |
| 612 | href="https://source.android.com/security/trusty/index.html">Trusted |
| 613 | Execution 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" |
| 618 | class="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, |
| 622 | see the guide for <a href="https://source.android.com/security/keystore/" |
| 623 | class="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) |
| 631 | connections safely, without any code modification, by using the declarative |
| 632 | <em>Network Security Config</em> instead of using the conventional |
| 633 | error-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 |
| 638 | Certificate Authorities (CA) are trusted for its secure connections. For |
| 639 | example, 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 |
| 642 | secure connections of their application without added risk to the installed |
| 643 | base. |
| 644 | </li> |
| 645 | <li><b>Cleartext traffic opt-out.</b> Lets an application protect itself from |
| 646 | accidental 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 |
| 652 | href="{@docRoot}preview/features/security-config.html">Network Security |
| 653 | Config</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 |
| 658 | and no longer trust user-added Certificate Authorities (CA). Apps targeting Android |
| 659 | N that wish to trust user-added CAs should use the |
| 660 | <a href="{@docRoot}preview/features/security-config.html">Network Security Config</a> to |
| 661 | specify 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 |
| 666 | signature scheme v2. The APK signature scheme v2 is a whole-file signature scheme |
| 667 | that 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 |
| 671 | scheme (JAR signature scheme) before being signed with the v2 signature scheme. |
| 672 | With 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 |
| 676 | Preview.</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 |
| 681 | href="{@docRoot}guide/topics/data/data-storage.html#filesExternal">external |
| 682 | storage</a> directories, including directories on removable media such as SD |
| 683 | cards. The new APIs greatly simplify how your application accesses standard |
| 684 | external storage directories, such as the <code>Pictures</code> directory. Apps |
| 685 | like photo apps can use these APIs instead of using |
| 686 | <code>READ_EXTERNAL_STORAGE</code>, which grants access to all storage |
| 687 | directories, or the Storage Access Framework, which makes the user navigate to |
| 688 | the directory.</p> |
| 689 | |
| 690 | <p>Additionally, the new APIs simplify the steps a user takes to grant external |
| 691 | storage access to your app. When you use the new APIs, the system uses a simple |
| 692 | permissions UI that clearly details what directory the application is |
| 693 | requesting access to.</p> |
| 694 | |
| 695 | <p>For more information, see the |
| 696 | <a href="{@docRoot}preview/features/scoped-folder-access.html">Scoped |
| 697 | Directory Access</a> developer documentation.</p> |
| 698 | |
| 699 | |
| 700 | |
| 701 | |
| 702 | |
| 703 | |