Merge "Add reconnect flow when updateIPConfiguration"
am: a1e229d9d4
Change-Id: Iad395c171db5f186859c485e8d929a6e577f3c5f
diff --git a/java/com/android/server/ethernet/EthernetNetworkFactory.java b/java/com/android/server/ethernet/EthernetNetworkFactory.java
index b8ed845..6ed1310 100644
--- a/java/com/android/server/ethernet/EthernetNetworkFactory.java
+++ b/java/com/android/server/ethernet/EthernetNetworkFactory.java
@@ -376,7 +376,14 @@
}
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 @@
}
}
+ void restart(){
+ if (DBG) Log.d(TAG, "reconnecting Etherent");
+ stop();
+ start();
+ }
+
@Override
public String toString() {
return getClass().getSimpleName() + "{ "