summaryrefslogtreecommitdiffstats
path: root/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2018-08-22 08:51:37 -0700
committerEtan Cohen <etancohen@google.com>2018-10-05 07:41:14 -0700
commitd71b53361125ea4f7340426c5e6c90bb10561dab (patch)
tree6b998d4f6de108f586884facf3f81b54e307bf7d /tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
parent6d4cc3ccb1d19e3ee28ae31280ab0bc0bb068afd (diff)
downloadandroid_frameworks_opt_net_wifi-d71b53361125ea4f7340426c5e6c90bb10561dab.tar.gz
android_frameworks_opt_net_wifi-d71b53361125ea4f7340426c5e6c90bb10561dab.tar.bz2
android_frameworks_opt_net_wifi-d71b53361125ea4f7340426c5e6c90bb10561dab.zip
[RTT] Handle HAL concurrencly limitations on RTT availability
The chip may not support RTT in all modes. The change handles this correctly: whenever the HAL cannot support RTT (e.g. for multi-mode chips + switching to AP mode only) the framework will be notified and can dispatch RTT availability notification to app (both when becoming non-available and then when becoming available again). This notification on exact status also fixes the following: - Initialization is precise: i.e. won't try to execute RTT commands on an as yet uninitialized chip - Can revert an early "hack" which re-tried creating a new RTT controller if the previous one simply stopped working Bug: 79565105 Bug: 111218083 Test: unit tests (new ones) Test: ACTS RangeApSupporting11McTest:test_rtt_in_and_after_softap_mode Change-Id: Ib9ef75bb679cdb0f49384260112c06684f52c693
Diffstat (limited to 'tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java175
1 files changed, 0 insertions, 175 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
index d5259c710..9ca722164 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
@@ -48,15 +48,9 @@ import android.hardware.wifi.V1_0.IWifiApIface;
import android.hardware.wifi.V1_0.IWifiChip;
import android.hardware.wifi.V1_0.IWifiChipEventCallback;
import android.hardware.wifi.V1_0.IWifiIface;
-import android.hardware.wifi.V1_0.IWifiRttController;
-import android.hardware.wifi.V1_0.IWifiRttControllerEventCallback;
import android.hardware.wifi.V1_0.IWifiStaIface;
import android.hardware.wifi.V1_0.IWifiStaIfaceEventCallback;
import android.hardware.wifi.V1_0.IfaceType;
-import android.hardware.wifi.V1_0.RttBw;
-import android.hardware.wifi.V1_0.RttCapabilities;
-import android.hardware.wifi.V1_0.RttConfig;
-import android.hardware.wifi.V1_0.RttPreamble;
import android.hardware.wifi.V1_0.StaApfPacketFilterCapabilities;
import android.hardware.wifi.V1_0.StaBackgroundScanCapabilities;
import android.hardware.wifi.V1_0.StaBackgroundScanParameters;
@@ -86,7 +80,6 @@ import android.hardware.wifi.V1_2.IWifiChipEventCallback.RadioModeInfo;
import android.net.KeepalivePacketData;
import android.net.MacAddress;
import android.net.apf.ApfCapabilities;
-import android.net.wifi.RttManager;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.net.wifi.WifiScanner;
@@ -154,8 +147,6 @@ public class WifiVendorHalTest {
private android.hardware.wifi.V1_2.IWifiStaIface mIWifiStaIfaceV12;
@Mock
private android.hardware.wifi.V1_3.IWifiStaIface mIWifiStaIfaceV13;
- @Mock
- private IWifiRttController mIWifiRttController;
private IWifiStaIfaceEventCallback mIWifiStaIfaceEventCallback;
private IWifiChipEventCallback mIWifiChipEventCallback;
private android.hardware.wifi.V1_2.IWifiChipEventCallback mIWifiChipEventCallbackV12;
@@ -310,7 +301,6 @@ public class WifiVendorHalTest {
when(mHalDeviceManager.removeIface(any())).thenReturn(true);
when(mHalDeviceManager.getChip(any(IWifiIface.class)))
.thenReturn(mIWifiChip);
- when(mHalDeviceManager.createRttController()).thenReturn(mIWifiRttController);
when(mIWifiChip.registerEventCallback(any(IWifiChipEventCallback.class)))
.thenReturn(mWifiStatusSuccess);
mIWifiStaIfaceEventCallback = null;
@@ -335,9 +325,6 @@ public class WifiVendorHalTest {
return (mWifiStatusSuccess);
}));
- when(mIWifiRttController.registerEventCallback(any(IWifiRttControllerEventCallback.class)))
- .thenReturn(mWifiStatusSuccess);
-
doAnswer(new AnswerWithArguments() {
public void answer(IWifiIface.getNameCallback cb)
throws RemoteException {
@@ -375,7 +362,6 @@ public class WifiVendorHalTest {
verify(mHalDeviceManager).start();
verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null));
verify(mHalDeviceManager).getChip(eq(mIWifiStaIface));
- verify(mHalDeviceManager).createRttController();
verify(mHalDeviceManager).isReady();
verify(mHalDeviceManager).isStarted();
verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class));
@@ -400,7 +386,6 @@ public class WifiVendorHalTest {
verify(mHalDeviceManager).isStarted();
verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null));
- verify(mHalDeviceManager, never()).createRttController();
}
/**
@@ -424,7 +409,6 @@ public class WifiVendorHalTest {
verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null));
verify(mHalDeviceManager, never()).createApIface(any(), eq(null));
verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class));
- verify(mHalDeviceManager, never()).createRttController();
verify(mIWifiStaIface, never())
.registerEventCallback(any(IWifiStaIfaceEventCallback.class));
}
@@ -445,7 +429,6 @@ public class WifiVendorHalTest {
verify(mHalDeviceManager, never()).createApIface(any(), eq(null));
verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class));
- verify(mHalDeviceManager, never()).createRttController();
verify(mIWifiStaIface, never())
.registerEventCallback(any(IWifiStaIfaceEventCallback.class));
}
@@ -455,26 +438,6 @@ public class WifiVendorHalTest {
* {@link WifiVendorHal#startVendorHalSta()}.
*/
@Test
- public void testStartHalFailureInRttControllerCreationInStaMode() throws Exception {
- when(mHalDeviceManager.createRttController()).thenReturn(null);
- assertFalse(mWifiVendorHal.startVendorHalSta());
- assertFalse(mWifiVendorHal.isHalStarted());
-
- verify(mHalDeviceManager).start();
- verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null));
- verify(mHalDeviceManager).createRttController();
- verify(mHalDeviceManager).stop();
- verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class));
-
- verify(mHalDeviceManager, never()).createApIface(any(), eq(null));
- verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class));
- }
-
- /**
- * Tests the failure to start HAL in STA mode using
- * {@link WifiVendorHal#startVendorHalSta()}.
- */
- @Test
public void testStartHalFailureInChipGetInStaMode() throws Exception {
when(mHalDeviceManager.getChip(any(IWifiIface.class))).thenReturn(null);
assertFalse(mWifiVendorHal.startVendorHalSta());
@@ -482,7 +445,6 @@ public class WifiVendorHalTest {
verify(mHalDeviceManager).start();
verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null));
- verify(mHalDeviceManager).createRttController();
verify(mHalDeviceManager).getChip(any(IWifiIface.class));
verify(mHalDeviceManager).stop();
verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class));
@@ -506,7 +468,6 @@ public class WifiVendorHalTest {
verify(mHalDeviceManager).stop();
verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class));
- verify(mHalDeviceManager, never()).createRttController();
verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class));
verify(mHalDeviceManager, never()).createApIface(any(), eq(null));
}
@@ -524,7 +485,6 @@ public class WifiVendorHalTest {
verify(mHalDeviceManager).start();
verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null));
- verify(mHalDeviceManager).createRttController();
verify(mHalDeviceManager).getChip(any(IWifiIface.class));
verify(mHalDeviceManager).stop();
verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class));
@@ -549,7 +509,6 @@ public class WifiVendorHalTest {
verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null));
verify(mHalDeviceManager, never()).getChip(any(IWifiIface.class));
- verify(mHalDeviceManager, never()).createRttController();
}
/**
@@ -568,7 +527,6 @@ public class WifiVendorHalTest {
verify(mHalDeviceManager).stop();
verify(mHalDeviceManager).createStaIface(eq(false), any(), eq(null));
verify(mHalDeviceManager).getChip(eq(mIWifiStaIface));
- verify(mHalDeviceManager).createRttController();
verify(mHalDeviceManager, times(2)).isReady();
verify(mHalDeviceManager, times(2)).isStarted();
@@ -595,7 +553,6 @@ public class WifiVendorHalTest {
verify(mHalDeviceManager, times(2)).isStarted();
verify(mHalDeviceManager, never()).createStaIface(anyBoolean(), any(), eq(null));
- verify(mHalDeviceManager, never()).createRttController();
}
/**
@@ -615,7 +572,6 @@ public class WifiVendorHalTest {
verify(mHalDeviceManager).createStaIface(eq(false), internalListenerCaptor.capture(),
eq(null));
verify(mHalDeviceManager).getChip(eq(mIWifiStaIface));
- verify(mHalDeviceManager).createRttController();
verify(mHalDeviceManager).isReady();
verify(mHalDeviceManager).isStarted();
verify(mIWifiStaIface).registerEventCallback(any(IWifiStaIfaceEventCallback.class));
@@ -1103,137 +1059,6 @@ public class WifiVendorHalTest {
assertEquals(2, ex);
}
-
- /**
- * Test translations of RTT type
- */
- @Test
- public void testRttTypeTranslation() throws Exception {
- checkRoundTripIntTranslation(
- (y) -> WifiVendorHal.halRttTypeFromFrameworkRttType(y),
- (x) -> WifiVendorHal.frameworkRttTypeFromHalRttType(x),
- 1, 3);
- }
-
- /**
- * Test translations of peer type
- */
- @Test
- public void testPeerTranslation() throws Exception {
- checkRoundTripIntTranslation(
- (y) -> WifiVendorHal.halPeerFromFrameworkPeer(y),
- (x) -> WifiVendorHal.frameworkPeerFromHalPeer(x),
- 1, 6);
- }
-
- /**
- * Test translations of channel width
- */
- @Test
- public void testChannelWidth() throws Exception {
- checkRoundTripIntTranslation(
- (y) -> WifiVendorHal.halChannelWidthFromFrameworkChannelWidth(y),
- (x) -> WifiVendorHal.frameworkChannelWidthFromHalChannelWidth(x),
- 0, 5);
- }
-
- /**
- * Test translations of preamble type mask
- */
- @Test
- public void testPreambleTranslation() throws Exception {
- checkRoundTripIntTranslation(
- (y) -> WifiVendorHal.halPreambleFromFrameworkPreamble(y),
- (x) -> WifiVendorHal.frameworkPreambleFromHalPreamble(x),
- 0, 8);
- }
-
- /**
- * Test translations of bandwidth mask
- */
- @Test
- public void testBandwidthTranslations() throws Exception {
- checkRoundTripIntTranslation(
- (y) -> WifiVendorHal.halBwFromFrameworkBw(y),
- (x) -> WifiVendorHal.frameworkBwFromHalBw(x),
- 0, 64);
- }
-
- /**
- * Test translation of framwork RttParams to hal RttConfig
- */
- @Test
- public void testGetRttStuff() throws Exception {
- RttManager.RttParams params = new RttManager.RttParams();
- params.bssid = "03:01:04:01:05:09";
- params.frequency = 2420;
- params.channelWidth = ScanResult.CHANNEL_WIDTH_40MHZ;
- params.centerFreq0 = 2440;
- params.centerFreq1 = 1;
- params.num_samples = 2;
- params.num_retries = 3;
- params.numberBurst = 4;
- params.interval = 5;
- params.numSamplesPerBurst = 8;
- params.numRetriesPerMeasurementFrame = 6;
- params.numRetriesPerFTMR = 7;
- params.LCIRequest = false;
- params.LCRRequest = false;
- params.burstTimeout = 15;
- String frameish = params.toString();
- assertFalse(frameish.contains("=0,")); // make sure all fields are initialized
- RttConfig config = WifiVendorHal.halRttConfigFromFrameworkRttParams(params);
- String halish = config.toString();
- StringBuffer expect = new StringBuffer(200);
- expect.append("{.addr = [3, 1, 4, 1, 5, 9], .type = ONE_SIDED, .peer = AP, ");
- expect.append(".channel = {.width = WIDTH_40, .centerFreq = 2420, ");
- expect.append(".centerFreq0 = 2440, .centerFreq1 = 1}, ");
- expect.append(".burstPeriod = 5, .numBurst = 4, .numFramesPerBurst = 8, ");
- expect.append(".numRetriesPerRttFrame = 6, .numRetriesPerFtmr = 7, ");
- expect.append(".mustRequestLci = false, .mustRequestLcr = false, .burstDuration = 15, ");
- expect.append(".preamble = HT, .bw = BW_20MHZ}");
- assertEquals(expect.toString(), halish);
- }
-
- /**
- * Test that RTT capabilities are plumbed through
- */
- @Test
- public void testGetRttCapabilities() throws Exception {
- RttCapabilities capabilities = new RttCapabilities();
- capabilities.lcrSupported = true;
- capabilities.preambleSupport = RttPreamble.LEGACY | RttPreamble.VHT;
- capabilities.bwSupport = RttBw.BW_5MHZ | RttBw.BW_20MHZ;
- capabilities.mcVersion = 43;
- doAnswer(new AnswerWithArguments() {
- public void answer(IWifiRttController.getCapabilitiesCallback cb)
- throws RemoteException {
- cb.onValues(mWifiStatusSuccess, capabilities);
- }
- }).when(mIWifiRttController).getCapabilities(any(
- IWifiRttController.getCapabilitiesCallback.class));
-
- assertNull(mWifiVendorHal.getRttCapabilities());
-
- assertTrue(mWifiVendorHal.startVendorHalSta());
-
- RttManager.RttCapabilities actual = mWifiVendorHal.getRttCapabilities();
- assertTrue(actual.lcrSupported);
- assertEquals(RttManager.PREAMBLE_LEGACY | RttManager.PREAMBLE_VHT,
- actual.preambleSupported);
- assertEquals(RttManager.RTT_BW_5_SUPPORT | RttManager.RTT_BW_20_SUPPORT,
- actual.bwSupported);
- assertEquals(43, (int) capabilities.mcVersion);
- }
-
- /**
- * Negative test of disableRttResponder
- */
- @Test
- public void testDisableOfUnstartedRtt() throws Exception {
- assertFalse(mWifiVendorHal.disableRttResponder());
- }
-
/**
* Test that setScanningMacOui is hooked up to the HAL correctly
*/