自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
企業 OTA 更新
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Android 相容性定義說明文件 (CDD) 可更新軟體要求裝置實作 SystemUpdatePolicy
類別。SystemUpdatePolicy
可讓裝置擁有者 (DO) 應用程式 (如有) 控管系統更新的安裝作業。
通知裝置擁有者
無線更新 (OTA) 用戶端必須使用系統 API 通知裝置擁有者的應用程式,有關即將到來的 OTA 更新。OTA 用戶端也必須包含 OTA 更新首次推出時的時間戳記記錄。OTA 用戶端可以呼叫 DevicePolicyManager.notifyPendingSystemUpdate(long updateReceivedTime, boolean isSecurityPatch)
來通知裝置擁有者的應用程式。如果 OTA 用戶端不知道更新是否為安全性修補程式,則 OTA 用戶端可改用 DevicePolicyManager.notifyPendingSystemUpdate(long updateReceivedTime)
。
如果目前沒有可用的更新,OTA 用戶端會將 updateReceivedTime
引數設為 -1
,以便回報這項資訊。建議您在 OTA 用戶端輪詢 OTA 伺服器,或 OTA 推送至用戶端時,一律傳送通知。您也可以更頻繁地傳送通知。
系統更新政策
Android 9 可讓裝置擁有者控制更新,因為它允許裝置擁有者將 OTA 更新延後至最長 90 天。這項功能著重於專用裝置 (先前稱為 COSU) 解決方案,可讓裝置擁有者在假期等重要期間暫停裝置上的作業系統版本。
為遵守 CDD,OTA 用戶端必須導入行為政策。DO 可以設定下列政策,裝置系統更新子系統必須遵守這些政策:
裝置擁有者也可以在 Android 9 以上版本中設定凍結期間,在假期或其他繁忙時段凍結作業系統版本。系統不會在凍結期間安裝 OTA 更新。建議您使用 SystemUpdatePolicy.InstallationOption
(請參閱下一節),不過 OTA 用戶端也可以呼叫 SystemUpdatePolicy.getFreezePeriods()
,檢查裝置是否處於凍結期。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# Enterprise OTA updates\n\nThe\n[Android\nCompatibility Definition Document (CDD) Updatable Software](/compatibility/android-cdd#11_updatable_software)\nrequires devices to implement the\n[`SystemUpdatePolicy`](https://developer.android.com/reference/android/app/admin/SystemUpdatePolicy.html)\nclass. `SystemUpdatePolicy` lets the device owner (DO) app, if\npresent, control the installation of system updates.\n\nNotify device owners\n--------------------\n\n\nThe over-the-air (OTA) client must notify device owner apps about\nincoming OTA updates using a system API. The OTA client must also\ninclude a timestamp recording when the OTA update first became\navailable. OTA clients can call\n`DevicePolicyManager.notifyPendingSystemUpdate(long updateReceivedTime, boolean isSecurityPatch)`\nto notify device owner apps. If the OTA client doesn't know if an update\nis a security patch, the OTA client can fall back to using\n`DevicePolicyManager.notifyPendingSystemUpdate(long updateReceivedTime)`.\n\n\nIf an update isn't currently available, the OTA client reports this by\nsetting the `updateReceivedTime` argument to `-1`.\nWe recommend sending notifications whenever the OTA client polls the\nOTA server, or when an OTA is pushed to the client. You can also send\nout notifications more frequently.\n\nSystem update policy\n--------------------\n\n\nAndroid 9 enhances the ability for device\nowners to\n[control\nupdates](https://developer.android.com/work/dpc/system-updates) by allowing device owners to postpone OTA updates for up to\n90 days. Focusing on dedicated device (previously called COSU)\nsolutions, this feature lets owners pause the OS version running on\ndevices over critical periods, such as holidays.\n\n\nTo comply with the CDD, the OTA client must implement behavioral\npolicies. The DO can set the following policies, which must be\nrespected by the device system update subsystems:\n\n- [`TYPE_INSTALL_AUTOMATIC`](https://developer.android.com/reference/android/app/admin/SystemUpdatePolicy.html#TYPE_INSTALL_AUTOMATIC)\n- [`TYPE_INSTALL_WINDOWED`](https://developer.android.com/reference/android/app/admin/SystemUpdatePolicy.html#TYPE_INSTALL_WINDOWED)\n- [`TYPE_POSTPONE`](https://developer.android.com/reference/android/app/admin/SystemUpdatePolicy.html#TYPE_POSTPONE)\n\n\nDevice owners can also\n[set\nfreeze periods](https://developer.android.com/work/dpc/system-updates#freeze-periods) (in Android 9 or later) that freeze the OS version\nover critical periods, such as holidays or other busy times. The system\ndoesn't install OTA updates during a freeze period. We recommend using\n`SystemUpdatePolicy.InstallationOption` (see\nfollowing section), however the OTA client can also call\n[`SystemUpdatePolicy.getFreezePeriods()`](https://developer.android.com/reference/android/app/admin/SystemUpdatePolicy#getFreezePeriods())\nto check if the device is in a freeze period."]]