Wait for IpClient to shutdown

This makes sure that we never accidentally have two IpClients vying
for control of the same interface.

Test: as follows
    - built
    - flashed
    - booted
Bug: 62476366
Change-Id: Iab4ca7c2445e70b6f8beaf5dc6921cb0c6cd56ed
This commit is contained in:
Erik Kline
2018-02-21 14:54:04 -08:00
parent de93b3eb05
commit 7048285cb3

View File

@@ -355,8 +355,10 @@ public class EthernetNetworkFactory extends NetworkFactory {
void stop() { void stop() {
if (mIpClient != null) { if (mIpClient != null) {
mIpClient.shutdown(); mIpClient.shutdown();
mIpClient.awaitShutdown();
mIpClient = null; mIpClient = null;
} }
// ConnectivityService will only forget our NetworkAgent if we send it a NetworkInfo object // ConnectivityService will only forget our NetworkAgent if we send it a NetworkInfo object
// with a state of DISCONNECTED or SUSPENDED. So we can't simply clear our NetworkInfo here: // with a state of DISCONNECTED or SUSPENDED. So we can't simply clear our NetworkInfo here:
// that sets the state to IDLE, and ConnectivityService will still think we're connected. // that sets the state to IDLE, and ConnectivityService will still think we're connected.