From 272be52cb7c1d61a40ac5f03084c43059bc6476e Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Wed, 1 Oct 2014 13:52:40 +0900 Subject: [PATCH] Clear all Ethernet state when our interface goes away. Previously we did not stop DHCP or try to force a disconnect. This made it impossible to reconnect by unplugging and replugging an USB Ethernet adapter. Bug: 17736828 Change-Id: Idd8576a96b063b5ca726ee9149800bdcb0f62bd1 --- .../android/server/ethernet/EthernetNetworkFactory.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java b/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java index a4711548cb..2d0a95728b 100644 --- a/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java +++ b/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java @@ -208,13 +208,18 @@ class EthernetNetworkFactory { return; Log.d(TAG, "Stopped tracking interface " + iface); + // TODO: Unify this codepath with stop(). synchronized (this) { + NetworkUtils.stopDhcp(mIface); mIface = ""; mHwAddr = null; mNetworkInfo.setExtraInfo(null); + mLinkUp = false; + mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, mHwAddr); + updateAgent(); + mNetworkAgent = null; mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_ETHERNET, 0, NETWORK_TYPE, ""); mLinkProperties = new LinkProperties(); - updateAgent(); } }