summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java18
2 files changed, 17 insertions, 7 deletions
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index 90f6ac195..aca32bc31 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -131,17 +131,13 @@ public class WifiNative {
*
* 1. Tears down all the interfaces from Wificond.
* 2. Stops the Wifi HAL.
- *
- * @return Returns true on success.
*/
- public boolean tearDown() {
+ public void tearDown() {
if (!mWificondControl.tearDownInterfaces()) {
// TODO(b/34859006): Handle failures.
Log.e(mTAG, "Failed to teardown interfaces from Wificond");
- return false;
}
stopHalIfNecessary();
- return true;
}
/********************************************************
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
index 2f13baf7b..d58af91fc 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
@@ -616,13 +616,27 @@ public class WifiNativeTest {
}
/**
- * Verifies that tearDownInterfaces() calls underlying WificondControl.
+ * Verifies that tearDownInterfaces() calls underlying WificondControl and WifiVendorHal
+ * methods.
*/
@Test
public void testTearDown() {
when(mWificondControl.tearDownInterfaces()).thenReturn(true);
- assertTrue(mWifiNative.tearDown());
+ mWifiNative.tearDown();
+ verify(mWificondControl).tearDownInterfaces();
+ verify(mWifiVendorHal).stopVendorHal();
+ }
+
+ /**
+ * Verifies that tearDownInterfaces() calls underlying WificondControl and WifiVendorHal
+ * methods even if wificond returns an error.
+ */
+ @Test
+ public void testTearDownWificondError() {
+ when(mWificondControl.tearDownInterfaces()).thenReturn(false);
+
+ mWifiNative.tearDown();
verify(mWificondControl).tearDownInterfaces();
verify(mWifiVendorHal).stopVendorHal();
}