summaryrefslogtreecommitdiffstats
path: root/wifi/java
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2011-01-11 11:17:14 -0800
committerIrfan Sheriff <isheriff@google.com>2011-01-11 12:11:36 -0800
commit6bb7652b47b7c3068fa5e20a20263e651180c856 (patch)
tree86671d1e5f090ac3b1c49d8f26cea511bd18e436 /wifi/java
parentc1960a602037fc4a421e56794bbc581e650b3bcb (diff)
downloadframeworks_base-6bb7652b47b7c3068fa5e20a20263e651180c856.zip
frameworks_base-6bb7652b47b7c3068fa5e20a20263e651180c856.tar.gz
frameworks_base-6bb7652b47b7c3068fa5e20a20263e651180c856.tar.bz2
Fix network availability reporting
Report wifi is available as long as it is kept on Change-Id: I5be9461106ef4968cbc423f90e0ff168e089791f
Diffstat (limited to 'wifi/java')
-rw-r--r--wifi/java/android/net/wifi/SupplicantStateTracker.java13
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java20
2 files changed, 11 insertions, 22 deletions
diff --git a/wifi/java/android/net/wifi/SupplicantStateTracker.java b/wifi/java/android/net/wifi/SupplicantStateTracker.java
index 1a00507..f96a5ae 100644
--- a/wifi/java/android/net/wifi/SupplicantStateTracker.java
+++ b/wifi/java/android/net/wifi/SupplicantStateTracker.java
@@ -192,27 +192,16 @@ class SupplicantStateTracker extends HierarchicalStateMachine {
@Override
public void enter() {
if (DBG) Log.d(TAG, getName() + "\n");
- mWifiStateMachine.setNetworkAvailable(false);
}
- @Override
- public void exit() {
- mWifiStateMachine.setNetworkAvailable(true);
- }
}
class InactiveState extends HierarchicalState {
@Override
public void enter() {
if (DBG) Log.d(TAG, getName() + "\n");
- mWifiStateMachine.setNetworkAvailable(false);
}
- @Override
- public void exit() {
- mWifiStateMachine.setNetworkAvailable(true);
- }
}
-
class DisconnectedState extends HierarchicalState {
@Override
public void enter() {
@@ -336,4 +325,4 @@ class SupplicantStateTracker extends HierarchicalStateMachine {
if (DBG) Log.d(TAG, getName() + "\n");
}
}
-} \ No newline at end of file
+}
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 10faeda..8718117 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -299,10 +299,8 @@ public class WifiStateMachine extends HierarchicalStateMachine {
static final int CMD_SET_FREQUENCY_BAND = 90;
/* Commands from/to the SupplicantStateTracker */
- /* Indicates whether a wifi network is available for connection */
- static final int CMD_SET_NETWORK_AVAILABLE = 111;
/* Reset the supplicant state tracker */
- static final int CMD_RESET_SUPPLICANT_STATE = 112;
+ static final int CMD_RESET_SUPPLICANT_STATE = 111;
/* Commands/events reported by WpsStateMachine */
@@ -1451,10 +1449,6 @@ public class WifiStateMachine extends HierarchicalStateMachine {
setWifiEnabled(true);
}
- void setNetworkAvailable(boolean available) {
- sendMessage(obtainMessage(CMD_SET_NETWORK_AVAILABLE, available ? 1 : 0, 0));
- }
-
/********************************************************
* HSM states
*******************************************************/
@@ -1480,9 +1474,6 @@ public class WifiStateMachine extends HierarchicalStateMachine {
case CMD_ENABLE_RSSI_POLL:
mEnableRssiPolling = (message.arg1 == 1);
break;
- case CMD_SET_NETWORK_AVAILABLE:
- mNetworkInfo.setIsAvailable(message.arg1 == 1);
- break;
/* Discard */
case CMD_LOAD_DRIVER:
case CMD_UNLOAD_DRIVER:
@@ -1873,6 +1864,8 @@ public class WifiStateMachine extends HierarchicalStateMachine {
EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName());
/* Initialize for connect mode operation at start */
mIsScanMode = false;
+ /* Wifi is available as long as we have a connection to supplicant */
+ mNetworkInfo.setIsAvailable(true);
}
@Override
public boolean processMessage(Message message) {
@@ -1886,6 +1879,7 @@ public class WifiStateMachine extends HierarchicalStateMachine {
Log.e(TAG, "Failed to stop supplicant, issue kill");
WifiNative.killSupplicant();
}
+ mNetworkInfo.setIsAvailable(false);
handleNetworkDisconnect();
setWifiState(WIFI_STATE_DISABLING);
sendSupplicantConnectionChangedBroadcast(false);
@@ -1896,6 +1890,7 @@ public class WifiStateMachine extends HierarchicalStateMachine {
Log.e(TAG, "Connection lost, restart supplicant");
WifiNative.killSupplicant();
WifiNative.closeSupplicantConnection();
+ mNetworkInfo.setIsAvailable(false);
handleNetworkDisconnect();
sendSupplicantConnectionChangedBroadcast(false);
mSupplicantStateTracker.sendMessage(CMD_RESET_SUPPLICANT_STATE);
@@ -1975,6 +1970,11 @@ public class WifiStateMachine extends HierarchicalStateMachine {
}
return HANDLED;
}
+
+ @Override
+ public void exit() {
+ mNetworkInfo.setIsAvailable(false);
+ }
}
class SupplicantStoppingState extends HierarchicalState {