summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2017-06-19 10:27:30 -0700
committerRoshan Pius <rpius@google.com>2017-06-19 10:30:55 -0700
commit7130816d6c62e07d6d41150805515d7fd56f1f0d (patch)
tree4690f88e8a36c5e510479d7fa8b431476b30ff50
parentc0203e2c4ffeae355c88939fb180c2e1913c108d (diff)
WifiNative: Stop the Hal even if wificond stop fails
Changes in the CL: 1. Even if wificond.tearDownInterfaces() fails, we should still go ahead and attempt to the stop the hal. 2. WifiNative.tearDown()'s return value is unused currently. So, make it void. These are needed for the wifi stack to recover correctly from a wificond crash. Bug: 36586897 Test: Verified that we're able to connect back to a wifi network after triggering a wificond crash. Test: Unit tests Change-Id: Id5b3833b84d5d0a4016321f6c77757af8a3db009
-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();
}