Update NetworkCapabilities Wifi link bandwidth
Set NetworkCapabilities Wifi link bandwidth with real values.
1) First update after connection uses the predicted throughput based on current RSSI, connection capabilities, channel utilization. This is because PER and
traffic count requires two polls. If RSSI is not available (e.g., screen off), it will use max supported link speed instead.
2) Later updates use the throughput value estimated based on the latest Tx/Rx link speed, channel utilization, PER and Rx/Tx traffic count. If link layer
stats are not available, try to use link speed. If link speed is still not available, use max supported link speed.
3) The updates happen less often than RSSI poll. During RSSI poll, capabilities updates happen only when RSSI change results in one or more bar level change (up to 11dB RSSI change).
Bug: 148875063
Bug: 124112470
Test: manual
Test: atest com.android.server.wifi
Change-Id: I1ad4b75db0d679db45297fcea20a15779b340253
(cherry picked from commit 359d5066ce2faceb9403e472e7e50749ef1120cf)
7 files changed