ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
การอัปเดต OTA สำหรับองค์กร
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ซอฟต์แวร์ที่อัปเดตได้ของเอกสารนิยามความเข้ากันได้ (CDD) ของ Android กำหนดให้อุปกรณ์ต้องใช้คลาส SystemUpdatePolicy
SystemUpdatePolicy
อนุญาตให้แอปเจ้าของอุปกรณ์ (DO) (หากมี) ควบคุมการติดตั้งการอัปเดตระบบ
แจ้งให้เจ้าของอุปกรณ์ทราบ
ไคลเอ็นต์การอัปเดตผ่านอากาศ (OTA) ต้องแจ้งให้แอปเจ้าของอุปกรณ์ทราบเกี่ยวกับการอัปเดต OTA ที่กำลังจะมาถึงโดยใช้ API ของระบบ นอกจากนี้ ไคลเอ็นต์ 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) ซึ่งช่วยให้เจ้าของสามารถหยุดเวอร์ชันระบบปฏิบัติการที่ทำงานในอุปกรณ์ไว้ชั่วคราวในช่วงที่มีเวลาจำกัด เช่น ช่วงวันหยุด
ลูกค้า OTA ต้องใช้นโยบายด้านพฤติกรรมเพื่อปฏิบัติตาม CDD DO สามารถกำหนดนโยบายต่อไปนี้ ซึ่งระบบย่อยการอัปเดตระบบของอุปกรณ์ต้องปฏิบัติตาม
นอกจากนี้ เจ้าของอุปกรณ์ยังตั้งค่าช่วงหยุด (ใน Android 9 ขึ้นไป) ซึ่งจะหยุดเวอร์ชันระบบปฏิบัติการไว้ชั่วคราวได้ในช่วงที่มีเวลาจำกัด เช่น ช่วงวันหยุดหรือช่วงเวลาอื่นๆ ที่ยุ่ง ระบบจะไม่ติดตั้งการอัปเดต OTA ในช่วงหยุดทำงาน เราขอแนะนำให้ใช้ SystemUpdatePolicy.InstallationOption
(ดูส่วนต่อไปนี้) แต่ไคลเอ็นต์ OTA ยังเรียกใช้ SystemUpdatePolicy.getFreezePeriods()
เพื่อตรวจสอบว่าอุปกรณ์อยู่ในระยะเวลาที่หยุดทำงานหรือไม่
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","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 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."]]