1page.title=Behavior Changes 2page.keywords=preview,sdk,compatibility 3sdk.platform.apiLevel=MNC 4@jd:body 5 6<div id="qv-wrapper"> 7<div id="qv"> 8 9<h2>In this document</h2> 10 11<ol id="toc44" class="hide-nested"> 12 <li><a href="#behavior-runtime-permissions">Runtime Permissions</a></li> 13 <li><a href="#behavior-power">Power-Saving Optimizations</a></li> 14 <li><a href="#behavior-adoptable-storage">Adoptable Storage Devices</a></li> 15 <li><a href="#behavior-apache-http-client">Apache HTTP Client Removal</a></li> 16 <li><a href="#behavior-audiomanager-Changes">AudioManager Changes</a></li> 17 <li><a href="#behavior-notifications">Notifications</a></li> 18 <li><a href="#behavior-test-selection">Text Selection</a></li> 19 <li><a href="#behavior-keystore">Android Keystore Changes</a></li> 20 <li><a href="#behavior-network">Wi-Fi and Networking Changes</a></li> 21 <li><a href="#behavior-camera">Camera Service Changes</a></li> 22 <li><a href="#behavior-runtime">Runtime</a></li> 23 <li><a href="#behavior-hardware-id">Access to Hardware Identifier</a></li> 24 <li><a href="#behavior-apk-validation">APK Validation</a></li> 25 <li><a href="#behavior-usb">USB Connection</a></li> 26 <li><a href="#behavior-afw">Android for Work Changes</a></li> 27</ol> 28 29<h2>API Differences</h2> 30<ol> 31<li><a href="{@docRoot}preview/download.html">API level 22 to M Preview »</a> </li> 32</ol> 33 34 35<h2>See Also</h2> 36<ol> 37<li><a href="{@docRoot}preview/api-overview.html">M Developer Preview API Overview</a> </li> 38</ol> 39 40</div> 41</div> 42 43<p>Along with new features and capabilities, the M Developer Preview includes a variety of 44system changes and API behavior changes. This document highlights 45some of the key changes that you should understand and account for in your apps.</p> 46 47<p>If you have previously published an app for Android, be aware that these changes in the 48platform affect your app.</p> 49 50<h2 id="behavior-runtime-permissions">Runtime Permissions</h1> 51<p>This preview introduces a new permissions model, where users can now directly manage 52app permissions at runtime. This model gives users improved visibility and control over 53permissions, while streamlining the installation and auto-update processes for app developers. 54Users can grant or revoke permissions individually for installed apps. </p> 55 56<p>On your apps that target the M Preview release or higher, make sure to check for and request 57permissions at runtime. To determine if your app has been granted a permission, call the 58new {@link android.content.Context#checkSelfPermission(java.lang.String) checkSelfPermission()} 59method. To request a permission, call the new 60{@link android.app.Activity#requestPermissions(java.lang.String[], int) requestPermissions()} 61method. Even if your app is not targeting the M Preview release, you should test your app under 62the new permissions model.</p> 63 64<p>For details on supporting the new permissions model in your app, see the 65<a href="{@docRoot}preview/features/runtime-permissions.html"> 66Permissions</a> developer preview page. For tips on how to assess the impact on your app, 67see the <a href="{@docRoot}preview/testing/guide.html#runtime-permissions">Testing Guide</a></p> 68 69<h2 id="behavior-power">Power-Saving Optimizations</h2> 70<p>This preview introduces new power-saving optimizations for idle devices and apps.</p> 71<ul> 72<li><strong>Doze</strong>: If a user unplugs a device and leaves it stationary, with its screen off, 73for a period of time, the device goes into <em>Doze</em> mode, where it attempts to keep the system 74in a sleep state. In this mode, devices periodically resume normal operations for brief periods of 75time so that app syncing can occur and the system can perform any pending operations. 76<li><strong>App Standby</strong>: App Standby allows the system to determine that an app is idle 77when the user is not actively using it. The system makes this determination when the user does not 78touch the app for a certain period of time. If the device is unplugged, the system disables network 79access and suspends syncs and jobs for the apps it deems idle.</li> 80</ul> 81 82<p>To learn more about these power-saving changes, see 83<a href="{@docRoot}preview/features/power-mgmt.html">Power-Saving Optimizations</a>.</p> 84 85<h2 id="behavior-adoptable-storage">Adoptable Storage Devices</h2> 86<p> 87With this preview, users can <em>adopt</em> external storage devices such as SD cards. Adopting an 88external storage device encrypts and formats the device to behave like internal storage. This 89feature allows users to move both apps and private data of those apps between storage devices. When 90moving apps, the system respects the 91<a href="{@docRoot}guide/topics/manifest/manifest-element.html#install">{@code android:installLocation}</a> 92preference in the manifest.</p> 93 94<p>If your app accesses the following APIs or fields, be aware that the file paths they return 95will dynamically change when the app is moved between internal and external storage devices. 96When building file paths, it is strongly recommended that you always call these APIs dynamically. 97Don’t use hardcoded file paths or persist fully-qualified file paths that were built previously.</p> 98 99<ul> 100<li>{@link android.content.Context} methods: 101 <ul> 102 <li>{@link android.content.Context#getFilesDir() getFilesDir()}</li> 103 <li>{@link android.content.Context#getCacheDir() getCacheDir()}</li> 104 <li>{@link android.content.Context#getCodeCacheDir() getCodeCacheDir()}</li> 105 <li>{@link android.content.Context#getDatabasePath(java.lang.String) getDatabasePath()}</li> 106 <li>{@link android.content.Context#getDir(java.lang.String,int) getDir()}</li> 107 <li>{@link android.content.Context#getNoBackupFilesDir() getNoBackupFilesDir()}</li> 108 <li>{@link android.content.Context#getFileStreamPath(java.lang.String) getFileStreamPath()}</li> 109 <li>{@link android.content.Context#getPackageCodePath() getPackageCodePath()}</li> 110 <li>{@link android.content.Context#getPackageResourcePath() getPackageResourcePath()}</li> 111 </ul> 112</li> 113<li>{@link android.content.pm.ApplicationInfo} fields: 114 <ul> 115 <li>{@link android.content.pm.ApplicationInfo#dataDir dataDir}</li> 116 <li>{@link android.content.pm.ApplicationInfo#sourceDir sourceDir}</li> 117 <li>{@link android.content.pm.ApplicationInfo#nativeLibraryDir nativeLibraryDir}</li> 118 <li>{@link android.content.pm.ApplicationInfo#publicSourceDir publicSourceDir}</li> 119 <li>{@link android.content.pm.ApplicationInfo#splitSourceDirs splitSourceDirs}</li> 120 <li>{@link android.content.pm.ApplicationInfo#splitPublicSourceDirs splitPublicSourceDirs}</li> 121 </ul> 122</li> 123</ul> 124 125<p>To debug this feature in the developer preview, you can enable adoption of a USB drive that is 126connected to an Android device through a USB On-The-Go (OTG) cable, by running this command:</p> 127 128<pre class="no-prettyprint"> 129$ adb shell sm set-force-adoptable true 130</pre> 131 132<h2 id="behavior-apache-http-client">Apache HTTP Client Removal</h2> 133<p>This preview removes support for the Apache HTTP client. If your app is using this client and 134targets Android 2.3 (API level 9) or higher, use the {@link java.net.HttpURLConnection} class 135instead. This API is more efficient because it reduces network use through transparent compression 136and response caching, and minimizes power consumption. To continue using the Apache HTTP APIs, you 137must first declare the following compile-time dependency in your {@code build.gradle} file: 138</p> 139<pre> 140android { 141 useLibrary 'org.apache.http.legacy' 142} 143</pre> 144<p>Android is moving away from OpenSSL to the 145<a href="https://boringssl.googlesource.com/boringssl/" class="external-link">BoringSSL</a> 146library. If you’re using the Android NDK in your app, don't link against cryptographic libraries 147that are not a part of the NDK API, such as {@code libcrypto.so} and {@code libssl.so}. These 148libraries are not public APIs, and may change or break without notice across releases and devices. 149In addition, you may expose yourself to security vulnerabilities. Instead, modify your 150native code to call the Java cryptography APIs via JNI or to statically link against a 151cryptography library of your choice.</p> 152 153<h2 id="behavior-audiomanager-Changes">AudioManager Changes</h2> 154<p>Setting the volume directly or muting specific streams via the {@link android.media.AudioManager} 155class is no longer supported. The {@link android.media.AudioManager#setStreamSolo(int,boolean) 156setStreamSolo()} method is deprecated, and you should call the 157{@link android.media.AudioManager#requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, int, int) requestAudioFocus()} 158method instead. Similarly, the 159{@link android.media.AudioManager#setStreamMute(int,boolean) setStreamMute()} method is 160deprecated; instead, call the {@link android.media.AudioManager#adjustStreamVolume(int, int, int) 161adjustStreamVolume()} method and pass in the direction value 162{@link android.media.AudioManager#ADJUST_MUTE} or 163{@link android.media.AudioManager#ADJUST_UNMUTE}.</p> 164 165<h2 id="behavior-notifications">Notifications</h2> 166<p> 167This release removes the {@code Notification.setLatestEventInfo()} method. Use the 168{@link android.app.Notification.Builder} class instead to construct notifications. To update a 169notification repeatedly, reuse the {@link android.app.Notification.Builder} instance. Call the 170{@link android.app.Notification.Builder#build()} method to get 171updated {@link android.app.Notification} instances. 172</p> 173<p>The {@code adb shell dumpsys notification} command no longer prints out your notification text. 174Use the {@code adb shell dumpsys notification --noredact} command instead to print out the text 175in a notification object.</p> 176 177<h2 id="behavior-test-selection">Text Selection</h2> 178 179<img src="{@docRoot}preview/images/text-selection.gif" 180style="float:right; margin:0 0 20px 30px" width="360" height="640" /> 181 182<p>When users select text in your app, you can now display text selection actions such as 183<em>Cut</em>, <em>Copy</em>, and <em>Paste</em> in a 184<a href="http://www.google.com/design/spec/patterns/selection.html#selection-text-selection" 185class="external-link">floating toolbar</a>. The user interaction implementation is similar to that 186for the contextual action bar, as described in 187<a href="{@docRoot}guide/topics/ui/menus.html#CABforViews"> 188Enabling the contextual action mode for individual views</a>.</p> 189 190<p>To implement a floating toolbar for text selection, make the following changes in your existing 191apps:</p> 192<ol> 193<li>In your {@link android.view.View} or {@link android.app.Activity} object, change your 194{@link android.view.ActionMode} calls from 195{@code startActionMode(Callback)} to {@code startActionMode(Callback, ActionMode.TYPE_FLOATING)}.</li> 196<li>Take your existing implementation of {@code ActionMode.Callback} and make it extend 197{@link android.view.ActionMode.Callback2} instead.</li> 198<li>Override the 199{@link android.view.ActionMode.Callback2#onGetContentRect(android.view.ActionMode, android.view.View, android.graphics.Rect) onGetContentRect()} 200method to provide the coordinates of the content {@link android.graphics.Rect} object 201(such as a text selection rectangle) in the view.</li> 202<li>If the rectangle positioning is no longer valid, and this is the only element to be invalidated, 203call the {@link android.view.ActionMode#invalidateContentRect() invalidateContentRect()} method.</li> 204</ol> 205 206<p>If you are using <a href="{@docRoot}tools/support-library/index.html"> 207Android Support Library</a> revision 22.2, be aware that floating toolbars are not 208backward-compatible and appcompat takes control over {@link android.view.ActionMode} objects by 209default. This prevents floating toolbars from being displayed. To enable 210{@link android.view.ActionMode} support in an 211{@link android.support.v7.app.AppCompatActivity}, call 212{@link android.support.v7.app.AppCompatActivity#getDelegate()}, then call 213{@link android.support.v7.app.AppCompatDelegate#setHandleNativeActionModesEnabled(boolean) 214setHandleNativeActionModesEnabled()} on the returned 215{@link android.support.v7.app.AppCompatDelegate} object and set the input 216parameter to {@code false}. This call returns control of {@link android.view.ActionMode} objects to 217the framework. In devices running the M Preview, that allows the framework to support 218{@link android.support.v7.app.ActionBar} or floating toolbar modes, while on pre-M Preview devices, 219only the {@link android.support.v7.app.ActionBar} modes are supported.</p> 220 221<h2 id="behavior-keystore">Android Keystore Changes</h2> 222<p>With this preview, the 223<a href="{@docRoot}training/articles/keystore.html">Android Keystore provider</a> no longer supports 224DSA. ECDSA is still supported.</p> 225 226<p>Keys which do not require encryption at rest will no longer be deleted when secure lock screen 227is disabled or reset (for example, by the user or a Device Administrator). Keys which require 228encryption at rest will be deleted during these events.</p> 229 230<h2 id="behavior-network">Wi-Fi and Networking Changes</h2> 231 232<p>This preview introduces the following behavior changes to the Wi-Fi and networking APIs.</p> 233<ul> 234<li>Your apps can now change the state of {@link android.net.wifi.WifiConfiguration} objects only 235if you created these objects. You are not permitted to modify or delete 236{@link android.net.wifi.WifiConfiguration} objects created by the user or by other apps. 237</li> 238<li> 239Previously, if an app forced the device to connect to a specific Wi-Fi network by using 240{@link android.net.wifi.WifiManager#enableNetwork(int,boolean) enableNetwork()} with the 241{@code disableAllOthers=true} setting, the device disconnected from other networks such as 242cellular data. In this preview, the device no longer disconnects from such other networks. If 243your app’s {@code targetSdkVersion} is {@code “20”} or lower, it is pinned to the selected 244Wi-Fi network. If your app’s {@code targetSdkVersion} is {@code “21”} or higher, use the 245multinetwork APIs (such as 246{@link android.net.Network#openConnection(java.net.URL) openConnection()}, 247{@link android.net.Network#bindSocket(java.net.Socket) bindSocket()}, and the new 248{@link android.net.ConnectivityManager#bindProcessToNetwork(android.net.Network) 249bindProcessToNetwork()} method) to ensure that its network traffic is sent on the selected network.</li> 250</ul> 251 252<h2 id="behavior-camera">Camera Service Changes</h2> 253<p>In this preview, the model for accessing shared resources in the camera service has been changed 254from the previous “first come, first serve” access model to an access model where high-priority 255processes are favored. Changes to the service behavior include:</p> 256<ul> 257<li>Access to camera subsystem resources, including opening and configuring a camera device, is 258awarded based on the “priority” of the client application process. Application processes with 259user-visible or foreground activities are generally given a higher-priority, making camera resource 260acquisition and use more dependable.</li> 261<li>Active camera clients for lower priority apps may be “evicted” when a higher priority 262application attempts to use the camera. In the deprecated {@link android.hardware.Camera} API, 263this results in 264{@link android.hardware.Camera.ErrorCallback#onError(int,android.hardware.Camera) onError()} being 265called for the evicted client. In the {@link android.hardware.camera2 Camera2} API, it results in 266{@link android.hardware.camera2.CameraDevice.StateCallback#onDisconnected(android.hardware.camera2.CameraDevice) onDisconnected()} 267being called for the evicted client.</li> 268<li>On devices with appropriate camera hardware, separate application processes are able to 269independently open and use separate camera devices simultaneously. However, multi-process use 270cases, where simultaneous access causes significant degradation of performance or capabilities of 271any of the open camera devices, are now detected and disallowed by the camera service. This change 272may result in “evictions” for lower priority clients even when no other app is directly 273attempting to access the same camera device. 274</li> 275<li> 276Changing the current user causes active camera clients in apps owned by the previous user account 277to be evicted. Access to the camera is limited to user profiles owned by the current device user. 278In practice, this means that a “Guest” account, for example, will not be able to leave running 279processes that use the camera subsystem when the user has switched to a different account. 280</li> 281</ul> 282 283<h2 id="behavior-runtime">Runtime</h2> 284<p>The ART runtime now properly implements access rules for the 285{@link java.lang.reflect.Constructor#newInstance(java.lang.Object...) newInstance()} method. This 286change fixes a problem where Dalvik was checking access rules incorrectly in previous versions. 287If your app uses the 288{@link java.lang.reflect.Constructor#newInstance(java.lang.Object...) newInstance()} method and you 289want to override access checks, call the 290{@link java.lang.reflect.Constructor#setAccessible(boolean) setAccessible()} method with the input 291parameter set to {@code true}. If your app uses the 292<a href="{@docRoot}tools/support-library/features.html#v7-appcompat">v7 appcompat library</a> or the 293<a href="{@docRoot}tools/support-library/features.html#v7-recyclerview">v7 recyclerview library</a>, 294you must update your app to use to the latest versions of these libraries. Otherwise, make sure that 295any custom classes referenced from XML are updated so that their class constructors are accessible.</p> 296 297<p>This preview updates the behavior of the dynamic linker. The dynamic linker now understands the 298difference between a library’s {@code soname} and its path 299(<a href="https://code.google.com/p/android/issues/detail?id=6670" class="external-link"> 300public bug 6670</a>), and search by {@code soname} is now 301implemented. Apps which previously worked that have bad {@code DT_NEEDED} entries 302(usually absolute paths on the build machine’s file system) may fail when loaded.</p> 303 304<p>The {@code dlopen(3) RTLD_LOCAL} flag is now correctly implemented. Note that 305{@code RTLD_LOCAL} is the default, so calls to {@code dlopen(3)} that didn’t explicitly use 306{@code RTLD_LOCAL} will be affected (unless your app explicitly used {@code RTLD_GLOBAL}). With 307{@code RTLD_LOCAL}, symbols will not be made available to libraries loaded by later calls to 308{@code dlopen(3)} (as opposed to being referenced by {@code DT_NEEDED} entries).</p> 309</p> 310 311<h2 id="behavior-hardware-id">Access to Hardware Identifier</h2> 312<p>To provide users with greater data protection, starting in this release, Android 313removes programmatic access to the device’s local hardware identifier for 314apps using the Wi-Fi and Bluetooth APIs. The 315{@link android.net.wifi.WifiInfo#getMacAddress() WifiInfo.getMacAddress()} and the 316{@link android.bluetooth.BluetoothAdapter#getAddress() BluetoothAdapter.getAddress()} methods 317now return a constant value of {@code 02:00:00:00:00:00}.</p> 318 319<p>To access the hardware identifiers of nearby external devices via Bluetooth and Wi-Fi scans, 320your app must now have the following permissions:</p> 321<ul> 322<li>{@link android.net.wifi.WifiManager#getScanResults() WifiManager.getScanResults()}: 323Your app must have {@link android.Manifest.permission#ACCESS_FINE_LOCATION} or 324{@link android.Manifest.permission#ACCESS_COARSE_LOCATION} permission.</li> 325<li>{@link android.bluetooth.BluetoothDevice#ACTION_FOUND BluetoothDevice.ACTION_FOUND}: 326Your app must have {@link android.Manifest.permission#ACCESS_COARSE_LOCATION} permission.</li> 327<li>{@link android.bluetooth.le.BluetoothLeScanner#startScan(android.bluetooth.le.ScanCallback) 328BluetoothLeScanner.startScan()}: Your app must have 329{@link android.Manifest.permission#ACCESS_FINE_LOCATION} or 330{@link android.Manifest.permission#ACCESS_COARSE_LOCATION} permission.</li> 331</ul> 332 333<p class="note"><strong>Note</strong>: When a device running M Developer Preview initiates a 334background Wi-Fi or Bluetooth scan, the operation is visible to external devices as 335originating from a randomized MAC address.</p> 336 337<h2 id="behavior-apk-validation">APK Validation</h2> 338<p>The platform now performs stricter validation of APKs. An APK is considered corrupt if a file is 339declared in the manifest but not present in the APK itself. An APK must be re-signed if any of the 340contents are removed.</p> 341 342<h2 id="behavior-usb">USB Connection</h2> 343<p>Device connections through the USB port are now set to charge-only mode by default. To access 344the device and its content over a USB connection, users must explicitly grant permission for such 345interactions. If your app supports user interactions with the device over a USB port, take into 346consideration that the interaction must be explicitly enabled. 347</p> 348 349<h2 id="behavior-afw">Android for Work Changes</h2> 350<p>This preview includes the following behavior changes for Android for Work:</p> 351<ul> 352 <li><strong>Work contacts in personal contexts.</strong> The Google Dialer 353Call Log now displays work contacts when the user views past calls. 354Setting 355{@link android.app.admin.DevicePolicyManager#setCrossProfileCallerIdDisabled(android.content.ComponentName, boolean) setCrossProfileCallerIdDisabled()} 356to {@code true} hides the work profile contacts in the Google Dialer Call Log. Work contacts can be 357displayed along with personal contacts to devices over Bluetooth only if 358you set {@link android.app.admin.DevicePolicyManager#setBluetoothContactSharingDisabled(android.content.ComponentName, boolean) 359setBluetoothContactSharingDisabled()} to {@code false}. By default, it is set to {@code true}. 360 </li> 361 <li><strong>Wi-Fi configuration removal:</strong> Wi-Fi configurations added by a Profile Owner 362(for example, through calls to the 363{@link android.net.wifi.WifiManager#addNetwork(android.net.wifi.WifiConfiguration) 364addNetwork()} method) are now removed if that work profile is deleted. 365 </li> 366 <li><strong>Wi-Fi configuration lockdown:</strong> Any Wi-Fi configuration created by 367 an active Device Owner can no longer be modified or deleted by the user if 368 {@link android.provider.Settings.Global#WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN} is non-zero. 369 The user can still create and modify their own Wi-Fi configurations. Active Device 370 Owners have the privilege of editing or removing any Wi-Fi configurations, including 371 those not created by them. 372 </li> 373<li><strong>Download Work Policy Controller via Google account addition:</strong> When a Google 374account that requires management via a Work Policy Controller (WPC) app is added to a device 375outside of a managed context, the add account flow now prompts the user to install the 376appropriate WPC. This behavior also applies to accounts added via 377<strong>Settings > Accounts</strong> and in the initial device setup wizard.</li> 378<li><strong>Changes to specific {@link android.app.admin.DevicePolicyManager} API behaviors:</strong> 379 <ul> 380 <li>Calling the 381{@link android.app.admin.DevicePolicyManager#setCameraDisabled(android.content.ComponentName,boolean) setCameraDisabled()} 382method affects the camera for the calling user only; calling it from the managed profile doesn’t 383affect camera apps running on the primary user.</li> 384 <li>In addition, the 385{@link android.app.admin.DevicePolicyManager#setKeyguardDisabledFeatures(android.content.ComponentName,int) setKeyguardDisabledFeatures()} 386 method is now available for Profile Owners, as well as to Device Owners. </li> 387 <li>A Profile Owner can set these keyguard restrictions: 388 <ul> 389 <li>{@link android.app.admin.DevicePolicyManager#KEYGUARD_DISABLE_TRUST_AGENTS} and 390 {@link android.app.admin.DevicePolicyManager#KEYGUARD_DISABLE_FINGERPRINT}, which affect the 391 keyguard settings for the profile’s parent user.</li> 392 <li>{@link android.app.admin.DevicePolicyManager#KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS}, which 393 only affects notifications generated by applications in the managed profile.</li> 394 </ul> 395 </li> 396 <li>The {@link android.app.admin.DevicePolicyManager#createAndInitializeUser(android.content.ComponentName, java.lang.String, java.lang.String, android.content.ComponentName, android.os.Bundle) createAndInitializeUser()} and {@link android.app.admin.DevicePolicyManager#createUser(android.content.ComponentName, java.lang.String) createUser()} methods have been deprecated.</li> 397 <li>The {@link android.app.admin.DevicePolicyManager#setScreenCaptureDisabled(android.content.ComponentName, boolean) setScreenCaptureDisabled()} 398method now also blocks the assist structure when an app of the given user is in the foreground. </li> 399 <li>{@link android.app.admin.DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM} 400now defaults to SHA-256. SHA-1 is still supported for backwards compatibility but will be removed 401in future. 402{@link android.app.admin.DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM} 403now only accepts SHA-256.</li> 404 <li>Device initializer APIs which existed in the M Developer Preview are now removed.</li> 405 <li><code>EXTRA_PROVISIONING_RESET_PROTECTION_PARAMETERS</code> is removed so NFC bump 406provisioning cannot programmatically unlock a factory reset protected device.</li> 407<li>You can now use the {@link android.app.admin.DevicePolicyManager#EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE} 408extra to pass data to the device owner app during NFC provisioning of the managed device.</li> 409 <li>Android for Work APIs are optimized for M runtime permissions, including Work profiles, 410assist layer, and others. New {@link android.app.admin.DevicePolicyManager} permission APIs don't 411affect pre-M apps.</li> 412<li>When users back out of the synchronous part of the setup flow initiated through an 413{@link android.app.admin.DevicePolicyManager#ACTION_PROVISION_MANAGED_PROFILE} or 414{@link android.app.admin.DevicePolicyManager#ACTION_PROVISION_MANAGED_DEVICE} intent, the system 415now returns a {@link android.app.Activity#RESULT_CANCELED} result code.</li> 416 </ul></li> 417 418<li><strong>Changes to other APIs</strong>: 419<ul> 420 <li>Data Usage: The {@code android.app.usage.NetworkUsageStats} class has been renamed 421{@link android.app.usage.NetworkStats}.</li> 422</ul> 423 </li> 424 425 <li><strong>Changes to global settings</strong>: 426 <ul> 427 <li>These settings can no longer be set via {@link android.app.admin.DevicePolicyManager#setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String) setGlobalSettings()}</code>: 428<ul> 429 <li><code>BLUETOOTH_ON</code></li> 430 <li><code>DEVELOPMENT_SETTINGS_ENABLED</code></li> 431 <li><code>MODE_RINGER</code></li> 432 <li><code>NETWORK_PREFERENCE</code></li> 433 <li><code>WIFI_ON</code></li> 434</ul> 435 </li> 436 <li>These global settings can now be set via {@link android.app.admin.DevicePolicyManager#setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String) setGlobalSettings()}: 437 <ul> 438 <li>{@link android.provider.Settings.Global#WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN}</li> 439 </ul> 440 </li> 441 </ul> 442</ul> 443