自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
OTA 更新
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
正常使用的 Android 设备可以接收和安装系统、应用软件和时区规则的无线下载 (OTA) 更新。本部分介绍了更新软件包的结构以及所提供的用于构建更新软件包的工具。这些内容专供有以下需求的开发者参考:需要将 OTA 更新用于新的 Android 设备以及需要为已发布的设备构建更新软件包。
OTA 更新旨在升级底层操作系统、system 分区上安装的只读应用,以及时区规则;这些更新不会影响用户从 Google Play 安装的应用。
虚拟 A/B(无缝)系统更新
在更新期间,新型 Android 设备(Android 11 及更高版本)会维护每个分区的两个副本(A 和 B)。这种更新机制称为带压缩功能的虚拟 A/B。虽然旧版 A/B 更新(Android 10 及更低版本)会为每个分区保留两个副本,但虚拟 A/B 仅会为启动关键分区保留两个物理槽位。启动关键分区数据会直接写入至未使用的槽位。由于动态分区的映像大小往往要大得多,因此会将新的操作系统数据以压缩快照的形式写入。压缩快照可让设备模拟拥有两个槽位的体验,同时减少空间需求。如需详细了解虚拟 A/B OTA 更新,请参阅虚拟 A/B(无缝)系统更新。如需查看示例应用以了解如何使用 Android 系统更新 API(即 update_engine
)安装 A/B 更新,请参阅 SystemUpdaterSample(updater_sample/README.md
中提供了应用详情)。
旧版 A/B 更新和非 A/B 系统更新
旧版 A/B 更新是 Android 中的第一版 A/B 更新。此更新机制保留了每个分区的两个槽位,但缺点是每个分区都需要两倍的存储空间。如需了解详情,请参阅 A/B 系统更新。从 Android 15 开始,非 A/B 更新已废弃。如需了解详情,请参阅非 A/B 系统更新。
时区规则更新
从 Android 8.1 开始,OEM 可以将更新后的时区规则数据推送至设备,而不必进行系统更新。此机制使用户能够及时获得更新(从而延长 Android 设备的使用期限),并且使 OEM 能够独立于系统映像更新来测试时区更新。如需了解详情,请参阅时区规则。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-26。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-26。"],[],[],null,["# OTA updates\n\nAndroid devices in the field can receive and install over-the-air (OTA) updates to the system,\napp software, and time zone rules. This section describes the structure of update packages and\nthe tools provided to build them. It is intended for developers who want to make OTA updates\nwork on new Android devices and those who want to build update packages for released devices.\n\n\nOTA updates are designed to upgrade the underlying operating system, the read-only apps\ninstalled on the system partition, and time zone rules; these updates do *not* affect\napps installed by the user from Google Play.\n\nVirtual A/B (seamless) system updates\n-------------------------------------\n\n\nModern Android devices (Android 11 and after) maintain two copies of each partition (A and B) during an update. This\nupdate mechanism is called Virtual A/B with compression. While legacy A/B updates (Android 10 and earlier) kept two\ncopies for every single partition, Virtual A/B only keeps two physical slots for boot critical\npartitions. The unused slot is written to directly for bootcritical partitions. Dynamic\npartitions have new operating system data written as compressed snapshots since their image\nsize tends to be much larger. Compressed snapshots allows a device to simulate the experience\nof having two slots, while reducing space requirements. For more information about Virtual A/B\nOTA updates, see\n[Virtual A/B (seamless) system updates](/docs/core/ota/virtual_ab). For\na sample app that provides examples on using Android system update APIs (that is,\n`update_engine`) to install A/B updates, refer to\n[SystemUpdaterSample](https://android.googlesource.com/platform/bootable/recovery/+/android16-release/updater_sample/)\n(app details available in\n[`updater_sample/README.md`](https://android.googlesource.com/platform/bootable/recovery/+/android16-release/updater_sample/README.md)).\n\nLegacy A/B updates and Non-A/B system updates\n---------------------------------------------\n\n\nLegacy A/B updates were the first version of A/B updates in Android. This update mechanism\nkept two slots of every single partition, but had the drawback of needing twice the storage\nfor each partition. For more information see,\n[A/B system updates](/docs/core/ota/ab). As of\nAndroid 15, non A/B updates are deprecated. For more information, see\n[Non-A/B system updates](/docs/core/ota/nonab).\n\nTime zone rule updates\n----------------------\n\n\nAs of Android 8.1, OEMs can push updated time zone rules data to devices without requiring a\nsystem update. This mechanism enables users to receive timely updates (thus extending the\nuseful lifetime of an Android device) and OEMs to test time zone updates independently of\nsystem image updates. For details, see\n[Time zone rules](/docs/core/permissions/timezone-rules)."]]