blob: a914b1360fef64370f35756cb6e4224ebaa9f2b3 [file] [log] [blame]
Dirk Dougherty5748bc42016-02-06 18:24:32 -08001page.title=Behavior Changes
2page.keywords=preview,sdk,compatibility
Dirk Dougherty43eb95102016-03-03 14:53:16 -08003meta.tags="preview", "compatibility"
4page.tags="preview", "developer preview"
5page.image=images/cards/card-n-changes_2x.png
Dirk Dougherty5748bc42016-02-06 18:24:32 -08006@jd:body
7
Joe Fernandezf278dab2016-03-06 19:14:25 -08008
9<div id="qv-wrapper">
10<div id="qv">
11
12<h2>In this document</h2>
13
Joe Fernandez0925df02016-03-06 22:24:40 -080014<ol>
15 <li><a href="#perf">Performance Improvements</a>
Joe Fernandezf278dab2016-03-06 19:14:25 -080016 <ol>
17 <li><a href="#doze">Doze</a></li>
18 <li><a href="#bg-opt">Background Optimizations</a></li>
19 </ol>
20 </li>
Joe Fernandez0925df02016-03-06 22:24:40 -080021 <li><a href="#perm">Permissions Changes</a></li>
22 <li><a href="#accessibility">Accessibility Improvements</a>
Joe Fernandezf278dab2016-03-06 19:14:25 -080023 <ol>
Joe Fernandez0925df02016-03-06 22:24:40 -080024 <li><a href="#screen-zoom">Screen Zoom</a></li>
25 <li><a href="#vision-settings">Vision Settings in Setup Wizard</a></li>
Joe Fernandezf278dab2016-03-06 19:14:25 -080026 </ol>
27 </li>
Joe Fernandez0925df02016-03-06 22:24:40 -080028 <li><a href="#ndk">NDK Apps Linking to Platform Libraries</a></li>
29 <li><a href="#afw">Android for Work</a></li>
Joe Fernandezf278dab2016-03-06 19:14:25 -080030</ol>
31
32<h2>See Also</h2>
33<ol>
34 <li><a href="{@docRoot}preview/api-overview.html">
David Friedmanfffa8ac2016-03-07 22:13:29 -080035 Android N API Overview</a></li>
Joe Fernandezf278dab2016-03-06 19:14:25 -080036</ol>
37
38</div>
39</div>
40
41
Dirk Dougherty5748bc42016-02-06 18:24:32 -080042<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -080043 Along with new features and capabilities, Android N
Joe Fernandezf278dab2016-03-06 19:14:25 -080044 includes a variety of system and API behavior changes. This document
45 highlights some of the key changes that you should understand and account for
46 in your apps.
47</p>
48
49<p>
50 If you have previously published an app for Android, be aware that your app
51 might be affected by these changes in the platform.
52</p>
53
54
Joe Fernandez0925df02016-03-06 22:24:40 -080055<h2 id="perf">Performance Improvements</h2>
Joe Fernandezf278dab2016-03-06 19:14:25 -080056
57<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -080058 Android N contains system behavior changes aimed at improving the battery
Joe Fernandez0925df02016-03-06 22:24:40 -080059 life of devices, RAM usage, and app performance. These changes can impact the
60 availability of system resources and system notifications to your app. You
61 should review these changes and evaluate how your app may need to adjust to
62 them.
Joe Fernandezf278dab2016-03-06 19:14:25 -080063</p>
64
65<h3 id="doze">Doze</h3>
66
67<p>
68 Introduced in Android 6.0 (API level 23), Doze improves battery life by
69 deferring CPU and network activities when a user leaves a device unplugged,
David Friedmanfffa8ac2016-03-07 22:13:29 -080070 stationary, and with the screen turned off. Android N brings further
Joe Fernandezf278dab2016-03-06 19:14:25 -080071 enhancements to Doze by applying a subset of CPU and network restrictions
72 while the device is unplugged with the screen turned off, but not necessarily
73 stationary, for example, when a handset is traveling in a user’s pocket.
74</p>
75
Joe Fernandez0925df02016-03-06 22:24:40 -080076
77<img src="{@docRoot}preview/images/doze-diagram-1.png"
78 alt="" height="251px" id="figure1" />
Joe Fernandezf278dab2016-03-06 19:14:25 -080079<p class="img-caption">
80 <strong>Figure 1.</strong> Illustration of how Doze applies a first level of
81 system activity restrictions to improve battery life.
82</p>
83
84<p>
85 When a device is on battery power, and the screen has been off for a certain
86 time, the device enters Doze and applies the first subset of restrictions: It
Joe Fernandez0925df02016-03-06 22:24:40 -080087 shuts off app network access, and defers jobs and syncs. If the device is
88 stationary for a certain time after entering Doze, the system applies the
89 rest of the Doze restrictions to {@link android.os.PowerManager.WakeLock},
Andrew Solovayb0fbda42016-03-08 18:19:09 -080090 {@link android.app.AlarmManager} alarms, GPS, and Wi-Fi scans. Regardless of
Joe Fernandez0925df02016-03-06 22:24:40 -080091 whether some or all Doze restrictions are being applied, the system wakes the
92 device for brief maintenance windows, during which applications are allowed
93 network access and can execute any deferred jobs/syncs.
Joe Fernandezf278dab2016-03-06 19:14:25 -080094</p>
95
96
Joe Fernandez0925df02016-03-06 22:24:40 -080097<img src="{@docRoot}preview/images/doze-diagram-2.png"
98 alt="" id="figure2" />
Joe Fernandezf278dab2016-03-06 19:14:25 -080099<p class="img-caption">
Joe Fernandez0925df02016-03-06 22:24:40 -0800100 <strong>Figure 2.</strong> Illustration of how Doze applies a second level of
101 system activity restrictions after the device is stationary for a certain time.
Joe Fernandezf278dab2016-03-06 19:14:25 -0800102</p>
103
104<p>
105 Note that activating the screen on or plugging in the device exits Doze and
106 removes these processing restrictions. The additional behavior does not
107 affect recommendations and best practices in adapting your app to the prior
Joe Fernandez0925df02016-03-06 22:24:40 -0800108 version of Doze introduced in Android 6.0 (API level 23), as discussed in
David Friedman7254ae42016-03-09 00:34:33 -0800109 <a href="{@docRoot}training/monitoring-device-state/doze-standby.html">
Joe Fernandez0925df02016-03-06 22:24:40 -0800110 Optimizing for Doze and App Standby</a>. You should still
Joe Fernandezf278dab2016-03-06 19:14:25 -0800111 follow those recommendations, such as using Google Cloud Messaging (GCM) to
Joe Fernandez0925df02016-03-06 22:24:40 -0800112 send and receive messages, and start planning updates to accomodate the
113 additional Doze behavior.
Joe Fernandezf278dab2016-03-06 19:14:25 -0800114</p>
115
116
Joe Fernandez0925df02016-03-06 22:24:40 -0800117<h3 id="bg-opt">Project Svelte: Background Optimizations</h3>
Joe Fernandezf278dab2016-03-06 19:14:25 -0800118
119<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800120 Android N removes three implicit broadcasts in order to help optimize both
Joe Fernandezf278dab2016-03-06 19:14:25 -0800121 memory use and power consumption. This change is necessary because implicit
122 broadcasts frequently start apps that have registered to listen for them in
123 the background. Removing these broadcasts can substantially benefit device
124 performance and user experience.
125</p>
126
127<p>
128 Mobile devices experience frequent connectivity changes, such as when moving
129 between Wi-Fi and mobile data. Currently, apps can monitor for changes in
130 connectivity by registering a receiver for the implicit {@link
131 android.net.ConnectivityManager#CONNECTIVITY_ACTION} broadcast in their
132 manifest. Since many apps register to receive this broadcast, a single
133 network switch can cause them all to wake up and process the broadcast at
134 once.
135</p>
136
137<p>
Adarsh Fernando37601562016-03-09 09:53:57 -0800138 Similarly, apps can register to receive implicit {@link
139 android.hardware.Camera#ACTION_NEW_PICTURE} and {@link
140 android.hardware.Camera#ACTION_NEW_VIDEO} broadcasts from other apps, such as
141 Camera. When a user takes a picture with the Camera app, these apps wake up
142 to process the broadcast.
Joe Fernandezf278dab2016-03-06 19:14:25 -0800143</p>
144
145<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800146 To alleviate these issues, Android N applies the following
Joe Fernandezf278dab2016-03-06 19:14:25 -0800147 optimizations:
148</p>
149
150<ul>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800151 <li>Apps targeting Android N do not receive {@link
Joe Fernandezf278dab2016-03-06 19:14:25 -0800152 android.net.ConnectivityManager#CONNECTIVITY_ACTION} broadcasts, even if they
153 have manifest entries to request notification of these events. Apps running
154 in the foreground can still listen for {@code CONNECTIVITY_CHANGE} on their
Adarsh Fernando37601562016-03-09 09:53:57 -0800155 main thread if they request notification with a {@link
156 android.content.BroadcastReceiver}.
Joe Fernandezf278dab2016-03-06 19:14:25 -0800157 </li>
158
Adarsh Fernando37601562016-03-09 09:53:57 -0800159 <li>Apps cannot send or receive {@link
160 android.hardware.Camera#ACTION_NEW_PICTURE} or {@link
161 android.hardware.Camera#ACTION_NEW_VIDEO} broadcasts. This optimization
162 affects all apps, not only those targeting Android N.
Joe Fernandezf278dab2016-03-06 19:14:25 -0800163 </li>
164</ul>
165
166<p>
167 Future releases of Android may deprecate additional implicit broadcasts, as
168 well as unbound background services. For this reason, you should avoid or
169 remove dependencies on manifest-declared receivers for implicit broadcasts,
170 as well as on background services.
171</p>
172
173<p>
174 The Android framework provides several solutions to mitigate the need for
175 these implicit broadcasts or background services. For example, the {@link
176 android.app.job.JobScheduler} API provides a robust mechanism to schedule
177 network operations when specified conditions, such as connection to an
178 unmetered network, are met. You can even use {@link
179 android.app.job.JobScheduler} to react to changes to content providers.
180</p>
181
182<p>
183 For more information about this behavior change and how to adapt your app,
184 see <a href=
185 "{@docRoot}preview/features/background-optimization.html">Background
186 Optimizations</a>.
187</p>
188
189
Joe Fernandez0925df02016-03-06 22:24:40 -0800190<h2 id="perm">Permissions Changes</h2>
Joe Fernandezf278dab2016-03-06 19:14:25 -0800191
192<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800193 Android N includes changes to permissions that may affect your app,
Joe Fernandezf278dab2016-03-06 19:14:25 -0800194 including user accounts permissions and a new permission for writing to
195 external storage. Here is a summary of the permissions that have changed in
196 the preview:
197</p>
198
199<ul>
200 <li>{@code GET_ACCOUNTS} (Deprecated)
201 <p>
202 The GET_ACCOUNTS permission is now deprecated. The system ignores this
David Friedmanfffa8ac2016-03-07 22:13:29 -0800203 permission for apps that target Android N.
Joe Fernandezf278dab2016-03-06 19:14:25 -0800204 </p>
205 </li>
206
207 <li>{@code ACTION_OPEN_EXTERNAL_DIRECTORY} (New)
208 <p>
209 This permission is for a new storage option. Apps can now use the intent
210 {@code ACTION_OPEN_EXTERNAL_DIRECTORY} to request that the system create a
211 directory for the app's use. The system prompts the user to grant
212 approval. If the user approves, the app can read and write files and
213 directories in that one directory (and its descendants). The app does not
214 need {@link android.Manifest.permission_group#STORAGE STORAGE}
215 permissions to access this external directory
216 </p>
217
218 <p>
219 For more information about this intent, see the updated
220 {@code Intent} reference documentation in the
Andrew Solovay56414082016-03-08 17:57:53 -0800221 <a href="{@docRoot}preview/setup-sdk.html#docs-dl">N Preview SDK
222 Reference</a>.
Joe Fernandezf278dab2016-03-06 19:14:25 -0800223 </p>
224 </li>
225</ul>
226
227
228
Joe Fernandez0925df02016-03-06 22:24:40 -0800229<h2 id="accessibility">Accessibility Improvements</h2>
Joe Fernandezf278dab2016-03-06 19:14:25 -0800230
231<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800232 Android N includes changes intended to improve the usability of the
Joe Fernandezf278dab2016-03-06 19:14:25 -0800233 platform for users with low or impaired vision. These changes should
234 generally not require code changes in your app, however you should review
235 these feature and test them with your app to assess potential impacts to user
236 experience.
237</p>
238
239
Joe Fernandez0925df02016-03-06 22:24:40 -0800240<h3 id="screen-zoom">Screen Zoom</h3>
Joe Fernandezf278dab2016-03-06 19:14:25 -0800241
242<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800243 Android N enables users to set <strong>Display size</strong>which magnifies
Joe Fernandezf278dab2016-03-06 19:14:25 -0800244 or shrinks all elements on the screen, thereby improving device accessibility
245 for users with low vision. Users cannot zoom the screen past a minimum screen
246 width of <a href=
247 "http://developer.android.com/guide/topics/resources/providing-resources.html">
248 sw320dp</a>, which is the width of a Nexus 4, a common medium-sized phone.
249</p>
250
Joe Fernandez0925df02016-03-06 22:24:40 -0800251<div class="cols">
Joe Fernandezf278dab2016-03-06 19:14:25 -0800252
Joe Fernandez0925df02016-03-06 22:24:40 -0800253<div class="col-6">
254 <img src="{@docRoot}preview/images/screen-zoom-1.png" alt="" height="XXX" id="figure1" />
255</div>
256<div class="col-6">
257 <img src="{@docRoot}preview/images/screen-zoom-2.png" alt="" height="XXX" id="figure1" />
258</div>
259
260</div> <!-- end cols -->
Joe Fernandezf278dab2016-03-06 19:14:25 -0800261<p class="img-caption">
Joe Fernandez0925df02016-03-06 22:24:40 -0800262 <strong>Figure 3.</strong> The screen on the right shows the effect of
David Friedmanfffa8ac2016-03-07 22:13:29 -0800263 increasing the Display size of a device running an Android N system image.
Joe Fernandezf278dab2016-03-06 19:14:25 -0800264</p>
265
Joe Fernandez0925df02016-03-06 22:24:40 -0800266
Joe Fernandezf278dab2016-03-06 19:14:25 -0800267<p>
268 When the device density changes, the system notifies running apps in the
269 following ways:
270</p>
271
272<ul>
273 <li>If an app targets API level 23 or lower, the system automatically kills
274 all its background processes. This means that if a user switches away from
275 such an app to open the <em>Settings</em> screen and changes the
276 <strong>Display size</strong> setting, the system kills the app in the same
277 manner that it would in a low-memory situation. If the app has any foreground
278 processes, the system notifies those processes of the configuration change as
279 described in <a href="{@docRoot}guide/topics/resources/runtime-changes.html">Handling
280 Runtime Changes</a>, just as if the device's orientation had changed.
281 </li>
282
David Friedmanfffa8ac2016-03-07 22:13:29 -0800283 <li>If an app targets Android N, all of its processes
Joe Fernandezf278dab2016-03-06 19:14:25 -0800284 (foreground and background) are notified of the configuration change as
285 described in <a href=
286 "{@docRoot}guide/topics/resources/runtime-changes.html">Handling
287 Runtime Changes</a>.
288 </li>
289</ul>
290
291<p>
292 Most apps do not need to make any changes to support this feature, provided
Andrew Solovay170191d2016-03-08 11:59:29 -0800293 the apps follow Android best practices. Specific things to check for:
Joe Fernandezf278dab2016-03-06 19:14:25 -0800294</p>
295
Andrew Solovay170191d2016-03-08 11:59:29 -0800296<ul>
297 <li>Test your app on a device with screen width <code><a href=
298 "{@docRoot}guide/topics/resources/providing-resources.html">sw320dp</a></code>
299 and be sure it performs adequately.
300 </li>
301
302 <li>When the device configuration changes, update any density-dependent
303 cached information, such as cached bitmaps or resources loaded from the
304 network. Check for configuration changes when the app resumes from the paused
305 state.
306 <p class="note">
307 <strong>Note:</strong> If you cache configuration-dependent data, it's a
308 good idea to include relevant metadata such as the appropriate screen
309 size or pixel density for that data. Saving this metadata allows you to
310 decide whether you need to refresh the cached data after a configuration
311 change.
312 </p>
313 </li>
314
315 <li>Avoid specifying dimensions with px units, since they do not scale with
316 screen density. Instead, specify dimensions with <a href=
317 "{@docRoot}guide/practices/screens_support.html">density-independent
318 pixel</a> (<code>dp</code>) units.
319 </li>
320</ul>
Joe Fernandezf278dab2016-03-06 19:14:25 -0800321
Joe Fernandez0925df02016-03-06 22:24:40 -0800322<h3 id="vision-settings">Vision Settings in Setup Wizard</h3>
Joe Fernandezf278dab2016-03-06 19:14:25 -0800323
324<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800325 Android N includes Vision Settings on the Welcome screen, where users can
Joe Fernandezf278dab2016-03-06 19:14:25 -0800326 set up the following accessibility settings on a new device:
327 <strong>Magnification gesture</strong>, <strong>Font size</strong>,
328 <strong>Display size</strong> and <strong>TalkBack</strong>. This change
329 increases the visibility of bugs related to different screen settings. To
330 assess the impact of this feature, you should test your apps with these
331 settings enabled. You can find the settings under <strong>Settings &gt;
332 Accessibility</strong>.
333</p>
334
Joe Fernandez0925df02016-03-06 22:24:40 -0800335<h2 id="ndk">NDK Apps Linking to Platform Libraries</h2>
336
Joe Fernandezf278dab2016-03-06 19:14:25 -0800337<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800338 Android N includes namespace changes to prevent loading of non-public APIs.
Joe Fernandez0925df02016-03-06 22:24:40 -0800339 If you use the NDK, you should only be using public APIs from the Android
340 platform. Using non-public APIs in the next official release of Android
341 can cause your app to crash.
Joe Fernandezf278dab2016-03-06 19:14:25 -0800342</p>
343
Joe Fernandezf278dab2016-03-06 19:14:25 -0800344<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800345 In order to alert you to use of non-public APIs, apps running on an Android N
Joe Fernandez0925df02016-03-06 22:24:40 -0800346 device generate an error in logcat output when an app calls a non-public API.
347 This error is also displayed on the device screen as a message to help
348 raise awareness of this situation. You should review your app code to
349 remove use of non-public platform APIs and thoroughly test your apps using
350 a preview device or emulator.
Joe Fernandezf278dab2016-03-06 19:14:25 -0800351</p>
352
353<p>
354 If your app depends on platform libraries, see the NDK documentation for
355 typical fixes for replacing common private APIs with public API equivalents.
356 You may also be linking to platform libraries without realizing it,
357 especially if your app uses a library that is part of the platform (such as
358 <code>libpng</code>), but is not part of the NDK. In that case, ensure that
359 your APK contains all the .so files you intended to link against.
360</p>
361
Joe Fernandez0925df02016-03-06 22:24:40 -0800362<p class="caution">
363 <strong>Caution:</strong> Some third-party libraries may link to non-public
364 APIs. If your app uses these libraries, your app may crash when running
365 on the next official release of Android.
366</p>
367
Joe Fernandezf278dab2016-03-06 19:14:25 -0800368<p>
369 Apps should not depend on or use native libraries that are not included in
370 the NDK, because they may change, or be removed from one Android release to
371 another. The switch from OpenSSL to BoringSSL is an example of such a change.
372 Also, different devices may offer different levels of compatibility, because
373 there are no compatibility requirements for platform libraries not included
374 in the NDK. If you must access non-NDK libraries on older devices, make the
375 loading dependent on the Android API level.
376</p>
377
378<p>
379 To help you diagnose these types problems here are some example Java and NDK
David Friedmanfffa8ac2016-03-07 22:13:29 -0800380 errors you might encounter when attempting to build your app with Android N:
Joe Fernandezf278dab2016-03-06 19:14:25 -0800381</p>
382
383<p>Example Java error:</p>
Andrew Solovayb0fbda42016-03-08 18:19:09 -0800384<pre class="no-pretty-print">
Joe Fernandezf278dab2016-03-06 19:14:25 -0800385java.lang.UnsatisfiedLinkError: dlopen failed: library "/system/lib/libcutils.so"
386 is not accessible for the namespace "classloader-namespace"
387</pre>
388
389<p>Example NDK error:</p>
Andrew Solovayb0fbda42016-03-08 18:19:09 -0800390<pre class="no-pretty-print">
Joe Fernandezf278dab2016-03-06 19:14:25 -0800391dlopen failed: cannot locate symbol "__system_property_get" referenced by ...
392</pre>
393
394
395<p>
396 Here are some typical fixes for apps encountering these types of errors:
397</p>
398
399<ul>
400 <li>Use of getJavaVM and getJNIEnv from libandroid_runtime.so can be replaced
401 with standard JNI functions:
Andrew Solovayb0fbda42016-03-08 18:19:09 -0800402<pre class="no-pretty-print">
Joe Fernandezf278dab2016-03-06 19:14:25 -0800403AndroidRuntime::getJavaVM -&gt; GetJavaVM from &lt;jni.h&gt;
404AndroidRuntime::getJNIEnv -&gt; JavaVM::GetEnv or
405JavaVM::AttachCurrentThread from &lt;jni.h&gt;.
406</pre>
407 </li>
408
409 <li>Use of {@code property_get} symbol from {@code libcutils.so} can be
David Friedman5e145b72016-03-08 12:25:35 -0800410 replaced with the public {@code alternative __system_property_get}.
411 To do this, use {@code __system_property_get} with the following include:
Joe Fernandezf278dab2016-03-06 19:14:25 -0800412<pre>
David Friedman5e145b72016-03-08 12:25:35 -0800413#include &lt;sys/system_properties.h&gt;
Joe Fernandezf278dab2016-03-06 19:14:25 -0800414</pre>
415 </li>
416
417 <li>Use of {@code SSL_ctrl} symbol from {@code libcrypto.so} should be
418 replaced with an app local version. For example, you should statically link
419 {@code libcyrpto.a} in your {@code .so} file or include your own dynamically
420 {@code libcrypto.so} from BoringSSL or OpenSSL in your app.
421 </li>
422</ul>
Joe Fernandez0925df02016-03-06 22:24:40 -0800423
424<h2 id="afw">Android for Work</h2>
425<p>
David Friedmanfffa8ac2016-03-07 22:13:29 -0800426 Android N contains changes for apps that target Android for Work, including
Joe Fernandez0925df02016-03-06 22:24:40 -0800427 changes to certificate installation, password resetting, secondary user
428 management, and access to device identifiers. If you are building apps for
429 Android for Work environments, you should review these changes and modify
430 your app accordingly.
431</p>
432
433<ul>
434 <li>You must install a delegated certificate installer before the DPC can set
435 it. For both profile and device-owner apps targeting the N SDK, you should
436 install the delegated certificate installer before the device policy
437 controller (DPC) calls
438 <code>DevicePolicyManager.setCertInstallerPackage()</code>. If the installer
439 is not already installed, the system throws an
440 <code>IllegalArgumentException</code>.
441 </li>
442
443 <li>Reset password restrictions for device admins now apply to profile
Andrew Solovayb0fbda42016-03-08 18:19:09 -0800444 owners. Device admins can no longer use
445 <code>DevicePolicyManager.resetPassword()</code> to clear passwords or change
Joe Fernandez0925df02016-03-06 22:24:40 -0800446 ones that are already set. Device admins can still set a password, but only
447 when the device has no password, PIN, or pattern.
448 </li>
449
450 <li>Device and profile owners can manage accounts even if restrictions are
Andrew Solovayb0fbda42016-03-08 18:19:09 -0800451 set. Device owners and profile owners can call the Account Management APIs
Joe Fernandez0925df02016-03-06 22:24:40 -0800452 even if <code>DISALLOW_MODIFY_ACCOUNTS</code> user restrictions are in place.
453 </li>
454
Andrew Solovayb0fbda42016-03-08 18:19:09 -0800455 <li>Device owners can manage secondary users more easily. When a device is
Joe Fernandez0925df02016-03-06 22:24:40 -0800456 running in device owner mode, the <code>DISALLOW_ADD_USER</code> restriction
457 is automatically set. This prevents users from creating unmanaged secondary
458 users. In addition, the <code>CreateUser()</code> and
459 <code>createAndInitial()</code> methods are deprecated; the new
460 <code>DevicePolicyManager.createAndManageUser()</code> method replaces them.
461 </li>
462
Andrew Solovayb0fbda42016-03-08 18:19:09 -0800463 <li>Device owners can access device identifiers. A Device owner can access the
Joe Fernandez0925df02016-03-06 22:24:40 -0800464 Wi-Fi MAC address of a device, using
Andrew Solovayb0fbda42016-03-08 18:19:09 -0800465 <code>DevicePolicyManagewr.getWifiMacAddress()</code>. If Wi-Fi has never
Joe Fernandez0925df02016-03-06 22:24:40 -0800466 been enabled on the device, this method returns a value of {@code null}.
467 </li>
468</ul>
David Friedman0a686932016-03-08 15:01:40 -0800469
Andrew Solovayb0fbda42016-03-08 18:19:09 -0800470<p>
471 For more information about changes to Android for Work in Android N, see
472 <a href="{@docRoot}preview/features/afw.html">Android for Work Updates</a>.
473</p>
474
David Friedman0a686932016-03-08 15:01:40 -0800475<h2 id="other">Other important points</h2>
476
477<ul>
David Friedman10594f32016-03-09 02:20:34 -0800478<li>When an app is running on Android N, but targets a lower API level,
479and the user changes display size, the app process is killed. The app
480must be able to gracefully handle this scenario. Otherwise, it crashes
481when the user restores it from Recents.
David Friedman0a686932016-03-08 15:01:40 -0800482
483<p>
David Friedman10594f32016-03-09 02:20:34 -0800484You should test your app to ensure
485that this behavior does not occur.
486You can do so by causing an identical crash
487when killing the app manually via DDMS.
David Friedman0a686932016-03-08 15:01:40 -0800488</p>
489
490<p>
491Apps targeting N and above are not automatically killed on density changes;
David Friedman10594f32016-03-09 02:20:34 -0800492however, they may still respond poorly to configuration changes.
David Friedman0a686932016-03-08 15:01:40 -0800493</p>
494</li>
495
496<li>
497Apps on Android N should be able to gracefully handle configuration changes,
498and should not crash on subsequent starts. You can verify app behavior
499by changing font size (<strong>Setting</strong> >
500<strong>Display</strong> > <strong>Font size</strong>), and then restoring
501the app from Recents.
502</li>
503</ul>
504