diff options
author | Mike Lockwood <lockwood@android.com> | 2009-07-10 17:24:07 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2009-07-10 17:24:07 -0400 |
commit | 0900f3657664d9046e6723825fd32b244eef2b6c (patch) | |
tree | 770dae272d11945320396c00b5cd0df763e18698 /wifi | |
parent | f1a43bbc32ad4450e4af3a5488f889ce095cf503 (diff) | |
download | frameworks_base-0900f3657664d9046e6723825fd32b244eef2b6c.zip frameworks_base-0900f3657664d9046e6723825fd32b244eef2b6c.tar.gz frameworks_base-0900f3657664d9046e6723825fd32b244eef2b6c.tar.bz2 |
wifi: Keep the WLAN network interface up whenever wifi is enabled.
We now only bring it down briefly and bring it back up again when
we want to reset the interface.
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateTracker.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java index 0e2eb38..a2cdcc1 100644 --- a/wifi/java/android/net/wifi/WifiStateTracker.java +++ b/wifi/java/android/net/wifi/WifiStateTracker.java @@ -378,6 +378,14 @@ public class WifiStateTracker extends NetworkStateTracker { } /** + * Return the name of our WLAN network interface. + * @return the name of our interface. + */ + public String getInterfaceName() { + return mInterfaceName; + } + + /** * Return the system properties name associated with the tcp buffer sizes * for this network. */ @@ -784,7 +792,7 @@ public class WifiStateTracker extends NetworkStateTracker { WifiNative.closeSupplicantConnection(); } if (died) { - resetInterface(); + resetInterface(false); } // When supplicant dies, kill the DHCP thread if (mDhcpTarget != null) { @@ -1195,7 +1203,7 @@ public class WifiStateTracker extends NetworkStateTracker { cancelDisconnect(); } mDisconnectExpected = false; - resetInterface(); + resetInterface(true); setDetailedState(newState); sendNetworkStateChangeBroadcast(mLastBssid); mWifiInfo.setBSSID(null); @@ -1208,7 +1216,7 @@ public class WifiStateTracker extends NetworkStateTracker { * Resets the Wi-Fi interface by clearing any state, resetting any sockets * using the interface, stopping DHCP, and disabling the interface. */ - public void resetInterface() { + public void resetInterface(boolean reenable) { mHaveIpAddress = false; mObtainingIpAddress = false; mWifiInfo.setIpAddress(0); @@ -1229,6 +1237,9 @@ public class WifiStateTracker extends NetworkStateTracker { } NetworkUtils.disableInterface(mInterfaceName); + if (reenable) { + NetworkUtils.enableInterface(mInterfaceName); + } } /** @@ -1872,7 +1883,7 @@ public class WifiStateTracker extends NetworkStateTracker { oDns2 != mDhcpInfo.dns2)); if (changed) { - resetInterface(); + resetInterface(true); configureInterface(); if (mUseStaticIp) { mTarget.sendEmptyMessage(EVENT_CONFIGURATION_CHANGED); |