diff options
author | Irfan Sheriff <isheriff@google.com> | 2011-06-17 10:09:36 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-17 10:09:36 -0700 |
commit | f2288c960cce22ea3971d79f6aa13ed61c699176 (patch) | |
tree | 6cd44d4a37d2bd3ef2fbee9c8623419a0be38b4e /wifi/java/android | |
parent | de47f1c358c8186ff3e14b887d5869f69b9a9d6c (diff) | |
parent | f5600618df153d9c51388562ebf3524e3bdc8b7d (diff) | |
download | frameworks_base-f2288c960cce22ea3971d79f6aa13ed61c699176.zip frameworks_base-f2288c960cce22ea3971d79f6aa13ed61c699176.tar.gz frameworks_base-f2288c960cce22ea3971d79f6aa13ed61c699176.tar.bz2 |
Merge "Fix IP address cleanup on network disconnect"
Diffstat (limited to 'wifi/java/android')
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 3c9a641..2a033d1 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -1028,9 +1028,6 @@ public class WifiStateMachine extends StateMachine { boolean wifiTethered = false; boolean wifiAvailable = false; - IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE); - INetworkManagementService service = INetworkManagementService.Stub.asInterface(b); - if (mCm == null) { mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); } @@ -1043,14 +1040,14 @@ public class WifiStateMachine extends StateMachine { InterfaceConfiguration ifcg = null; try { - ifcg = service.getInterfaceConfig(intf); + ifcg = nwService.getInterfaceConfig(intf); if (ifcg != null) { /* IP/netmask: 192.168.43.1/255.255.255.0 */ ifcg.addr = new LinkAddress(NetworkUtils.numericToInetAddress( "192.168.43.1"), 24); ifcg.interfaceFlags = "[up]"; - service.setInterfaceConfig(intf, ifcg); + nwService.setInterfaceConfig(intf, ifcg); } } catch (Exception e) { Log.e(TAG, "Error configuring interface " + intf + ", :" + e); @@ -1450,7 +1447,7 @@ public class WifiStateMachine extends StateMachine { * using the interface, stopping DHCP & disabling interface */ private void handleNetworkDisconnect() { - Log.d(TAG, "Reset connections and stopping DHCP"); + Log.d(TAG, "Stopping DHCP and clearing IP"); /* * stop DHCP @@ -1461,6 +1458,12 @@ public class WifiStateMachine extends StateMachine { mDhcpStateMachine = null; } + try { + nwService.clearInterfaceAddresses(mInterfaceName); + } catch (Exception e) { + Log.e(TAG, "Failed to clear IP addresses on disconnect" + e); + } + /* Reset data structures */ mWifiInfo.setInetAddress(null); mWifiInfo.setBSSID(null); @@ -2656,13 +2659,11 @@ public class WifiStateMachine extends StateMachine { } else { DhcpInfoInternal dhcpInfoInternal = WifiConfigStore.getIpConfiguration( mLastNetworkId); - IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE); - INetworkManagementService netd = INetworkManagementService.Stub.asInterface(b); InterfaceConfiguration ifcg = new InterfaceConfiguration(); ifcg.addr = dhcpInfoInternal.makeLinkAddress(); ifcg.interfaceFlags = "[up]"; try { - netd.setInterfaceConfig(mInterfaceName, ifcg); + nwService.setInterfaceConfig(mInterfaceName, ifcg); Log.v(TAG, "Static IP configuration succeeded"); sendMessage(CMD_STATIC_IP_SUCCESS, dhcpInfoInternal); } catch (RemoteException re) { |