行为变更:所有应用

Android 15 平台包含一些行为变更,这些变更可能会影响您的应用。以下行为变更将影响在 Android 15 上运行的所有应用,无论采用哪种 targetSdkVersion 都不例外。您应该测试您的应用,然后根据需要进行修改,以适当地支持这些变更。

此外,请务必查看仅影响以 Android 15 为目标平台的应用的行为变更列表。

核心功能

Android 15 修改或扩展了 Android 系统的各种核心功能。

软件包已停止状态变更

The intention of the package FLAG_STOPPED state (which users can engage in AOSP builds by long-pressing an app icon and selecting "Force Stop") has always been to keep apps in this state until the user explicitly removes the app from this state by directly launching the app or indirectly interacting with the app (through the sharesheet or a widget, selecting the app as live wallpaper, etc.). In Android 15, we are updating the behavior of the system to be aligned with this intended behavior. Apps should only be removed from the stopped state through direct or indirect user action.

To support the intended behavior, in addition to the existing restrictions, the system will also cancel all pending intents when the app enters the stopped state on Android 15. When the user's actions remove the app from the stopped state, the ACTION_BOOT_COMPLETED broadcast will be delivered to the app providing an opportunity to re-register any pending intents.

You can call the new ApplicationStartInfo.wasForceStopped() method to confirm whether the app was put into the stopped state.

摄像头和媒体

Android 15 对所有应用的相机和媒体行为进行了以下更改。

现在,达到资源限制时,直接播放和分流音频播放会使之前打开的直接或分流音轨失效

Before Android 15, if an app requested direct or offload audio playback while another app was playing audio and the resource limits were reached, the app would fail to open a new AudioTrack.

Beginning with Android 15, when an app requests direct or offload playback and the resource limits are reached, the system invalidates any currently open AudioTrack objects which prevent fulfilling the new track request.

(Direct and offload audio tracks are typically opened for playback of compressed audio formats. Common use-cases for playing direct audio include streaming encoded audio over HDMI to a TV. Offload tracks are typically used to play compressed audio on a mobile device with hardware DSP acceleration.)

废弃

随着每个版本的发布,特定的 Android API 可能会过时,或需要进行重构,以提供更好的开发者体验或支持新的平台功能。在这些情况下,我们会正式弃用过时的 API,并引导开发者改用替代 API。

弃用意味着我们已结束对这些 API 的官方支持,但开发者可继续访问这些 API。如需详细了解此 Android 版本中的重要弃用,请参阅弃用页面