To verify and debug the Bluetooth stack, use the tools provided in AOSP and the Bluetooth Special Interest Group's (SIG) tests.
Testing and verifying
To test the Bluetooth stack, AOSP provides a mix of unit tests, CTS tests, and tools for the Bluetooth Profile Tuning Suite.
Unit tests in AOSP
AOSP includes functional and unit tests for the default
Bluetooth stack. These tests are located in
To run the AOSP tests, do the following:
- Stop the Android runtime:
adb shell stop
- From the test directory, run the shell executable file and
include options if you want to run a specific test or test suite:
./run_unit_tests.sh TEST_GROUP_NAME TEST_NAME OPTIONS
- When the tests finish, re-enable the Android runtime:
adb shell start
The list of test names can be found in
Android Comms Test Suite
The Android Comms Test Suite (ACTS) performs automated testing of
connectivity stacks, such as Wi-Fi, Bluetooth, and cellular services.
The testing tool requires adb and python, and it can be found in
The ACTS tests for Bluetooth and Bluetooth Low Energy are found in
Profile Tuning Suite
The Bluetooth SIG provides the Bluetooth Profile Tuning Suite (PTS), a testing tool for protocol and profile interoperability. For more information, see the Bluetooth Profile Tuning Suite site.
AOSP provides additional tools to complement the Bluetooth PTS.
These tools are located in
The Compatibility Test Suite (CTS)
includes tests for the Bluetooth stack. These are located in
AOSP provides different methods of debugging a device's Bluetooth stack, including logs and bug reports. These methods may not work for issues that cannot be reproduced or for audio issues, which can be affected by multiple parts of the platform and device.
Debugging with bug reports
To check the Bluetooth service status using
use the following command:
adb shell dumpsys bluetooth_manager
By default, all log messages are trace level 2.
To find out more about the logging levels and change the logging levels
for different profiles, look in
To extract snoop logs from the bug report, use the
- Extract the text version of the bug report.
btsnooz.pyon the text version of the bug report:
btsnooz.py BUG_REPORT.txt > BTSNOOP.log
Debugging with logs
In Android 4.4 and later, you can manually collect BTSnoop logs,
which resemble the snoop format in RFC 1761. These logs capture the
Host Controller Interface (HCI) packets.
For most Android devices, the logs are stored in
For privacy reasons, always-on, "in-memory" BTSnoop only logs non-personal information and events. To log all data, the user needs to enable Bluetooth HCI snoop by doing the following:
- Enable Developer options on the device.
- In the Developer options menu, activate the Enable Bluetooth HCI snoop log toggle.
- Restart Bluetooth for logging to take effect.