diff options
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 7 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index bca20e43d..0b0210bee 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -3735,7 +3735,12 @@ public class WifiStateMachine extends StateMachine { mIsRunning = false; updateBatteryWorkSource(null); - if (mIpClient != null) mIpClient.shutdown(); + if (mIpClient != null) { + mIpClient.shutdown(); + // Block to make sure IpClient has really shut down, lest cleanup + // race with, say, bringup code over in tethering. + mIpClient.awaitShutdown(); + } mNetworkInfo.setIsAvailable(false); if (mNetworkAgent != null) mNetworkAgent.sendNetworkInfo(mNetworkInfo); mCountryCode.setReadyForChange(false); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java index 79966d7f1..b33b0b59f 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java @@ -2366,5 +2366,6 @@ public class WifiStateMachineTest { mWsm.setOperationalMode(WifiStateMachine.DISABLED_MODE, null); mLooper.dispatchAll(); verify(mIpClient).shutdown(); + verify(mIpClient).awaitShutdown(); } } |