diff --git a/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java b/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java index b8ed845c2c..6ed1310d2e 100644 --- a/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java +++ b/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java @@ -376,7 +376,14 @@ public class EthernetNetworkFactory extends NetworkFactory { } void setIpConfig(IpConfiguration ipConfig) { + if (this.mIpConfig.equals(ipConfig)) { + if (DBG) Log.d(TAG, "ipConfig have not changed,so ignore setIpConfig"); + return; + } this.mIpConfig = ipConfig; + if (mNetworkInfo.getDetailedState() != DetailedState.DISCONNECTED) { + restart(); + } } boolean statisified(NetworkCapabilities requestedCapabilities) { @@ -587,6 +594,12 @@ public class EthernetNetworkFactory extends NetworkFactory { } } + void restart(){ + if (DBG) Log.d(TAG, "reconnecting Etherent"); + stop(); + start(); + } + @Override public String toString() { return getClass().getSimpleName() + "{ "