summaryrefslogtreecommitdiffstats
path: root/wifi/java
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2011-05-20 16:06:19 -0700
committerIrfan Sheriff <isheriff@google.com>2011-05-23 17:02:11 -0700
commit0a8bd60a8e064c8d310f0abd9503350633b05eca (patch)
treed8625bf069019472ded8c6c92398b3d34fc7c738 /wifi/java
parent82de141db736b95b0e388ff060e2d2535192d769 (diff)
downloadframeworks_base-0a8bd60a8e064c8d310f0abd9503350633b05eca.zip
frameworks_base-0a8bd60a8e064c8d310f0abd9503350633b05eca.tar.gz
frameworks_base-0a8bd60a8e064c8d310f0abd9503350633b05eca.tar.bz2
Clear network id when invalid
Bug: 4391449 Change-Id: If0902a3fe4ad65d34dfc3d60f0e630d5e868d6a9
Diffstat (limited to 'wifi/java')
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index f2211d2..e03680f 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -481,7 +481,7 @@ public class WifiStateMachine extends StateMachine {
mNetworkInfo.setIsAvailable(false);
mLinkProperties.clear();
mLastBssid = null;
- mLastNetworkId = -1;
+ mLastNetworkId = WifiConfiguration.INVALID_NETWORK_ID;
mLastSignalLevel = -1;
mAlarmManager = (AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE);
@@ -821,11 +821,12 @@ public class WifiStateMachine extends StateMachine {
}
public void connectNetwork(WifiConfiguration wifiConfig) {
- /* arg1 is used to indicate netId, force a netId value of -1 when
- * we are passing a configuration since the default value of
- * 0 is a valid netId
+ /* arg1 is used to indicate netId, force a netId value of
+ * WifiConfiguration.INVALID_NETWORK_ID when we are passing
+ * a configuration since the default value of 0 is a valid netId
*/
- sendMessage(obtainMessage(CMD_CONNECT_NETWORK, -1, 0, wifiConfig));
+ sendMessage(obtainMessage(CMD_CONNECT_NETWORK, WifiConfiguration.INVALID_NETWORK_ID,
+ 0, wifiConfig));
}
public void saveNetwork(WifiConfiguration wifiConfig) {
@@ -1429,7 +1430,7 @@ public class WifiStateMachine extends StateMachine {
mWifiInfo.setInetAddress(null);
mWifiInfo.setBSSID(null);
mWifiInfo.setSSID(null);
- mWifiInfo.setNetworkId(-1);
+ mWifiInfo.setNetworkId(WifiConfiguration.INVALID_NETWORK_ID);
mWifiInfo.setRssi(MIN_RSSI);
mWifiInfo.setLinkSpeed(-1);
@@ -1441,7 +1442,7 @@ public class WifiStateMachine extends StateMachine {
mLinkProperties.clear();
mLastBssid= null;
- mLastNetworkId = -1;
+ mLastNetworkId = WifiConfiguration.INVALID_NETWORK_ID;
}
@@ -2034,7 +2035,7 @@ public class WifiStateMachine extends StateMachine {
mWpsStateMachine.sendMessage(CMD_RESET_WPS_STATE);
/* Initialize data structures */
mLastBssid = null;
- mLastNetworkId = -1;
+ mLastNetworkId = WifiConfiguration.INVALID_NETWORK_ID;
mLastSignalLevel = -1;
mWifiInfo.setMacAddress(WifiNative.getMacAddressCommand());
@@ -2524,7 +2525,10 @@ public class WifiStateMachine extends StateMachine {
// Network id is only valid when we start connecting
if (SupplicantState.isConnecting(state)) {
mWifiInfo.setNetworkId(stateChangeResult.networkId);
+ } else {
+ mWifiInfo.setNetworkId(WifiConfiguration.INVALID_NETWORK_ID);
}
+
if (state == SupplicantState.ASSOCIATING) {
/* BSSID is valid only in ASSOCIATING state */
mWifiInfo.setBSSID(stateChangeResult.BSSID);