diff options
author | 2024-10-10 16:13:13 -0700 | |
---|---|---|
committer | 2024-10-23 20:24:51 +0000 | |
commit | 7fc8c112913570f0bd8d1ae88e7b4dd5921e0cae (patch) | |
tree | b74d67b3cb6ee163992b599a583641520a5d4fb6 | |
parent | 0e18e70f0649ee17f2919b24aabecef619f9e061 (diff) |
Add max supported linkspeed into wifi scorer metrics
Flag: com.android.wifi.flags.wifi_scorer_new_stats_collection
Bug: 372761922
Test: Atest and on device test
Change-Id: I393a36cd8ddc85ecbe78c68343e35a7adeaaf695
5 files changed, 42 insertions, 8 deletions
diff --git a/framework/java/android/net/wifi/WifiUsabilityStatsEntry.java b/framework/java/android/net/wifi/WifiUsabilityStatsEntry.java index 521a695b19..94fbe73621 100644 --- a/framework/java/android/net/wifi/WifiUsabilityStatsEntry.java +++ b/framework/java/android/net/wifi/WifiUsabilityStatsEntry.java @@ -177,6 +177,10 @@ public final class WifiUsabilityStatsEntry implements Parcelable { private final int mUwbAdapterState; /** Low Latency mode state */ private final boolean mIsLowLatencyActivated; + /** Maximum supported tx link speed in Mbps */ + private final int mMaxSupportedTxLinkSpeed; + /** Maximum supported rx link speed in Mbps */ + private final int mMaxSupportedRxLinkSpeed; /** {@hide} */ @Retention(RetentionPolicy.SOURCE) @@ -1183,7 +1187,8 @@ public final class WifiUsabilityStatsEntry implements Parcelable { int isNetworkCapabilitiesUpstreamSufficient, int isThroughputPredictorDownstreamSufficient, int isThroughputPredictorUpstreamSufficient, boolean isBluetoothConnected, - int uwbAdapterState, boolean isLowLatencyActivated) { + int uwbAdapterState, boolean isLowLatencyActivated, int maxSupportedTxLinkSpeed, + int maxSupportedRxLinkSpeed) { mTimeStampMillis = timeStampMillis; mRssi = rssi; mLinkSpeedMbps = linkSpeedMbps; @@ -1233,6 +1238,8 @@ public final class WifiUsabilityStatsEntry implements Parcelable { mIsBluetoothConnected = isBluetoothConnected; mUwbAdapterState = uwbAdapterState; mIsLowLatencyActivated = isLowLatencyActivated; + mMaxSupportedTxLinkSpeed = maxSupportedTxLinkSpeed; + mMaxSupportedRxLinkSpeed = maxSupportedRxLinkSpeed; } /** Implement the Parcelable interface */ @@ -1291,6 +1298,8 @@ public final class WifiUsabilityStatsEntry implements Parcelable { dest.writeBoolean(mIsBluetoothConnected); dest.writeInt(mUwbAdapterState); dest.writeBoolean(mIsLowLatencyActivated); + dest.writeInt(mMaxSupportedTxLinkSpeed); + dest.writeInt(mMaxSupportedRxLinkSpeed); } /** Implement the Parcelable interface */ @@ -1315,7 +1324,7 @@ public final class WifiUsabilityStatsEntry implements Parcelable { in.readSparseArray(LinkStats.class.getClassLoader()), in.readInt(), in.readInt(), in.readLong(), in.readLong(), in.readInt(), in.readInt(), in.readInt(), in.readInt(), in.readInt(), in.readInt(), in.readBoolean(), - in.readInt(), in.readBoolean() + in.readInt(), in.readBoolean(), in.readInt(), in.readInt() ); } @@ -2098,4 +2107,14 @@ public final class WifiUsabilityStatsEntry implements Parcelable { public boolean getLowLatencyModeState() { return mIsLowLatencyActivated; } + + /** @hide */ + public int getMaxSupportedTxLinkSpeed() { + return mMaxSupportedTxLinkSpeed; + } + + /** @hide */ + public int getMaxSupportedRxLinkSpeed() { + return mMaxSupportedRxLinkSpeed; + } } diff --git a/framework/tests/src/android/net/wifi/WifiManagerTest.java b/framework/tests/src/android/net/wifi/WifiManagerTest.java index 3f1de76e30..4a9e6b143e 100644 --- a/framework/tests/src/android/net/wifi/WifiManagerTest.java +++ b/framework/tests/src/android/net/wifi/WifiManagerTest.java @@ -2541,7 +2541,7 @@ public class WifiManagerTest { 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 1, 100, 10, 100, 27, contentionTimeStats, rateStats, radioStats, 101, true, true, true, 0, 10, 10, true, linkStats, 1, 0, 10, 20, 1, 2, 1, 1, 1, 1, false, 0, - false)); + false, 100, 100)); verify(mOnWifiUsabilityStatsListener).onWifiUsabilityStats(anyInt(), anyBoolean(), any(WifiUsabilityStatsEntry.class)); } diff --git a/framework/tests/src/android/net/wifi/WifiUsabilityStatsEntryTest.java b/framework/tests/src/android/net/wifi/WifiUsabilityStatsEntryTest.java index 94974f3fd5..3518c4b280 100644 --- a/framework/tests/src/android/net/wifi/WifiUsabilityStatsEntryTest.java +++ b/framework/tests/src/android/net/wifi/WifiUsabilityStatsEntryTest.java @@ -116,7 +116,7 @@ public class WifiUsabilityStatsEntryTest { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 32, contentionTimeStats, rateStats, radioStats, 100, true, true, true, 23, 24, 25, true, linkStats, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - false, 36, false); + false, 36, false, 37, 38); assertEquals(32, usabilityStatsEntry.getTimeSliceDutyCycleInPercent()); WifiUsabilityStatsEntry usabilityStatsEntryWithInvalidDutyCycleValue = @@ -124,7 +124,7 @@ public class WifiUsabilityStatsEntryTest { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1, contentionTimeStats, rateStats, radioStats, 101, true, true, true, 23, 24, 25, true, linkStats, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - true, 36, true); + true, 36, true, 37, 38); try { usabilityStatsEntryWithInvalidDutyCycleValue.getTimeSliceDutyCycleInPercent(); fail(); @@ -182,7 +182,7 @@ public class WifiUsabilityStatsEntryTest { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 50, contentionTimeStats, rateStats, radioStats, 102, true, true, true, 23, 24, 25, true, linkStats, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - true, 36, false + true, 36, false, 37, 38 ); } @@ -673,7 +673,7 @@ public class WifiUsabilityStatsEntryTest { WifiUsabilityStatsEntry usabilityStatsEntry = new WifiUsabilityStatsEntry( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 32, null, null, null, 100, true, true, true, 23, 24, 25, true, linkStats, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, true, 36, true); + 28, 29, 30, 31, 32, 33, 34, 35, true, 36, true, 37, 38); assertThrows("linkId is invalid - " + MloLink.INVALID_MLO_LINK_ID, NoSuchElementException.class, diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 04fc4faa0f..b81aee139b 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -5304,6 +5304,8 @@ public class WifiMetrics { line.append(",is_bluetooth_connected=" + entry.isBluetoothConnected); line.append(",uwb_adapter_state=" + entry.uwbAdapterState); line.append(",is_low_latency_activated=" + entry.isLowLatencyActivated); + line.append(",max_supported_tx_linkspeed=" + entry.maxSupportedTxLinkspeed); + line.append(",max_supported_rx_linkspeed=" + entry.maxSupportedRxLinkspeed); pw.println(line.toString()); } @@ -7395,6 +7397,10 @@ public class WifiMetrics { mWifiGlobals.isBluetoothConnected(); wifiUsabilityStatsEntry.uwbAdapterState = getLastUwbState(); wifiUsabilityStatsEntry.isLowLatencyActivated = getLowLatencyState(); + wifiUsabilityStatsEntry.maxSupportedTxLinkspeed = + info.getMaxSupportedTxLinkSpeedMbps(); + wifiUsabilityStatsEntry.maxSupportedRxLinkspeed = + info.getMaxSupportedRxLinkSpeedMbps(); } wifiUsabilityStatsEntry.timeStampMs = stats.timeStampInMs; @@ -7949,7 +7955,8 @@ public class WifiMetrics { s.isNetworkCapabilitiesUpstreamSufficient, s.isThroughputPredictorDownstreamSufficient, s.isThroughputPredictorUpstreamSufficient, s.isBluetoothConnected, - s.uwbAdapterState, s.isLowLatencyActivated + s.uwbAdapterState, s.isLowLatencyActivated, s.maxSupportedTxLinkspeed, + s.maxSupportedRxLinkspeed ); } @@ -8161,6 +8168,8 @@ public class WifiMetrics { out.isBluetoothConnected = s.isBluetoothConnected; out.uwbAdapterState = s.uwbAdapterState; out.isLowLatencyActivated = s.isLowLatencyActivated; + out.maxSupportedTxLinkspeed = s.maxSupportedTxLinkspeed; + out.maxSupportedRxLinkspeed = s.maxSupportedRxLinkspeed; return out; } diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto index fa6d792574..6808ac6347 100644 --- a/service/proto/src/metrics.proto +++ b/service/proto/src/metrics.proto @@ -2762,6 +2762,12 @@ message WifiUsabilityStatsEntry { // Wifi Low Latency mode state optional bool is_low_latency_activated = 58; + + // Maximum supported tx link speed in Mbps + optional int32 max_supported_tx_linkspeed = 59; + + // Maximum supported rx link speed in Mbps + optional int32 max_supported_rx_linkspeed = 60; } message ContentionTimeStats { |