Skip to content

Most visited

Recently visited

navigation

Android O Behavior Changes

Along with new features and capabilities, Android O includes a variety of system and API behavior changes. This document highlights some of the key changes that you should understand and account for in your apps.

Most of these changes affect all apps, regardless of what version of Android they target. However, several changes only affect apps targeting Android O. To maximize clarity, this page is divided into two sections: Apps targeting all API levels and Apps targeting Android O.

Apps targeting all API levels

These behavior changes apply to all apps when they run on the Android O platform, regardless of the API level that they are targeting. All developers should review these changes and modify their apps to support them properly, where applicable to the app.

Background execution limits

As one of the changes that Android O introduces to improve battery life, when your app enters the cached state, with no active components, the system releases any wakelocks that the app holds.

Android background location limits

In order to preserve battery, user experience, and system health, background apps receive location updates less frequently when used on a device running Android O. This behavior change affects all apps that receive location updates, including Google Play services.

These changes affect the following APIs:

Android O also includes the following changes to specific methods:

To ensure that your app runs as expected, complete the following steps:

For more information about these changes, see Background Location Limits.

Bluetooth

Android O makes the following changes to the length of the data that the ScanRecord.getBytes() method retrieves:

Input and navigation

With the advent of Android apps on Chrome OS and other large form factors, such as tablets, we're seeing a resurgence of keyboard navigation use within Android apps. Within Android O, we've re-addressed using the keyboard as a navigation input device, resulting in a more reliable, predictable model for arrow- and tab-based navigation.

To learn how to improve support for keyboard navigation within your app, read the Supporting Keyboard Navigation guide.

Accessibility

Accessibility services are now aware of all ClickableSpan instances within your app's TextView objects.

To learn more about how to make your app more accessible, see Accessibility.

Security

Android O includes the following security-related changes:

For additional guidelines on making your app more secure, see Security for Android Developers.

Privacy

Android O makes the following privacy-related changes to the platform.

Networking and HTTP(S) connectivity

Android O includes the following behavior changes to networking and HTTP(S) connectivity:

Logging of uncaught exceptions

If an app installs a Thread.UncaughtExceptionHandler that does not call through to the default Thread.UncaughtExceptionHandler, the system does not kill the app when an uncaught exception occurs. Starting from Android O, the system logs the exception stacktrace in this situation; in earlier versions of the platform, the system would not have logged the exception stacktrace.

We recommend that custom Thread.UncaughtExceptionHandler implementations always call through to the default handler; apps that follow this recommendation are unaffected by the change in Android O.

Collection handling

AbstractCollection.removeAll() and AbstractCollection.retainAll() now always throw a NullPointerException; previously, the NullPointerException was not thrown when the collection was empty. This change makes the behavior consistent with the documentation.

Locales and internationalization

Android 7.0 (API level 24) introduced the concept of being able to specify a default Category Locale, but some APIs continued to use the generic Locale.getDefault() method, without arguments, when they should have instead used default DISPLAY category Locale. In Android O, the following methods now use Locale.getDefault(Category.DISPLAY) instead of Locale.getDefault():

Locale.getDisplayScript(Locale) also falls back to Locale.getDefault() when the displayScript value specified for the Locale argument is not available.

Additional locale and internationalization-related changes are as follows:

Contacts provider usage stats change

In previous versions of Android, the Contacts Provider component allows developers to get usage data for each contact. This usage data exposes information for each email address and each phone number associated with a contact, including the number of times the contact has been contacted and the last time the contact was contacted. Apps that request the READ_CONTACTS permission can read this data.

Apps can still read this data if they request READ_CONTACTS permission. Starting in Android O, queries for usage data return approximations rather than exact values. The Android system maintains the exact values internally, so this change does not affect the auto-complete API.

This behavior change affects the following query parameters:

App shortcuts

Android O includes the following changes to app shortcuts:

To learn more about changes to app shortcuts, see the Pinning Shortcuts and Widgets preview feature guide.

Alert windows

If an app uses the SYSTEM_ALERT_WINDOW permission and uses one of the following window types to attempt to display alert windows above other apps and system windows:

...then these windows always appear beneath the windows that use the TYPE_APPLICATION_OVERLAY window type. If an app targets Android O, the app uses the TYPE_APPLICATION_OVERLAY window type to display alert windows.

