ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
เปิดใช้การแก้ไขข้อบกพร่อง USB ในบิลด์ของผู้ใช้โดยอัตโนมัติ
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หลังจากแฟลชบิลด์สำหรับผู้ใช้ลงในอุปกรณ์แล้ว คุณต้องเปิดใช้การแก้ไขข้อบกพร่องผ่าน USB อีกครั้ง OmniLab ATS สามารถทําขั้นตอนนี้โดยอัตโนมัติได้โดยใช้การดำเนินการกับอุปกรณ์ AOA ซึ่งจะส่งชุดคําสั่ง UI ไปยังอุปกรณ์
บันทึกคำสั่ง AOA
ก่อนอื่น ให้ใช้เครื่องมือแก้ไขคำสั่ง WebAOA เพื่อบันทึกรายการคำสั่งเพื่อเปิดใช้การแก้ไขข้อบกพร่องผ่าน USB
รูปที่ 1 ลิงก์ไปยังเครื่องมือแก้ไขคำสั่ง WebAOA ใน OmniLab ATS
หรือจะเข้าถึงที่ http://localhost:8000/webaoaก็ได้เช่นกันโดยค่าเริ่มต้น
WebAOA ช่วยให้คุณควบคุมอุปกรณ์ในเครื่องโดยใช้หน้าจอสัมผัสจำลองและบันทึกการโต้ตอบกับ UI ได้
รูปที่ 2 การแก้ไขคําสั่งสําหรับการเปิดใช้การแก้ไขข้อบกพร่องผ่าน USB ใน WebAOA
โดยรองรับคําสั่ง 4 ประเภท ดังนี้
การคลิกและการปัดบนหน้าจอสัมผัส
(click X Y
และ
swipe X1 Y1 DURATION X2 Y2
)
การกดปุ่มของอุปกรณ์ (back
, home
และ wake
)
การเขียนข้อความและการกดแป้นพิมพ์ร่วมกัน (write TEXT
และ key [KEY ...]
)
รอตามระยะเวลาที่ระบุ (sleep DURATION
)
เมื่อบันทึกคำสั่งเสร็จแล้ว คุณสามารถคัดลอกคำสั่งไปยังคลิปบอร์ดหรือบันทึกลงในไฟล์ได้
สร้างการทำงานของอุปกรณ์ AOA
หากต้องการเปิดใช้การแก้ไขข้อบกพร่องผ่าน USB อีกครั้งโดยอัตโนมัติ คุณต้องเพิ่มคําสั่งที่บันทึกไว้ในการดําเนินการของอุปกรณ์
สร้างการกระทําของอุปกรณ์ใหม่ และใส่ TF Target Preparer โดยตั้งชื่อคลาสเป็น com.android.tradefed.targetprep.AoaTargetPreparer
คัดลอกคําสั่งที่บันทึกไว้ใน WebAOA ลงในตัวเลือก action
รูปที่ 3 การดำเนินการของอุปกรณ์ AOA เพื่อเปิดใช้การแก้ไขข้อบกพร่องผ่าน USB ใน GSI ของ Android 10
ใช้การทำงานของอุปกรณ์ AOA
เมื่อกําหนดเวลาการเรียกใช้การทดสอบ ให้เพิ่มการดําเนินการของอุปกรณ์ AOA และวางไว้หลังการดําเนินการแฟลชอุปกรณ์โดยตรง
รูปที่ 4 กำหนดเวลาการเรียกใช้เพื่อแฟลชบิลด์ของผู้ใช้และเปิดใช้การแก้ไขข้อบกพร่องผ่าน USB อีกครั้ง
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา 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,["# Enable USB debugging on user builds automatically\n\nAfter flashing a user build onto a device, you need to re-enable USB\ndebugging. OmniLab ATS can automate this step using *AOA device actions*, which\nsend a series of UI commands to a device.\n| **Note:** This procedure uses the [Android Open Accessory protocol](/docs/core/interaction/accessories/protocol), which supports Android 4.1+ and doesn't require ADB.\n\nRecord the AOA commands\n-----------------------\n\nFirst, use the *WebAOA command editing tool* to record the list of commands to\nenable USB debugging.\n\n**Figure 1.** Link to the WebAOA command editing tool in OmniLab ATS.\n\nIt is also accessible at \u003chttp://localhost:8000/webaoa\u003e\nby default.\n\nWebAOA lets you manipulate a local device using a simulated touchscreen and\nrecord your UI interactions.\n\n**Figure 2.** Editing the commands for enabling USB debugging in WebAOA.\n\nFour types of commands are supported:\n\n- Clicking and swiping on the touchscreen\n (`click `\u003cvar translate=\"no\"\u003eX\u003c/var\u003e` `\u003cvar translate=\"no\"\u003eY\u003c/var\u003e and\n `swipe `\u003cvar translate=\"no\"\u003eX1\u003c/var\u003e` `\u003cvar translate=\"no\"\u003eY1\u003c/var\u003e` `\u003cvar translate=\"no\"\u003eDURATION\u003c/var\u003e` `\u003cvar translate=\"no\"\u003eX2\u003c/var\u003e` `\u003cvar translate=\"no\"\u003eY2\u003c/var\u003e)\n\n- Pressing device buttons (`back`, `home`, and `wake`)\n\n- Writing text and pressing key combinations\n (`write `\u003cvar translate=\"no\"\u003eTEXT\u003c/var\u003e and\n `key [`\u003cvar translate=\"no\"\u003eKEY\u003c/var\u003e` ...]`)\n\n- Waiting for a specified duration (`sleep `\u003cvar translate=\"no\"\u003eDURATION\u003c/var\u003e)\n\nWhen you are finished recording commands, you can copy them to your clipboard or\nsave them to a file.\n\nCreate an AOA device action\n---------------------------\n\nTo automatically re-enable USB debugging, the recorded commands need to be added\nto a device action.\n\n[Create a new device action](/docs/core/tests/development/android-test-station/ats-user-guide#create-a-new-device-action) and\nadd a TF Target Preparer with its class name set to\n[`com.android.tradefed.targetprep.AoaTargetPreparer`](/reference/tradefed/com/android/tradefed/targetprep/AoaTargetPreparer).\nCopy the commands recorded in WebAOA into its `action` option.\n\n**Figure 3.** AOA device action for enabling USB debugging on Android 10 GSI.\n\nUse an AOA device action\n------------------------\n\nWhen scheduling a test run, add your AOA device action and place it directly\nafter your device-flashing action.\n\n**Figure 4.** Scheduling a run to flash a user build and re-enable USB\ndebugging."]]