行为变更:所有应用

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 对所有应用的相机和媒体行为进行了以下更改。

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

在 Android 15 之前,如果某个应用在另一个应用正在播放音频时请求直接播放或分流音频播放,并且已达到资源限制,此应用将无法打开新的 AudioTrack

从 Android 15 开始,当应用请求直接或分流播放并且达到资源限制时,系统会使当前打开的所有 AudioTrack 对象失效,从而阻止执行新的轨道请求。

(直接和分流音轨通常会打开,以播放压缩的音频格式。播放直接音频的常见用例包括通过 HDMI 将编码音频流式传输到电视。分流轨道通常用于在具有硬件 DSP 加速的移动设备上播放压缩音频。)

废弃

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

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