ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
ยืนยันและแก้ไขข้อบกพร่อง
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หากต้องการยืนยันและแก้ไขข้อบกพร่องของสแต็กบลูทูธ ให้ใช้เครื่องมือที่มีให้ใน AOSP และการทดสอบของ Bluetooth Special Interest Group (SIG)
ทดสอบและยืนยัน
AOSP มีชุดการทดสอบหน่วย การทดสอบ CTS และเครื่องมือสำหรับชุดการปรับแต่งโปรไฟล์บลูทูธเพื่อทดสอบสแต็กบลูทูธ
การทดสอบ 1 หน่วยใน AOSP
AOSP มีการทดสอบฟังก์ชันการทำงานและการทดสอบหน่วยสําหรับสแต็กบลูทูธเริ่มต้น การทดสอบเหล่านี้อยู่ใน
/packages/modules/Bluetooth/system/test/
หากต้องการเรียกใช้การทดสอบ AOSP ให้ทําดังนี้
- หยุดรันไทม์ Android
adb shell stop
- จากไดเรกทอรีทดสอบ ให้เรียกใช้ไฟล์ปฏิบัติการเชลล์และใส่ตัวเลือกหากต้องการเรียกใช้การทดสอบหรือชุดทดสอบที่เฉพาะเจาะจง ดังนี้
./run_unit_tests.sh TEST_GROUP_NAME TEST_NAME OPTIONS
- เมื่อการทดสอบเสร็จสิ้นแล้ว ให้เปิดใช้รันไทม์ Android อีกครั้งโดยทำดังนี้
adb shell start
ดูรายการชื่อการทดสอบได้ใน
/packages/modules/Bluetooth/system/test/README.md
ชุดการปรับแต่งโปรไฟล์
Bluetooth SIG มีชุดเครื่องมือปรับแต่งโปรไฟล์บลูทูธ (PTS) ซึ่งเป็นเครื่องมือทดสอบการทำงานร่วมกันของโปรโตคอลและโปรไฟล์
ดูข้อมูลเพิ่มเติมได้ที่เว็บไซต์
ชุดการปรับแต่งโปรไฟล์บลูทูธ
การทดสอบ CTS
ชุดเครื่องมือทดสอบความเข้ากันได้ (CTS) ประกอบด้วยการทดสอบสแต็กบลูทูธ ซึ่งตั้งอยู่ใน
cts/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth
ตัวเลือกการแก้ไขข้อบกพร่อง
AOSP มีวิธีการต่างๆ ในการแก้ไขข้อบกพร่องสแต็กบลูทูธของอุปกรณ์ ซึ่งรวมถึงบันทึกและรายงานข้อบกพร่อง วิธีการเหล่านี้อาจใช้ไม่ได้กับปัญหาที่ไม่สามารถจำลองได้หรือปัญหาเกี่ยวกับเสียง ซึ่งอาจเกิดจากหลายส่วนของแพลตฟอร์มและอุปกรณ์
การแก้ไขข้อบกพร่องด้วยรายงานข้อบกพร่อง
หากต้องการตรวจสอบสถานะบริการบลูทูธโดยใช้ dumpsys
ให้ใช้คำสั่งต่อไปนี้
adb shell dumpsys bluetooth_manager
โดยค่าเริ่มต้น ข้อความบันทึกทั้งหมดจะเป็นระดับการติดตาม 2
ดูข้อมูลเพิ่มเติมเกี่ยวกับระดับการบันทึกและเปลี่ยนระดับการบันทึกสำหรับโปรไฟล์ต่างๆ ได้ที่
system/bt/conf/bt_stack.conf
หากต้องการดึงข้อมูลบันทึกการสอดแนมจากรายงานข้อบกพร่อง ให้ใช้สคริปต์ btsnooz
- รับ
btsnooz.py
- แยกรายงานข้อบกพร่องเวอร์ชันข้อความ
- เรียกใช้
btsnooz.py
ในรายงานข้อบกพร่องเวอร์ชันข้อความ
btsnooz.py BUG_REPORT.txt > BTSNOOP.log
การแก้ไขข้อบกพร่องด้วยบันทึก
ใน Android 4.4 ขึ้นไป คุณสามารถรวบรวมบันทึก BTSnoop ด้วยตนเองได้ ซึ่งมีลักษณะคล้ายกับรูปแบบ Snoop ใน RFC 1761 บันทึกเหล่านี้จะบันทึกแพ็กเก็ต Host Controller Interface (HCI)
สำหรับอุปกรณ์ Android ส่วนใหญ่ ระบบจะจัดเก็บบันทึกไว้ใน data/misc/bluetooth/logs
BTSnoop ที่เปิดอยู่ตลอดเวลาและ "ในหน่วยความจำ" จะบันทึกเฉพาะข้อมูลและเหตุการณ์ที่ไม่ใช่ข้อมูลส่วนบุคคลเพื่อเหตุผลด้านความเป็นส่วนตัว หากต้องการบันทึกข้อมูลทั้งหมด ผู้ใช้ต้องเปิดใช้การสอดแนม HCI ของบลูทูธโดยทำดังนี้
- เปิดใช้ตัวเลือกสำหรับนักพัฒนาแอปในอุปกรณ์
- ในเมนูตัวเลือกสำหรับนักพัฒนาแอป ให้เปิดปุ่มสลับเปิดใช้บันทึก HCI Snoop ของบลูทูธ
- รีสตาร์ทบลูทูธเพื่อให้การบันทึกมีผล
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-06-26 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-06-26 UTC"],[],[],null,["# Verify and debug\n\nTo verify and debug the Bluetooth stack, use the tools provided in\nAOSP and the Bluetooth Special Interest Group's (SIG) tests.\n\nTest and verify\n---------------\n\nTo test the Bluetooth stack, AOSP provides a mix of unit tests,\nCTS tests, and tools for the Bluetooth Profile Tuning Suite.\n\n### Unit tests in AOSP\n\nAOSP includes functional and unit tests for the default\nBluetooth stack. These tests are located in [/packages/modules/Bluetooth/system/test/](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Bluetooth/system/test/).\nTo run the AOSP tests, do the following:\n\n1. Stop the Android runtime: \n\n ```\n adb shell stop\n ```\n2. From the test directory, run the shell executable file and include options if you want to run a specific test or test suite: \n\n ```\n ./run_unit_tests.sh TEST_GROUP_NAME TEST_NAME OPTIONS\n ```\n3. When the tests finish, re-enable the Android runtime: \n\n ```\n adb shell start\n ```\n\nThe list of test names can be found in [/packages/modules/Bluetooth/system/test/README.md](https://cs.android.com/android/platform/superproject/main/+/main:packages/modules/Bluetooth/system/test/README.md).\n\n### Profile Tuning Suite\n\nThe Bluetooth SIG provides the Bluetooth Profile Tuning Suite (PTS),\na testing tool for protocol and profile interoperability.\nFor more information, see the [Bluetooth Profile Tuning Suite](https://www.bluetooth.com/develop-with-bluetooth/test-tools/profile-tuning-suite) site.\n\n### CTS tests\n\n\nThe [Compatibility Test Suite](/docs/compatibility/cts) (CTS)\nincludes tests for the Bluetooth stack. These are located in [cts/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth](https://cs.android.com/android/platform/superproject/+/android-latest-release:cts/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/).\n\nDebugging options\n-----------------\n\nAOSP provides different methods of debugging a device's\nBluetooth stack, including logs and bug reports. These methods may\nnot work for issues that cannot be reproduced or for audio issues,\nwhich can be affected by multiple parts of the platform and device.\n\n### Debugging with bug reports\n\nTo check the Bluetooth service status using `dumpsys`,\nuse the following command: \n\n```\nadb shell dumpsys bluetooth_manager\n```\n\nBy default, all log messages are trace level 2.\nTo find out more about the logging levels and change the logging levels\nfor different profiles, look in [system/bt/conf/bt_stack.conf](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Bluetooth/system/conf/bt_stack.conf).\n\nTo extract snoop logs from the bug report, use the\n`btsnooz` script.\n\n1. Get [btsnooz.py](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Bluetooth/system/tools/scripts/btsnooz.py).\n2. Extract the text version of the bug report.\n3. Run `btsnooz.py` on the text version of the bug report: \n\n ```\n btsnooz.py BUG_REPORT.txt \u003e BTSNOOP.log\n ```\n\n### Debugging with logs\n\nIn Android 4.4 and later, you can manually collect BTSnoop logs,\nwhich resemble the snoop format in RFC 1761. These logs capture the\nHost Controller Interface (HCI) packets.\nFor most Android devices, the logs are stored in\n`data/misc/bluetooth/logs`.\n\nFor privacy reasons, always-on, \"in-memory\" BTSnoop only logs\nnon-personal information and events. To log all data, the user needs\nto enable Bluetooth HCI snoop by doing the following:\n\n1. Enable **Developer options** on the device.\n2. In the **Developer options** menu, activate the **Enable Bluetooth HCI snoop log** toggle.\n3. Restart Bluetooth for logging to take effect."]]