From 27544a5140b9b33f9c77690d524dea21235744f3 Mon Sep 17 00:00:00 2001 From: "Nate(Qiang) Jiang" Date: Tue, 5 Nov 2019 14:15:18 -0800 Subject: [WifiRtt] add check to verify bw and preamble combination valid check the combination before send the request to the FW Bug: 142147874 Test: atest android.net.wifi Test: atest com.android.server.wifi Change-Id: I98961412cc582ca7b2f1e596017ddc8cd3fee7ab --- .../com/android/server/wifi/rtt/RttNativeTest.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/rtt/RttNativeTest.java b/tests/wifitests/src/com/android/server/wifi/rtt/RttNativeTest.java index 1b93bb02f..d57857d64 100644 --- a/tests/wifitests/src/com/android/server/wifi/rtt/RttNativeTest.java +++ b/tests/wifitests/src/com/android/server/wifi/rtt/RttNativeTest.java @@ -45,6 +45,7 @@ import android.hardware.wifi.V1_0.WifiStatusCode; import android.net.MacAddress; import android.net.wifi.rtt.RangingRequest; import android.net.wifi.rtt.RangingResult; +import android.net.wifi.rtt.ResponderConfig; import androidx.test.filters.SmallTest; @@ -476,6 +477,28 @@ public class RttNativeTest extends WifiBaseTest { } } + /** + * Validation ranging with invalid bw and preamble combination will be ignored. + */ + @Test + public void testRangingWithInvalidParameterCombination() throws Exception { + int cmdId = 88; + RangingRequest request = new RangingRequest.Builder().build(); + ResponderConfig invalidConfig = new ResponderConfig( + MacAddress.fromString("08:09:08:07:06:88"), ResponderConfig.RESPONDER_AP, true, + ResponderConfig.CHANNEL_WIDTH_80MHZ, 0, 0, 0, ResponderConfig.PREAMBLE_HT); + ResponderConfig config = new ResponderConfig(MacAddress.fromString("08:09:08:07:06:89"), + ResponderConfig.RESPONDER_AP, true, + ResponderConfig.CHANNEL_WIDTH_80MHZ, 0, 0, 0, ResponderConfig.PREAMBLE_VHT); + + // Add a ResponderConfig with invalid parameter, should be ignored. + request.mRttPeers.add(invalidConfig); + request.mRttPeers.add(config); + mDut.rangeRequest(cmdId, request, true); + verify(mockRttController).rangeRequest(eq(cmdId), mRttConfigCaptor.capture()); + assertEquals(request.mRttPeers.size() - 1, mRttConfigCaptor.getValue().size()); + } + // Utilities /** -- cgit v1.2.3