Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release
thay vì aosp-main
để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Bản cập nhật OTA cho doanh nghiệp
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Phần mềm có thể cập nhật theo Tài liệu định nghĩa về khả năng tương thích (CDD) với Android yêu cầu các thiết bị phải triển khai lớp SystemUpdatePolicy
. SystemUpdatePolicy
cho phép ứng dụng chủ sở hữu thiết bị (DO), nếu có, kiểm soát việc cài đặt bản cập nhật hệ thống.
Thông báo cho chủ sở hữu thiết bị
Ứng dụng qua mạng không dây (OTA) phải thông báo cho ứng dụng của chủ sở hữu thiết bị về các bản cập nhật OTA sắp tới bằng API hệ thống. Ứng dụng OTA cũng phải bao gồm bản ghi dấu thời gian khi bản cập nhật OTA được cung cấp lần đầu tiên. Ứng dụng OTA có thể gọi DevicePolicyManager.notifyPendingSystemUpdate(long updateReceivedTime, boolean isSecurityPatch)
để thông báo cho các ứng dụng của chủ sở hữu thiết bị. Nếu ứng dụng OTA không biết liệu bản cập nhật có phải là bản vá bảo mật hay không, thì ứng dụng OTA có thể quay lại sử dụng DevicePolicyManager.notifyPendingSystemUpdate(long updateReceivedTime)
.
Nếu hiện không có bản cập nhật, ứng dụng OTA sẽ báo cáo điều này bằng cách đặt đối số updateReceivedTime
thành -1
.
Bạn nên gửi thông báo bất cứ khi nào ứng dụng OTA thăm dò ý kiến máy chủ OTA hoặc khi một OTA được đẩy đến ứng dụng. Bạn cũng có thể gửi thông báo thường xuyên hơn.
Chính sách cập nhật hệ thống
Android 9 giúp chủ sở hữu thiết bị kiểm soát bản cập nhật bằng cách cho phép họ hoãn bản cập nhật OTA lên đến 90 ngày. Tập trung vào các giải pháp thiết bị chuyên dụng (trước đây gọi là COSU), tính năng này cho phép chủ sở hữu tạm dừng phiên bản hệ điều hành chạy trên thiết bị trong những khoảng thời gian quan trọng, chẳng hạn như ngày lễ.
Để tuân thủ CDD, ứng dụng OTA phải triển khai các chính sách về hành vi. DO có thể đặt các chính sách sau đây mà các hệ thống con cập nhật hệ thống thiết bị phải tuân thủ:
Chủ sở hữu thiết bị cũng có thể đặt khoảng thời gian đóng băng (trong Android 9 trở lên) để đóng băng phiên bản hệ điều hành trong những khoảng thời gian quan trọng, chẳng hạn như ngày lễ hoặc những thời điểm bận rộn khác. Hệ thống không cài đặt bản cập nhật OTA trong khoảng thời gian đóng băng. Bạn nên sử dụng SystemUpdatePolicy.InstallationOption
(xem phần sau), tuy nhiên ứng dụng OTA cũng có thể gọi SystemUpdatePolicy.getFreezePeriods()
để kiểm tra xem thiết bị có đang trong thời gian đóng băng hay không.
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],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."]]