[[["易于理解","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"]],["最后更新时间 (UTC):2025-03-26。"],[],[],null,["# Test, debug, and tune Wi-Fi\n\nThis page describes how to test, debug, and tune the Wi-Fi implementation using\nthe tools provided in AOSP.\n\nTesting\n-------\n\nTo test the Wi-Fi framework, AOSP provides a mix of unit tests and CTS tests.\n\n### Unit tests\n\nAOSP includes functional and unit tests for the default Wi-Fi framework: both\nfor the Wi-Fi Manager (app-side code) and the Wi-Fi Service.\n\nWi-Fi Manager tests:\n\n- Located in `packages/modules/Wifi/framework/tests/`\n- Run using the following shell executable (read the file for more execution\n options):\n\n atest FrameworksWifiApiTests\n\nWi-Fi Service tests:\n\n- Located in `packages/modules/Wifi/service/tests/wifitests/`\n- Run using the following shell executable (read the file for more execution\n options):\n\n atest FrameworksWifiTests\n\n### CTS tests\n\nThe [Compatibility Test Suite](/docs/compatibility/cts) (CTS) includes tests for the\nWi-Fi framework. These are located in\n`cts/tests/tests/net/src/android/net/wifi`. The Wi-Fi CTS tests require the\ndevice-under-test to be associated with an Access Point at the start of the test\nrun.\n\nEnhanced logging options for debugging\n--------------------------------------\n\nAndroid 9 improved Wi-Fi logging to make it easier to\ndebug Wi-Fi issues. In Android 9 or higher,\ndriver or firmware ring buffers can always be on. Bug reports can automatically\nbe triggered when a bad state is detected (only in userdebug and eng builds).\nWhen the Wi-Fi HAL (AIDL or HIDL version 1.2 or higher) is used, firmware\ndebug buffers are stored in the HAL instead of the framework to save IPC costs.\n\n### Implementation\n\nFor a reference implementation, see the\n[default implementation](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/wifi/aidl/default/wifi_chip.cpp)\nin the Vendor HAL.\n\nYou can disable firmware logging by setting the resource,\n`config_wifi_enable_wifi_firmware_debugging`, to false.\n\n### Manual test\n\nRun this manual test to verify that old files in the\n[tombstone directory](/docs/core/tests/debug#debuggerd) are being deleted.\n\n1. Turn on Wi-Fi.\n2. Connect to a network.\n3. Generate a [bug report](/docs/core/tests/debug/read-bug-reports).\n4. Inspect the bug report Zip file and verify that the archived firmware logs\n exist. The logs are found in the following locations:\n\n - AIDL HAL: `dumpsys` section of the main bugreport file\n - HIDL HAL: `/lshal-debug/android.hardware.wifi@1.x::IWifi_default.txt`\n\nConfiguration tuning\n--------------------\n\nTo control the signal strength at which a device associates with or\ndissociates from a network, the Wi-Fi framework uses the *entry* and *exit*\nRSSI thresholds.\n\nThe *entry* and *exit* thresholds are stored as overloadable configuration\nparameters with the following names (where the `bad` parameter refers to the\n*exit* RSSI threshold):\n\n- `config_wifi_framework_wifi_score_bad_rssi_threshold_5GHz`\n- `config_wifi_framework_wifi_score_entry_rssi_threshold_5GHz`\n- `config_wifi_framework_wifi_score_bad_rssi_threshold_24GHz`\n- `config_wifi_framework_wifi_score_entry_rssi_threshold_24GHz`\n\nThe parameters are stored in\n`\u003croot\u003e/frameworks/base/core/res/res/values/config.xml` and may be overloaded\nusing the overlay file\n`\u003croot\u003e/device/\u003cdev_dir\u003e/overlay/frameworks/base/core/res/res/values/config.xml`.\n| **Note:** The `bad` configuration parameters (for 2.4GHz and 5GHz bands) were introduced pre-Android 8.1. The `entry` configuration parameters were introduced in Android 8.1 with the default values equal to the corresponding bad parameters. These defaults result in pre-Android 8.1 behavior where no hysteresis is used in network selection. To take advantage of the hysteresis functionality introduced in Android 8.1, set the `entry` parameters to 3dB or more above the `bad` parameters using the overlay file specified above.\n\nYou can test new thresholds by configuring the device using adb commands.\n(Alternatively, you can create a build with new overlays but using adb commands\nprovide a faster testing turnaround.) \n\n adb shell settings put global wifi_score_params \\\n [rssi2|rssi5]=\u003cbad\u003e:\u003centry\u003e:\u003clow\u003e:\u003cgood\u003e\n\nFor example, the following command configures new threshold parameters (the\nvalues used in this sample command are the configured defaults in the AOSP\ncodebase): \n\n adb shell settings put global wifi_score_params \\\n rssi2=-85:-85:-73:-60,rssi5=-82:-82:-70:-57\n\nTo restore the built-in parameter values (i.e. remove the overrides) use the\nfollowing adb command: \n\n adb shell settings delete global wifi_score_params"]]