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