summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java2
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java9
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java16
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java107
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java3
5 files changed, 30 insertions, 107 deletions
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index 9b2df953c..32bf1aed3 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -189,7 +189,7 @@ public class WifiInjector {
ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE));
mWifiNative = new WifiNative(
mWifiVendorHal, mSupplicantStaIfaceHal, mHostapdHal, mWificondControl,
- mNwManagementService, mPropertyService, mWifiMetrics);
+ mWifiMonitor, mNwManagementService, mPropertyService, mWifiMetrics);
mWifiP2pMonitor = new WifiP2pMonitor(this);
mSupplicantP2pIfaceHal = new SupplicantP2pIfaceHal(mWifiP2pMonitor);
mWifiP2pNative = new WifiP2pNative(mSupplicantP2pIfaceHal, mHalDeviceManager);
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index aebb236ca..474a8977e 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -74,21 +74,22 @@ public class WifiNative {
private final HostapdHal mHostapdHal;
private final WifiVendorHal mWifiVendorHal;
private final WificondControl mWificondControl;
+ private final WifiMonitor mWifiMonitor;
private final INetworkManagementService mNwManagementService;
private final PropertyService mPropertyService;
private final WifiMetrics mWifiMetrics;
private boolean mVerboseLoggingEnabled = false;
- // TODO(b/69426063): Remove interfaceName from constructor once WifiStateMachine switches over
- // to the new interface management methods.
public WifiNative(WifiVendorHal vendorHal,
SupplicantStaIfaceHal staIfaceHal, HostapdHal hostapdHal,
- WificondControl condControl, INetworkManagementService nwService,
+ WificondControl condControl, WifiMonitor wifiMonitor,
+ INetworkManagementService nwService,
PropertyService propertyService, WifiMetrics wifiMetrics) {
mWifiVendorHal = vendorHal;
mSupplicantStaIfaceHal = staIfaceHal;
mHostapdHal = hostapdHal;
mWificondControl = condControl;
+ mWifiMonitor = wifiMonitor;
mNwManagementService = nwService;
mPropertyService = propertyService;
mWifiMetrics = wifiMetrics;
@@ -391,6 +392,7 @@ public class WifiNative {
/** Helper method invoked to teardown client iface and perform necessary cleanup */
private void onClientInterfaceDestroyed(@NonNull Iface iface) {
synchronized (mLock) {
+ mWifiMonitor.stopMonitoring(iface.name);
if (!unregisterNetworkObserver(iface.networkObserver)) {
Log.e(TAG, "Failed to unregister network observer on " + iface);
}
@@ -840,6 +842,7 @@ public class WifiNative {
teardownInterface(iface.name);
return null;
}
+ mWifiMonitor.startMonitoring(iface.name);
// Just to avoid any race conditions with interface state change callbacks,
// update the interface state before we exit.
onInterfaceStateChanged(iface, isInterfaceUp(iface.name));
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 41371c6e1..2d60e3553 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -2892,17 +2892,6 @@ public class WifiStateMachine extends StateMachine {
mLastNetworkId = WifiConfiguration.INVALID_NETWORK_ID;
}
- private void handleSupplicantConnectionLoss(boolean killSupplicant) {
- /* Socket connection can be lost when we do a graceful shutdown
- * or when the driver is hung. Ensure supplicant is stopped here.
- */
- if (killSupplicant) {
- mWifiMonitor.stopAllMonitoring();
- }
- sendSupplicantConnectionChangedBroadcast(false);
- setWifiState(WIFI_STATE_DISABLED);
- }
-
void handlePreDhcpSetup() {
if (!mBluetoothConnectionActive) {
/*
@@ -3754,9 +3743,6 @@ public class WifiStateMachine extends StateMachine {
// supplicant
sendWifiScanAvailable(false);
- // Tearing down the client interfaces below is going to stop our supplicant.
- mWifiMonitor.stopAllMonitoring();
-
mWifiNative.registerStatusListener(mWifiNativeStatusListener);
// TODO: This teardown should ideally be handled in STOP_SUPPLICANT to be consistent
// with other mode managers. But, client mode is not yet controlled by
@@ -3770,7 +3756,6 @@ public class WifiStateMachine extends StateMachine {
@Override
public void enter() {
mIfaceIsUp = false;
- mWifiMonitor.stopAllMonitoring();
mWifiStateTracker.updateState(WifiStateTracker.INVALID);
cleanup();
sendMessage(CMD_START_SUPPLICANT);
@@ -3798,7 +3783,6 @@ public class WifiStateMachine extends StateMachine {
mIpClient.setMulticastFilter(true);
if (mVerboseLoggingEnabled) log("Supplicant start successful");
registerForWifiMonitorEvents();
- mWifiMonitor.startMonitoring(mInterfaceName);
mWifiInjector.getWifiLastResortWatchdog().clearAllFailureCounts();
setSupplicantLogLevel();
transitionTo(mSupplicantStartedState);
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java
index 4c86b3caa..4957d6eb2 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java
@@ -49,6 +49,7 @@ import com.android.server.wifi.WifiNative.SupplicantDeathEventHandler;
import com.android.server.wifi.WifiNative.VendorHalDeathEventHandler;
import com.android.server.wifi.WifiNative.WificondDeathEventHandler;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
@@ -69,6 +70,7 @@ public class WifiNativeInterfaceManagementTest {
@Mock private WificondControl mWificondControl;
@Mock private SupplicantStaIfaceHal mSupplicantStaIfaceHal;
@Mock private HostapdHal mHostapdHal;
+ @Mock private WifiMonitor mWifiMonitor;
@Mock private INetworkManagementService mNwManagementService;
@Mock private PropertyService mPropertyService;
@Mock private WifiMetrics mWifiMetrics;
@@ -144,11 +146,11 @@ public class WifiNativeInterfaceManagementTest {
when(mHostapdHal.removeAccessPoint(any())).thenReturn(true);
mInOrder = inOrder(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal, mHostapdHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
+ mWifiMonitor, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
mWifiNative = new WifiNative(
mWifiVendorHal, mSupplicantStaIfaceHal, mHostapdHal, mWificondControl,
- mNwManagementService, mPropertyService, mWifiMetrics);
+ mWifiMonitor, mNwManagementService, mPropertyService, mWifiMetrics);
mWifiNative.initialize();
mWifiNative.registerStatusListener(mStatusListener);
@@ -156,6 +158,13 @@ public class WifiNativeInterfaceManagementTest {
mInOrder.verify(mWificondControl).initialize(any());
}
+ @After
+ public void tearDown() throws Exception {
+ verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
+ mHostapdHal, mWifiMonitor, mNwManagementService, mIfaceCallback0, mIfaceCallback1,
+ mWifiMetrics);
+ }
+
/**
* Verifies the setup of a single client interface.
*/
@@ -165,8 +174,6 @@ public class WifiNativeInterfaceManagementTest {
false, false, IFACE_NAME_0, mIfaceCallback0, mIfaceDestroyedListenerCaptor0,
mNetworkObserverCaptor0);
assertEquals(IFACE_NAME_0, mWifiNative.getClientInterfaceName());
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -178,8 +185,6 @@ public class WifiNativeInterfaceManagementTest {
false, false, IFACE_NAME_0, mIfaceCallback0, mIfaceDestroyedListenerCaptor0,
mNetworkObserverCaptor0);
assertNull(mWifiNative.getClientInterfaceName());
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -193,8 +198,6 @@ public class WifiNativeInterfaceManagementTest {
assertEquals(IFACE_NAME_0, mWifiNative.getClientInterfaceName());
executeAndValidateTeardownClientInterface(false, false, IFACE_NAME_0, mIfaceCallback0,
mIfaceDestroyedListenerCaptor0.getValue(), mNetworkObserverCaptor0.getValue());
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -208,8 +211,6 @@ public class WifiNativeInterfaceManagementTest {
assertNull(mWifiNative.getClientInterfaceName());
executeAndValidateTeardownSoftApInterface(false, false, IFACE_NAME_0, mIfaceCallback0,
mIfaceDestroyedListenerCaptor0.getValue(), mNetworkObserverCaptor0.getValue());
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -234,8 +235,6 @@ public class WifiNativeInterfaceManagementTest {
mIfaceDestroyedListenerCaptor0.getValue(), mNetworkObserverCaptor0.getValue());
executeAndValidateTeardownSoftApInterface(false, false, IFACE_NAME_1, mIfaceCallback1,
mIfaceDestroyedListenerCaptor1.getValue(), mNetworkObserverCaptor1.getValue());
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -260,8 +259,6 @@ public class WifiNativeInterfaceManagementTest {
mIfaceDestroyedListenerCaptor1.getValue(), mNetworkObserverCaptor1.getValue());
executeAndValidateTeardownClientInterface(false, false, IFACE_NAME_0, mIfaceCallback0,
mIfaceDestroyedListenerCaptor0.getValue(), mNetworkObserverCaptor0.getValue());
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -286,8 +283,6 @@ public class WifiNativeInterfaceManagementTest {
mIfaceDestroyedListenerCaptor0.getValue(), mNetworkObserverCaptor0.getValue());
executeAndValidateTeardownClientInterface(false, false, IFACE_NAME_1, mIfaceCallback1,
mIfaceDestroyedListenerCaptor1.getValue(), mNetworkObserverCaptor1.getValue());
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -312,8 +307,6 @@ public class WifiNativeInterfaceManagementTest {
mIfaceDestroyedListenerCaptor1.getValue(), mNetworkObserverCaptor1.getValue());
executeAndValidateTeardownSoftApInterface(false, false, IFACE_NAME_0, mIfaceCallback0,
mIfaceDestroyedListenerCaptor0.getValue(), mNetworkObserverCaptor0.getValue());
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -344,6 +337,7 @@ public class WifiNativeInterfaceManagementTest {
// predetermined.
// Verify STA removal
+ verify(mWifiMonitor).stopMonitoring(IFACE_NAME_1);
verify(mNwManagementService).unregisterObserver(mNetworkObserverCaptor1.getValue());
verify(mSupplicantStaIfaceHal).teardownIface(IFACE_NAME_1);
verify(mWificondControl).tearDownClientInterface(IFACE_NAME_1);
@@ -368,9 +362,6 @@ public class WifiNativeInterfaceManagementTest {
// Assert that the client & softap interface is no more there.
assertNull(mWifiNative.getClientInterfaceName());
assertNull(mWifiNative.getSoftApInterfaceName());
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -408,9 +399,6 @@ public class WifiNativeInterfaceManagementTest {
// Execute a teardown of the interface to ensure that the new iface removal works.
executeAndValidateTeardownSoftApInterface(false, false, IFACE_NAME_0, mIfaceCallback1,
mIfaceDestroyedListenerCaptor1.getValue(), mNetworkObserverCaptor1.getValue());
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -451,6 +439,7 @@ public class WifiNativeInterfaceManagementTest {
mInOrder.verify(mWificondControl).setupInterfaceForClientMode(IFACE_NAME_0);
mInOrder.verify(mSupplicantStaIfaceHal).setupIface(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).registerObserver(mNetworkObserverCaptor1.capture());
+ mInOrder.verify(mWifiMonitor).startMonitoring(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).getInterfaceConfig(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).clearInterfaceAddresses(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).setInterfaceIpv6PrivacyExtensions(IFACE_NAME_0, true);
@@ -459,9 +448,6 @@ public class WifiNativeInterfaceManagementTest {
// Execute a teardown of the interface to ensure that the new iface removal works.
executeAndValidateTeardownClientInterface(false, false, IFACE_NAME_0, mIfaceCallback1,
mIfaceDestroyedListenerCaptor1.getValue(), mNetworkObserverCaptor1.getValue());
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -491,9 +477,6 @@ public class WifiNativeInterfaceManagementTest {
mNetworkObserverCaptor0.getValue().interfaceStatusChanged(IFACE_NAME_0, true);
mInOrder.verify(mIfaceCallback0).onUp(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -533,9 +516,6 @@ public class WifiNativeInterfaceManagementTest {
mNetworkObserverCaptor0.getValue().interfaceStatusChanged(IFACE_NAME_0, false);
mInOrder.verify(mIfaceCallback0).onDown(IFACE_NAME_0);
mInOrder.verify(mWifiMetrics).incrementNumSoftApInterfaceDown();
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -552,9 +532,6 @@ public class WifiNativeInterfaceManagementTest {
mInOrder.verify(mIfaceCallback0).onUp(IFACE_NAME_0);
mNetworkObserverCaptor0.getValue().interfaceStatusChanged(IFACE_NAME_0, true);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -568,9 +545,6 @@ public class WifiNativeInterfaceManagementTest {
mNetworkObserverCaptor0);
mNetworkObserverCaptor0.getValue().interfaceStatusChanged(IFACE_NAME_1, true);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -624,9 +598,6 @@ public class WifiNativeInterfaceManagementTest {
// Execute a teardown of the softap interface to ensure that the new iface removal works.
executeAndValidateTeardownSoftApInterface(false, false, IFACE_NAME_0, mIfaceCallback1,
mIfaceDestroyedListenerCaptor1.getValue(), mNetworkObserverCaptor1.getValue());
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -644,8 +615,6 @@ public class WifiNativeInterfaceManagementTest {
verify(mStatusListener).onStatusChanged(false);
verify(mStatusListener).onStatusChanged(true);
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -664,8 +633,6 @@ public class WifiNativeInterfaceManagementTest {
verify(mStatusListener).onStatusChanged(false);
verify(mStatusListener).onStatusChanged(true);
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -683,8 +650,6 @@ public class WifiNativeInterfaceManagementTest {
verify(mStatusListener).onStatusChanged(false);
verify(mStatusListener).onStatusChanged(true);
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -714,8 +679,6 @@ public class WifiNativeInterfaceManagementTest {
verify(mStatusListener).onStatusChanged(false);
verify(mStatusListener).onStatusChanged(true);
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mHostapdHal, mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -734,9 +697,6 @@ public class WifiNativeInterfaceManagementTest {
// none of the mocks are used because the iface does not exist in the internal
// database.
mWifiNative.teardownInterface(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -756,9 +716,6 @@ public class WifiNativeInterfaceManagementTest {
// none of the mocks are used because the iface does not exist in the internal
// database.
mWifiNative.teardownInterface(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -784,9 +741,6 @@ public class WifiNativeInterfaceManagementTest {
// none of the mocks are used because the iface does not exist in the internal
// database.
mWifiNative.teardownInterface(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -822,9 +776,6 @@ public class WifiNativeInterfaceManagementTest {
// none of the mocks are used because the iface does not exist in the internal
// database.
mWifiNative.teardownInterface(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -860,9 +811,6 @@ public class WifiNativeInterfaceManagementTest {
// none of the mocks are used because the iface does not exist in the internal
// database.
mWifiNative.teardownInterface(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -898,9 +846,6 @@ public class WifiNativeInterfaceManagementTest {
// none of the mocks are used because the iface does not exist in the internal
// database.
mWifiNative.teardownInterface(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -919,9 +864,6 @@ public class WifiNativeInterfaceManagementTest {
// none of the mocks are used because the iface does not exist in the internal
// database.
mWifiNative.teardownInterface(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -942,9 +884,6 @@ public class WifiNativeInterfaceManagementTest {
// none of the mocks are used because the iface does not exist in the internal
// database.
mWifiNative.teardownInterface(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -974,10 +913,8 @@ public class WifiNativeInterfaceManagementTest {
// none of the mocks are used because the iface does not exist in the internal
// database.
mWifiNative.teardownInterface(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
+
/**
* Verifies the interface state query API.
*/
@@ -1000,9 +937,6 @@ public class WifiNativeInterfaceManagementTest {
assertFalse(mWifiNative.isInterfaceUp(IFACE_NAME_0));
verify(mNwManagementService, times(4)).getInterfaceConfig(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -1076,6 +1010,7 @@ public class WifiNativeInterfaceManagementTest {
mInOrder.verify(mWificondControl).setupInterfaceForClientMode(IFACE_NAME_0);
mInOrder.verify(mSupplicantStaIfaceHal).setupIface(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).registerObserver(mNetworkObserverCaptor0.capture());
+ mInOrder.verify(mWifiMonitor).startMonitoring(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).getInterfaceConfig(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).clearInterfaceAddresses(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).setInterfaceIpv6PrivacyExtensions(IFACE_NAME_0, true);
@@ -1086,6 +1021,7 @@ public class WifiNativeInterfaceManagementTest {
mInOrder.verify(mWifiVendorHal).isVendorHalSupported();
// Creation of AP interface should trigger the STA interface destroy
+ verify(mWifiMonitor).stopMonitoring(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).unregisterObserver(
mNetworkObserverCaptor0.getValue());
mInOrder.verify(mSupplicantStaIfaceHal).teardownIface(IFACE_NAME_0);
@@ -1097,9 +1033,6 @@ public class WifiNativeInterfaceManagementTest {
mInOrder.verify(mWificondControl).setupInterfaceForSoftApMode(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).registerObserver(mNetworkObserverCaptor1.capture());
mInOrder.verify(mNwManagementService).getInterfaceConfig(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
/**
@@ -1133,6 +1066,8 @@ public class WifiNativeInterfaceManagementTest {
// Creation of STA interface should trigger the AP interface destroy.
mInOrder.verify(mNwManagementService).unregisterObserver(
mNetworkObserverCaptor0.getValue());
+ mInOrder.verify(mHostapdHal).removeAccessPoint(IFACE_NAME_0);
+ mInOrder.verify(mHostapdHal).deregisterDeathHandler();
mInOrder.verify(mWificondControl).stopHostapd(IFACE_NAME_0);
mInOrder.verify(mWificondControl).tearDownSoftApInterface(IFACE_NAME_0);
mInOrder.verify(mIfaceCallback0).onDestroyed(IFACE_NAME_0);
@@ -1140,13 +1075,11 @@ public class WifiNativeInterfaceManagementTest {
mInOrder.verify(mWificondControl).setupInterfaceForClientMode(IFACE_NAME_0);
mInOrder.verify(mSupplicantStaIfaceHal).setupIface(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).registerObserver(mNetworkObserverCaptor1.capture());
+ mInOrder.verify(mWifiMonitor).startMonitoring(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).getInterfaceConfig(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).clearInterfaceAddresses(IFACE_NAME_0);
mInOrder.verify(mNwManagementService).setInterfaceIpv6PrivacyExtensions(IFACE_NAME_0, true);
mInOrder.verify(mNwManagementService).disableIpv6(IFACE_NAME_0);
-
- verifyNoMoreInteractions(mWifiVendorHal, mWificondControl, mSupplicantStaIfaceHal,
- mNwManagementService, mIfaceCallback0, mIfaceCallback1, mWifiMetrics);
}
private void executeAndValidateSetupClientInterface(
@@ -1183,6 +1116,7 @@ public class WifiNativeInterfaceManagementTest {
mInOrder.verify(mWificondControl).setupInterfaceForClientMode(ifaceName);
mInOrder.verify(mSupplicantStaIfaceHal).setupIface(ifaceName);
mInOrder.verify(mNwManagementService).registerObserver(networkObserverCaptor.capture());
+ mInOrder.verify(mWifiMonitor).startMonitoring(ifaceName);
mInOrder.verify(mNwManagementService).getInterfaceConfig(ifaceName);
mInOrder.verify(mNwManagementService).clearInterfaceAddresses(ifaceName);
mInOrder.verify(mNwManagementService).setInterfaceIpv6PrivacyExtensions(ifaceName, true);
@@ -1210,6 +1144,7 @@ public class WifiNativeInterfaceManagementTest {
boolean anyOtherStaIface, boolean anyOtherApIface,
String ifaceName, @Mock WifiNative.InterfaceCallback callback,
BaseNetworkObserver networkObserver) throws Exception {
+ mInOrder.verify(mWifiMonitor).stopMonitoring(ifaceName);
if (networkObserver != null) {
mInOrder.verify(mNwManagementService).unregisterObserver(networkObserver);
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
index 6bbc55810..31e7e553c 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
@@ -149,6 +149,7 @@ public class WifiNativeTest {
@Mock private WificondControl mWificondControl;
@Mock private SupplicantStaIfaceHal mStaIfaceHal;
@Mock private HostapdHal mHostapdHal;
+ @Mock private WifiMonitor mWifiMonitor;
@Mock private INetworkManagementService mNwService;
@Mock private PropertyService mPropertyService;
@Mock private WifiMetrics mWifiMetrics;
@@ -162,7 +163,7 @@ public class WifiNativeTest {
when(mWifiVendorHal.startVendorHalAp()).thenReturn(true);
mWifiNative = new WifiNative(
mWifiVendorHal, mStaIfaceHal, mHostapdHal, mWificondControl,
- mNwService, mPropertyService, mWifiMetrics);
+ mWifiMonitor, mNwService, mPropertyService, mWifiMetrics);
}
/**