summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorMichael Plass <mplass@google.com>2020-04-01 20:08:10 -0700
committerMichael Plass <mplass@google.com>2020-04-01 20:08:10 -0700
commit2aee6cd1206c4ce215fc8a83789ab3b1470889d2 (patch)
treef350a29600386198cac8aff252e94ab3b4630171 /service
parent33da6370769f3d0ba5a6464fe6abdd93d0a8ea8f (diff)
Partially populate WifiUsabilityStatsEntry even without vendor HAL
Some devices do not have a vendor HAL, in particular the Android Virtual Device used for testing. So fill in the fields that we can, so that the API can be tested on these devices. Bug: 152910948 Test: atest android.net.wifi.cts.ConnectedNetworkScorerTest Change-Id: I91a70e4f7f58020667969bc2e68ae1d7f85bdd99
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index fb6173732..9b51fe38c 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -4844,9 +4844,18 @@ public class WifiMetrics {
*/
public void updateWifiUsabilityStatsEntries(WifiInfo info, WifiLinkLayerStats stats) {
synchronized (mLock) {
- if (info == null || stats == null) {
+ if (info == null) {
return;
}
+ if (stats == null) {
+ // For devices lacking vendor hal, fill in the parts that we can
+ stats = new WifiLinkLayerStats();
+ stats.timeStampInMs = mClock.getElapsedSinceBootMillis();
+ stats.txmpdu_be = info.txSuccess;
+ stats.retries_be = info.txRetries;
+ stats.lostmpdu_be = info.txBad;
+ stats.rxmpdu_be = info.rxSuccess;
+ }
WifiUsabilityStatsEntry wifiUsabilityStatsEntry =
mWifiUsabilityStatsEntriesList.size()
< MAX_WIFI_USABILITY_STATS_ENTRIES_LIST_SIZE