Merge "Clear interface address and reset connections" into jb-mr1-dev
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
index ef57e63..ca329e6 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
@@ -1662,7 +1662,6 @@
     private void stopDhcpServer(String intf) {
         try {
             mNwService.stopTethering();
-            mNwService.clearInterfaceAddresses(intf);
         } catch (Exception e) {
             loge("Error stopping Dhcp server" + e);
             return;
@@ -2166,6 +2165,13 @@
             mDhcpStateMachine = null;
         }
 
+        try {
+            mNwService.clearInterfaceAddresses(mGroup.getInterface());
+        } catch (Exception e) {
+            loge("Failed to clear addresses " + e);
+        }
+        NetworkUtils.resetConnections(mGroup.getInterface(), NetworkUtils.RESET_ALL_ADDRESSES);
+
         mGroup = null;
         mWifiNative.p2pFlush();
         mServiceDiscReqId = null;