diff options
author | Erik Kline <ek@google.com> | 2018-05-09 14:45:21 +0900 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2018-05-09 14:27:37 -0700 |
commit | 4dee5fb135b11e155c81fc6defe6c57a583c5d81 (patch) | |
tree | 244efdda84e583307121d012f5c72fd03693fa34 | |
parent | 2c88f670aad308c91801c7bfeabbce8d78a506fe (diff) |
Also await IpClient's shutdown
It may be best to await shutdown of IpClient, especially in cases
where cleanup code would otherwise race with IP address assignment
and other bringup code.
Test: as follows
- built
- flashed
- booted
- frameworks/opt/net/wifi/tests/wifitests/runtests.sh passes
Test: Unit test
Test: Ran WifiManager ACTS tests locally.
Bug: 79400794
Change-Id: I1a02d70660ec54fda9a36399b285cda054cde8d3
-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(); } } |