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