自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
OTA 更新
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
現場的 Android 裝置可以接收並安裝無線 (OTA) 更新,以更新系統、應用程式軟體和時區規則。本節將說明更新套件的結構,以及用於建構更新套件的工具。這項工具適用於希望讓 OTA 更新在新的 Android 裝置上運作的開發人員,以及希望為已發布的裝置建構更新套件的開發人員。
OTA 更新旨在升級基礎作業系統、系統分區中安裝的唯讀應用程式,以及時區規則;這些更新不會影響使用者從 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 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","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"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],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)."]]