summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorDavid van Tonder <david.vantonder@gmail.com>2013-01-14 04:49:10 -0800
committerGerrit Code Review <gerrit@review.cyanogenmod.com>2013-01-14 04:49:10 -0800
commit813729fe2b87e5b60b181fdeac9841448a4e62ec (patch)
tree45dc9c2d486f6e43fb73be1496f70a988aa06356 /wifi
parent19c7d4995a554bc26a17b55f481193c435d30560 (diff)
downloadframeworks_base-813729fe2b87e5b60b181fdeac9841448a4e62ec.zip
frameworks_base-813729fe2b87e5b60b181fdeac9841448a4e62ec.tar.gz
frameworks_base-813729fe2b87e5b60b181fdeac9841448a4e62ec.tar.bz2
Revert "Patch Set 1/2: Add an "Automatically Connect" option for WiFi networks"
This commit breaks 3rd party apps like Tasker. It is being reverted until a better solution can be found. This reverts commit 19c7d4995a554bc26a17b55f481193c435d30560 Change-Id: Ie279aab8f52bd30dc21dbc70040fb3bd23721e33
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/WifiConfigStore.java58
-rw-r--r--wifi/java/android/net/wifi/WifiConfiguration.java15
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java8
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java1
4 files changed, 2 insertions, 80 deletions
diff --git a/wifi/java/android/net/wifi/WifiConfigStore.java b/wifi/java/android/net/wifi/WifiConfigStore.java
index 4267eb2..84506b6 100644
--- a/wifi/java/android/net/wifi/WifiConfigStore.java
+++ b/wifi/java/android/net/wifi/WifiConfigStore.java
@@ -142,7 +142,6 @@ class WifiConfigStore {
private static final String PROXY_PORT_KEY = "proxyPort";
private static final String EXCLUSION_LIST_KEY = "exclusionList";
private static final String EOS = "eos";
- private static final String AUTO_CONNECT_KEY = "autoConnect";
private WifiNative mWifiNative;
@@ -180,7 +179,7 @@ class WifiConfigStore {
void enableAllNetworks() {
boolean networkEnabledStateChanged = false;
for(WifiConfiguration config : mConfiguredNetworks.values()) {
- if(config != null && config.status == Status.DISABLED && config.autoConnect) {
+ if(config != null && config.status == Status.DISABLED) {
if(mWifiNative.enableNetwork(config.networkId, false)) {
networkEnabledStateChanged = true;
config.status = Status.ENABLED;
@@ -196,21 +195,6 @@ class WifiConfigStore {
}
}
- /**
- * disable all networks that don't have autoConnect set and save config.
- */
- void setStateFromAutoConnectAllNetworks() {
- for(WifiConfiguration config : mConfiguredNetworks.values()) {
- if(config != null) {
- if (config.status == Status.DISABLED && config.autoConnect) {
- enableNetwork(config.networkId, false);
- } else if (config.status == Status.ENABLED && !config.autoConnect) {
- disableNetwork(config.networkId);
- }
- }
- }
-
- }
/**
* Selects the specified network for connection. This involves
@@ -238,13 +222,10 @@ class WifiConfigStore {
mLastPriority = 0;
}
- boolean tmpAutoConnect = true;
- tmpAutoConnect = mConfiguredNetworks.get(netId).autoConnect;
// Set to the highest priority and save the configuration.
WifiConfiguration config = new WifiConfiguration();
config.networkId = netId;
config.priority = ++mLastPriority;
- config.autoConnect = tmpAutoConnect;
addOrUpdateNetworkNative(config);
mWifiNative.saveConfig();
@@ -297,9 +278,6 @@ class WifiConfigStore {
if (config.status == Status.CURRENT) {
config.status = Status.ENABLED;
}
- else if (!config.autoConnect) {
- config.status = Status.DISABLED;
- }
break;
default:
//do nothing, retain the existing state
@@ -820,8 +798,6 @@ class WifiConfigStore {
break;
}
if (writeToFile) {
- out.writeUTF(AUTO_CONNECT_KEY);
- out.writeUTF((config.autoConnect ? "True" : "False"));
out.writeUTF(ID_KEY);
out.writeInt(configKey(config));
}
@@ -874,12 +850,10 @@ class WifiConfigStore {
IpAssignment ipAssignment = IpAssignment.UNASSIGNED;
ProxySettings proxySettings = ProxySettings.UNASSIGNED;
LinkProperties linkProperties = new LinkProperties();
- boolean autoConnect = true;
String proxyHost = null;
int proxyPort = -1;
String exclusionList = null;
String key;
- String value;
do {
key = in.readUTF();
@@ -912,13 +886,6 @@ class WifiConfigStore {
} else if (key.equals(DNS_KEY)) {
linkProperties.addDns(
NetworkUtils.numericToInetAddress(in.readUTF()));
- } else if (key.equals(AUTO_CONNECT_KEY)) {
- value = in.readUTF();
- if (value.equals("True")) {
- autoConnect = true;
- } else {
- autoConnect = false;
- }
} else if (key.equals(PROXY_SETTINGS_KEY)) {
proxySettings = ProxySettings.valueOf(in.readUTF());
} else if (key.equals(PROXY_HOST_KEY)) {
@@ -975,7 +942,6 @@ class WifiConfigStore {
loge("Ignore invalid proxy settings while reading");
break;
}
- config.autoConnect = autoConnect;
}
} else {
if (DBG) log("Missing id while parsing configuration");
@@ -1223,7 +1189,6 @@ class WifiConfigStore {
WifiConfiguration newConfig) {
boolean ipChanged = false;
boolean proxyChanged = false;
- boolean autoConnectChanged = false;
LinkProperties linkProperties = new LinkProperties();
switch (newConfig.ipAssignment) {
@@ -1289,19 +1254,6 @@ class WifiConfigStore {
break;
}
- boolean newAutoConnect = newConfig.autoConnect;
- boolean currentAutoConnect = currentConfig.autoConnect;
- if (newAutoConnect == currentAutoConnect) {
- autoConnectChanged = false;
- } else {
- autoConnectChanged = true;
- if (newAutoConnect) {
- enableNetwork(newConfig.networkId, false);
- } else {
- disableNetwork(newConfig.networkId);
- }
- }
-
if (!ipChanged) {
addIpSettingsFromConfig(linkProperties, currentConfig);
} else {
@@ -1323,13 +1275,7 @@ class WifiConfigStore {
}
}
- if (!autoConnectChanged) {
- currentConfig.autoConnect = currentConfig.autoConnect;
- } else {
- currentConfig.autoConnect = newConfig.autoConnect;
- }
-
- if (ipChanged || proxyChanged || autoConnectChanged) {
+ if (ipChanged || proxyChanged) {
currentConfig.linkProperties = linkProperties;
writeIpAndProxyConfigurations();
sendConfiguredNetworksChangedBroadcast(currentConfig,
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 7ef85b9..c4fe1b4 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -77,8 +77,6 @@ public class WifiConfiguration implements Parcelable {
/** {@hide} */
public static final String hiddenSSIDVarName = "scan_ssid";
/** {@hide} */
- public static final String autoConnectVarName = "autoConnect";
- /** {@hide} */
public static final int INVALID_NETWORK_ID = -1;
/** {@hide} */
@@ -401,18 +399,12 @@ public class WifiConfiguration implements Parcelable {
*/
public LinkProperties linkProperties;
- /**
- * @hide
- */
- public boolean autoConnect;
-
public WifiConfiguration() {
networkId = INVALID_NETWORK_ID;
SSID = null;
BSSID = null;
priority = 0;
hiddenSSID = false;
- status = WifiConfiguration.Status.DISABLED;
disableReason = DISABLED_UNKNOWN_REASON;
allowedKeyManagement = new BitSet();
allowedProtocols = new BitSet();
@@ -427,7 +419,6 @@ public class WifiConfiguration implements Parcelable {
}
ipAssignment = IpAssignment.UNASSIGNED;
proxySettings = ProxySettings.UNASSIGNED;
- autoConnect = false;
linkProperties = new LinkProperties();
}
@@ -515,8 +506,6 @@ public class WifiConfiguration implements Parcelable {
sbuf.append("\n");
sbuf.append("Proxy settings: " + proxySettings.toString());
sbuf.append("\n");
- sbuf.append("Auto Connect: " + (autoConnect ? "True" : "False"));
- sbuf.append("\n");
sbuf.append(linkProperties.toString());
sbuf.append("\n");
@@ -611,7 +600,6 @@ public class WifiConfiguration implements Parcelable {
wepTxKeyIndex = source.wepTxKeyIndex;
priority = source.priority;
hiddenSSID = source.hiddenSSID;
- status = source.status;
allowedKeyManagement = (BitSet) source.allowedKeyManagement.clone();
allowedProtocols = (BitSet) source.allowedProtocols.clone();
allowedAuthAlgorithms = (BitSet) source.allowedAuthAlgorithms.clone();
@@ -623,7 +611,6 @@ public class WifiConfiguration implements Parcelable {
}
ipAssignment = source.ipAssignment;
proxySettings = source.proxySettings;
- autoConnect = source.autoConnect;
linkProperties = new LinkProperties(source.linkProperties);
}
}
@@ -653,7 +640,6 @@ public class WifiConfiguration implements Parcelable {
}
dest.writeString(ipAssignment.name());
dest.writeString(proxySettings.name());
- dest.writeString(autoConnect ? "True" : "False");
dest.writeParcelable(linkProperties, flags);
}
@@ -685,7 +671,6 @@ public class WifiConfiguration implements Parcelable {
config.ipAssignment = IpAssignment.valueOf(in.readString());
config.proxySettings = ProxySettings.valueOf(in.readString());
- config.autoConnect = !in.readString().equals("False");
config.linkProperties = in.readParcelable(null);
return config;
}
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 7463060..5e4f117 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -1077,14 +1077,6 @@ public class WifiManager {
*/
public boolean stopWifi() {
try {
- for (WifiConfiguration config : getConfiguredNetworks()) {
- if (config != null) {
- if (!config.autoConnect) {
- disableNetwork(config.networkId);
- }
- }
- }
- saveConfiguration();
mService.stopWifi();
return true;
} catch (RemoteException e) {
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 76c3311..26bb095 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -766,7 +766,6 @@ public class WifiStateMachine extends StateMachine {
sendMessage(obtainMessage(CMD_LOAD_DRIVER, WIFI_STATE_ENABLING, 0));
sendMessage(CMD_START_SUPPLICANT);
} else {
- mWifiConfigStore.setStateFromAutoConnectAllNetworks();
sendMessage(CMD_STOP_SUPPLICANT);
/* Argument is the state that is entered upon success */
sendMessage(obtainMessage(CMD_UNLOAD_DRIVER, WIFI_STATE_DISABLED, 0));