From 7130816d6c62e07d6d41150805515d7fd56f1f0d Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Mon, 19 Jun 2017 10:27:30 -0700 Subject: 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 --- .../src/com/android/server/wifi/WifiNativeTest.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'tests') 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(); } -- cgit v1.2.3