For more information, see the Common window types for alert windows section within the behavior changes for Apps Built Against Android O.

Android in the enterprise

Android O contains changes that affect enterprise apps. If you're building apps for businesses, including DPCs (device policy controllers), you should review the changes described in the Android in the Enterprise page and modify your app accordingly.

Apps targeting Android O

These behavior changes apply exclusively to apps that are targeting the O platform or higher. Apps that compile against Android O or higher or set targetSdkVersion to Android O or higher must modify their apps to support these behaviors properly, where applicable to the app.

Background execution limits

To improve device performance, the system limits certain behaviors by apps that are not running in the foreground. Specifically:

For more information, see Background Execution Limits.

Security

If your app's network security configuration opts out of supporting cleartext traffic, your app's WebView objects cannot access websites over HTTP. Each WebView object must use HTTPS instead.

For additional guidelines on making your app more secure, see Security for Android Developers.

Privacy

The following changes affect privacy in Android O.

Permissions

Prior to Android O, if an app requested a permission at runtime and the permission was granted, the system also incorrectly granted the app the rest of the permissions that belonged to the same permission group, and that were registered in the manifest.

For apps targeting Android O, this behavior has been corrected. The app is granted only the permissions it has explicitly requested. However, once the user grants a permission to the app, all subsequent requests for permissions in that permission group are automatically granted.

For example, suppose an app lists both READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE in its manifest. The app requests READ_EXTERNAL_STORAGE and the user grants it. If the app targets API level 24 or lower, the system also grants WRITE_EXTERNAL_STORAGE at the same time, because it belongs to the same STORAGE permission group and is also registered in the manifest. If the app targets Android O, the system grants only READ_EXTERNAL_STORAGE at that time; however, if the app later requests WRITE_EXTERNAL_STORAGE, the system immediately grants that privilege without prompting the user.

Media

Native libraries

In apps targeting Android O, native libraries no longer load if they contain any load segment that is both writable and executable. Some apps might stop working because of this change if they have native libraries with incorrect load segments. This is a security-hardening measure.

For more information, see Writable and Executable Segments.

As with earlier developer-preview releases, Android O also makes all linker-related problems more visible. Linker changes are tied to the API level that an app targets. If there is a linker change at the targeted API level, the app cannot load the library. If you are targeting an API level lower than the API level where the linker change occurs, logcat shows a warning. During a preview release, linker-related problems not only appear in logcat, but also show up as toasts. This change improves visibility of issues before the API level at which a warning becomes an error.

Collection handling

In Android O, Collections.sort() is implemented on top of List.sort(). The reverse was true in Android 7.x (API levels 24 and 25): The default implementation of List.sort() called Collections.sort().

This change allows Collections.sort() to take advantage of optimized List.sort() implementations, but has the following constraints:

Account access and discoverability

Apps can no longer get access to user accounts unless the authenticator owns the accounts or the user grants that access. The GET_ACCOUNTS permission is no longer sufficient. To be granted access to an account, apps should either use AccountManager.newChooseAccountIntent() or an authenticator-specific method. After getting access to accounts, an app can can call AccountManager.getAccounts() to access them.

Android O deprecates LOGIN_ACCOUNTS_CHANGED_ACTION. Apps should instead use addOnAccountsUpdatedListener() to get updates about accounts during runtime.

For information about new APIs and methods added for account access and discoverability, see Account Access and Discoverability in the New APIs section of this document.

Alert windows

Apps that use the SYSTEM_ALERT_WINDOW permission can no longer use the following window types to display alert windows above other apps and system windows:

Instead, apps must use a new window type called TYPE_APPLICATION_OVERLAY.

When using the TYPE_APPLICATION_OVERLAY window type to display alert windows for your app, keep the following characteristics of the new window type in mind:

Content change notifications

Android O changes how ContentResolver.notifyChange() and registerContentObserver(Uri, boolean, ContentObserver) behave for apps targeting Android O.

These APIs now require that a valid ContentProvider is defined for the authority in all Uris. Defining a valid ContentProvider with relevant permissions will help defend your app against content changes from malicious apps, and prevent you from leaking potentially private data to malicious apps.

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.