summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/WifiVendorHal.java21
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java25
2 files changed, 27 insertions, 19 deletions
diff --git a/service/java/com/android/server/wifi/WifiVendorHal.java b/service/java/com/android/server/wifi/WifiVendorHal.java
index 51ead033b..0c1a56c46 100644
--- a/service/java/com/android/server/wifi/WifiVendorHal.java
+++ b/service/java/com/android/server/wifi/WifiVendorHal.java
@@ -34,6 +34,7 @@ import android.hardware.wifi.V1_0.RttType;
import android.hardware.wifi.V1_0.StaBackgroundScanBucketEventReportSchemeMask;
import android.hardware.wifi.V1_0.StaBackgroundScanBucketParameters;
import android.hardware.wifi.V1_0.StaBackgroundScanParameters;
+import android.hardware.wifi.V1_0.StaLinkLayerRadioStats;
import android.hardware.wifi.V1_0.StaLinkLayerStats;
import android.hardware.wifi.V1_0.StaRoamingConfig;
import android.hardware.wifi.V1_0.StaRoamingState;
@@ -700,14 +701,18 @@ public class WifiVendorHal {
out.txmpdu_vo = stats.iface.wmeVoPktStats.txMpdu;
out.lostmpdu_vo = stats.iface.wmeVoPktStats.lostMpdu;
out.retries_vo = stats.iface.wmeVoPktStats.retries;
- out.on_time = stats.radio.onTimeInMs;
- out.tx_time = stats.radio.txTimeInMs;
- out.tx_time_per_level = new int[stats.radio.txTimeInMsPerLevel.size()];
- for (int i = 0; i < out.tx_time_per_level.length; i++) {
- out.tx_time_per_level[i] = stats.radio.txTimeInMsPerLevel.get(i);
- }
- out.rx_time = stats.radio.rxTimeInMs;
- out.on_time_scan = stats.radio.onTimeInMsForScan;
+ // TODO(b/36176141): Figure out how to coalesce this info for multi radio devices.
+ if (stats.radios.size() > 0) {
+ StaLinkLayerRadioStats radioStats = stats.radios.get(0);
+ out.on_time = radioStats.onTimeInMs;
+ out.tx_time = radioStats.txTimeInMs;
+ out.tx_time_per_level = new int[radioStats.txTimeInMsPerLevel.size()];
+ for (int i = 0; i < out.tx_time_per_level.length; i++) {
+ out.tx_time_per_level[i] = radioStats.txTimeInMsPerLevel.get(i);
+ }
+ out.rx_time = radioStats.rxTimeInMs;
+ out.on_time_scan = radioStats.onTimeInMsForScan;
+ }
// unused: stats.timeStampInMs;
return out;
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
index a5cac8185..000f5866e 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
@@ -631,7 +631,8 @@ public class WifiVendorHalTest {
randomizePacketStats(r, stats.iface.wmeBkPktStats);
randomizePacketStats(r, stats.iface.wmeViPktStats);
randomizePacketStats(r, stats.iface.wmeVoPktStats);
- randomizeRadioStats(r, stats.radio);
+ randomizeRadioStats(r, stats.radios);
+
stats.timeStampInMs = 42; // currently dropped in conversion
String expected = numbersOnly(stats.toString());
@@ -641,11 +642,11 @@ public class WifiVendorHalTest {
String actual = numbersOnly(converted.toString());
// Do the required fixups to the both expected and actual
- expected = rmValue(expected, stats.radio.rxTimeInMs);
- expected = rmValue(expected, stats.radio.onTimeInMsForScan);
+ expected = rmValue(expected, stats.radios.get(0).rxTimeInMs);
+ expected = rmValue(expected, stats.radios.get(0).onTimeInMsForScan);
- actual = rmValue(actual, stats.radio.rxTimeInMs);
- actual = rmValue(actual, stats.radio.onTimeInMsForScan);
+ actual = rmValue(actual, stats.radios.get(0).rxTimeInMs);
+ actual = rmValue(actual, stats.radios.get(0).onTimeInMsForScan);
actual = actual + "42 ";
// The remaining fields should agree
@@ -677,15 +678,17 @@ public class WifiVendorHalTest {
/**
* Populate radio stats with non-negative random values
*/
- private static void randomizeRadioStats(Random r, StaLinkLayerRadioStats rstats) {
- rstats.onTimeInMs = r.nextInt() & 0xFFFFFF;
- rstats.txTimeInMs = r.nextInt() & 0xFFFFFF;
+ private static void randomizeRadioStats(Random r, ArrayList<StaLinkLayerRadioStats> rstats) {
+ StaLinkLayerRadioStats rstat = new StaLinkLayerRadioStats();
+ rstat.onTimeInMs = r.nextInt() & 0xFFFFFF;
+ rstat.txTimeInMs = r.nextInt() & 0xFFFFFF;
for (int i = 0; i < 4; i++) {
Integer v = r.nextInt() & 0xFFFFFF;
- rstats.txTimeInMsPerLevel.add(v);
+ rstat.txTimeInMsPerLevel.add(v);
}
- rstats.rxTimeInMs = r.nextInt() & 0xFFFFFF;
- rstats.onTimeInMsForScan = r.nextInt() & 0xFFFFFF;
+ rstat.rxTimeInMs = r.nextInt() & 0xFFFFFF;
+ rstat.onTimeInMsForScan = r.nextInt() & 0xFFFFFF;
+ rstats.add(rstat);
}
/**