diff options
author | Xia Wang <xiaw@google.com> | 2011-04-13 15:13:10 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-04-13 15:13:10 -0700 |
commit | 46b59ef01be530a6bbe3f0e9a2bed27de9985f40 (patch) | |
tree | 82d36ecdb0c4f38fb24c43d8e10b71546bb4b474 /core | |
parent | b0d6f10eedeef099164995d51dbd076a6fcc5acc (diff) | |
parent | dddfaa75e77f4d02cc7b4180f5eb0679321cb628 (diff) | |
download | frameworks_base-46b59ef01be530a6bbe3f0e9a2bed27de9985f40.zip frameworks_base-46b59ef01be530a6bbe3f0e9a2bed27de9985f40.tar.gz frameworks_base-46b59ef01be530a6bbe3f0e9a2bed27de9985f40.tar.bz2 |
Merge "Fix access point parsing: reset static link property after parsing static ip setting Fix removeConfiguredNetwork: add sleep between remove configured network and disable wifi" into honeycomb-mr1
Diffstat (limited to 'core')
3 files changed, 26 insertions, 57 deletions
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java index 3667c7b..d22356d 100644 --- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java +++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/AccessPointParserHelper.java @@ -182,6 +182,7 @@ public class AccessPointParserHelper { } config.proxySettings = ProxySettings.NONE; networks.add(config); + mLinkProperties = null; } } diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java index e138200..adf1883 100644 --- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java +++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestActivity.java @@ -242,10 +242,10 @@ public class ConnectivityManagerTestActivity extends Activity { initializeNetworkStates(); - if (mWifiManager.isWifiEnabled()) { - log("Clear Wifi before we start the test."); - removeConfiguredNetworksAndDisableWifi(); - } + mWifiManager.setWifiEnabled(true); + log("Clear Wifi before we start the test."); + sleep(SHORT_TIMEOUT); + removeConfiguredNetworksAndDisableWifi(); mWifiRegexs = mCM.getTetherableWifiRegexs(); } @@ -633,13 +633,13 @@ public class ConnectivityManagerTestActivity extends Activity { * Disconnect from the current AP and remove configured networks. */ public boolean disconnectAP() { - if (mWifiManager.isWifiEnabled()) { - // remove saved networks - List<WifiConfiguration> wifiConfigList = mWifiManager.getConfiguredNetworks(); - for (WifiConfiguration wifiConfig: wifiConfigList) { - log("remove wifi configuration: " + wifiConfig.toString()); - mWifiManager.forgetNetwork(wifiConfig.networkId); - } + // remove saved networks + List<WifiConfiguration> wifiConfigList = mWifiManager.getConfiguredNetworks(); + log("size of wifiConfigList: " + wifiConfigList.size()); + for (WifiConfiguration wifiConfig: wifiConfigList) { + log("remove wifi configuration: " + wifiConfig.networkId); + int netId = wifiConfig.networkId; + mWifiManager.forgetNetwork(netId); } return true; } @@ -655,20 +655,23 @@ public class ConnectivityManagerTestActivity extends Activity { * Remove configured networks and disable wifi */ public boolean removeConfiguredNetworksAndDisableWifi() { - if (!disconnectAP()) { - return false; - } - // Disable Wifi - if (!mWifiManager.setWifiEnabled(false)) { - return false; - } - // Wait for the actions to be completed - try { - Thread.sleep(SHORT_TIMEOUT); - } catch (InterruptedException e) {} + if (!disconnectAP()) { + return false; + } + sleep(SHORT_TIMEOUT); + if (!mWifiManager.setWifiEnabled(false)) { + return false; + } + sleep(SHORT_TIMEOUT); return true; } + private void sleep(long sleeptime) { + try { + Thread.sleep(sleeptime); + } catch (InterruptedException e) {} + } + /** * Set airplane mode */ diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/WifiConnectionTest.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/WifiConnectionTest.java index fe79e6c..22b1759 100644 --- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/WifiConnectionTest.java +++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/WifiConnectionTest.java @@ -72,10 +72,8 @@ public class WifiConnectionTest @Override public void setUp() throws Exception { super.setUp(); - log("before we launch the test activity, we preserve all the configured networks."); mRunner = ((ConnectivityManagerTestRunner)getInstrumentation()); mWifiManager = (WifiManager) mRunner.getContext().getSystemService(Context.WIFI_SERVICE); - enabledNetworks = getEnabledNetworks(mWifiManager.getConfiguredNetworks()); mAct = getActivity(); mWifiManager.asyncConnect(mAct, new WifiServiceHandler()); @@ -123,42 +121,9 @@ public class WifiConnectionTest public void tearDown() throws Exception { log("tearDown()"); mAct.removeConfiguredNetworksAndDisableWifi(); - reEnableNetworks(enabledNetworks); super.tearDown(); } - private Set<WifiConfiguration> getEnabledNetworks(List<WifiConfiguration> configuredNetworks) { - Set<WifiConfiguration> networks = new HashSet<WifiConfiguration>(); - for (WifiConfiguration wifiConfig : configuredNetworks) { - if (wifiConfig.status == Status.ENABLED || wifiConfig.status == Status.CURRENT) { - networks.add(wifiConfig); - log("remembering enabled network " + wifiConfig.SSID + - " status is " + wifiConfig.status); - } - } - return networks; - } - - private void reEnableNetworks(Set<WifiConfiguration> enabledNetworks) { - if (!mWifiManager.isWifiEnabled()) { - log("reEnableNetworks: enable Wifi"); - mWifiManager.setWifiEnabled(true); - sleep(ConnectivityManagerTestActivity.SHORT_TIMEOUT, - "interruped while waiting for wifi to be enabled"); - } - - for (WifiConfiguration config : enabledNetworks) { - if (DEBUG) { - log("recover wifi configuration: " + config.toString()); - } - config.SSID = "\"" + config.SSID + "\""; - config.networkId = -1; - mWifiManager.connectNetwork(config); - sleep(ConnectivityManagerTestActivity.SHORT_TIMEOUT, - "interruped while connecting to " + config.SSID); - } - } - /** * Connect to the provided Wi-Fi network * @param config is the network configuration |