summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2010-06-15 10:48:31 -0700
committerIrfan Sheriff <isheriff@google.com>2010-06-16 14:14:22 -0700
commitf897b443fed5c88c6b12e3fa1da72f231db67673 (patch)
tree063f64c54de8c766ba4dedd492eb184e501c55dd /wifi
parentc980ba25b0916d7c276c23e420195dd7959379a0 (diff)
downloadframeworks_base-f897b443fed5c88c6b12e3fa1da72f231db67673.zip
frameworks_base-f897b443fed5c88c6b12e3fa1da72f231db67673.tar.gz
frameworks_base-f897b443fed5c88c6b12e3fa1da72f231db67673.tar.bz2
Fix driver stop check
- Remove check for supplicant command: setScanResultHandling - Add check for stopDriver - Fix condition for rest of commands Bug: 2771298 Change-Id: I1262b2228814c4f6a4c251390af2f445c5f47234
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/WifiStateTracker.java51
1 files changed, 27 insertions, 24 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java
index 78a9674..8b2cfc6 100644
--- a/wifi/java/android/net/wifi/WifiStateTracker.java
+++ b/wifi/java/android/net/wifi/WifiStateTracker.java
@@ -1483,18 +1483,19 @@ public class WifiStateTracker extends NetworkStateTracker {
* disconnect or stop command was initiated.
*/
public synchronized boolean disconnectAndStop() {
+ boolean ret = true;;
if (mRunState != RUN_STATE_STOPPING && mRunState != RUN_STATE_STOPPED) {
// Take down any open network notifications
setNotificationVisible(false, 0, false, 0);
- mRunState = RUN_STATE_STOPPING;
if (mWifiInfo.getSupplicantState() == SupplicantState.DORMANT) {
- return stopDriver();
+ ret = stopDriver();
} else {
- return disconnect();
+ ret = disconnect();
}
+ mRunState = RUN_STATE_STOPPING;
}
- return true;
+ return ret;
}
public synchronized boolean restart() {
@@ -1605,7 +1606,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return {@code true} if the operation succeeds, {@code false} otherwise
*/
public synchronized boolean scan(boolean forceActive) {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return false;
}
return WifiNative.scanCommand(forceActive);
@@ -1621,7 +1622,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return {@code true} if the operation succeeds, {@code false} otherwise
*/
public synchronized boolean setScanResultHandling(int mode) {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED) {
return false;
}
return WifiNative.setScanResultHandlingCommand(mode);
@@ -1635,7 +1636,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* 00:bb:cc:dd:cc:ff 2412 165 [WPA-EAP-TKIP][WPA2-EAP-CCMP] Net2
*/
public synchronized String scanResults() {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return null;
}
return WifiNative.scanResultsCommand();
@@ -1647,7 +1648,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return {@code true} if the operation succeeds, {@code false} otherwise
*/
public synchronized boolean setScanMode(boolean isScanModeActive) {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return false;
}
if (mIsScanModeActive != isScanModeActive) {
@@ -1662,7 +1663,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return {@code true} if the operation succeeds, {@code false} otherwise
*/
public synchronized boolean disconnect() {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return false;
}
return WifiNative.disconnectCommand();
@@ -1674,7 +1675,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return {@code true} if the operation succeeds, {@code false} otherwise
*/
public synchronized boolean reconnectCommand() {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return false;
}
return WifiNative.reconnectCommand();
@@ -1738,7 +1739,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return {@code true} if the operation succeeds, {@code false} otherwise
*/
public synchronized boolean reassociate() {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return false;
}
return WifiNative.reassociateCommand();
@@ -1837,7 +1838,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return RSSI value, -1 on failure
*/
public synchronized int getRssi() {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return -1;
}
return WifiNative.getRssiApproxCommand();
@@ -1849,7 +1850,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return RSSI value, -1 on failure
*/
public synchronized int getRssiApprox() {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return -1;
}
return WifiNative.getRssiApproxCommand();
@@ -1861,7 +1862,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return link speed, -1 on failure
*/
public synchronized int getLinkSpeed() {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return -1;
}
return WifiNative.getLinkSpeedCommand();
@@ -1873,7 +1874,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return MAC address, null on failure
*/
public synchronized String getMacAddress() {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return null;
}
return WifiNative.getMacAddressCommand();
@@ -1897,7 +1898,9 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return {@code true} if the operation succeeds, {@code false} otherwise
*/
public synchronized boolean stopDriver() {
- if (mWifiState.get() != WIFI_STATE_ENABLED) {
+ /* Driver stop should not happen only when supplicant event
+ * DRIVER_STOPPED has already been handled */
+ if (mWifiState.get() != WIFI_STATE_ENABLED || mRunState == RUN_STATE_STOPPED) {
return false;
}
return WifiNative.stopDriverCommand();
@@ -1909,7 +1912,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return {@code true} if the operation succeeds, {@code false} otherwise
*/
public synchronized boolean startPacketFiltering() {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return false;
}
return WifiNative.startPacketFiltering();
@@ -1921,7 +1924,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return {@code true} if the operation succeeds, {@code false} otherwise
*/
public synchronized boolean stopPacketFiltering() {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return false;
}
return WifiNative.stopPacketFiltering();
@@ -1935,7 +1938,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return {@code true} if the operation succeeds, {@code false} otherwise
*/
public synchronized boolean setPowerMode(int mode) {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return false;
}
return WifiNative.setPowerModeCommand(mode);
@@ -1948,7 +1951,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* the number of channels is invalid.
*/
public synchronized boolean setNumAllowedChannels() {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return false;
}
try {
@@ -1973,7 +1976,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* {@code numChannels} is outside the valid range.
*/
public synchronized boolean setNumAllowedChannels(int numChannels) {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return false;
}
mNumAllowedChannels = numChannels;
@@ -1986,7 +1989,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return channel count, -1 on failure
*/
public synchronized int getNumAllowedChannels() {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return -1;
}
return WifiNative.getNumAllowedChannelsCommand();
@@ -2002,7 +2005,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @return {@code true} if the operation succeeds, {@code false} otherwise
*/
public synchronized boolean setBluetoothCoexistenceMode(int mode) {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return false;
}
return WifiNative.setBluetoothCoexistenceModeCommand(mode);
@@ -2016,7 +2019,7 @@ public class WifiStateTracker extends NetworkStateTracker {
* @param isBluetoothPlaying whether to enable or disable this mode
*/
public synchronized void setBluetoothScanMode(boolean isBluetoothPlaying) {
- if (mWifiState.get() != WIFI_STATE_ENABLED && !isDriverStopped()) {
+ if (mWifiState.get() != WIFI_STATE_ENABLED || isDriverStopped()) {
return;
}
WifiNative.setBluetoothCoexistenceScanModeCommand(isBluetoothPlaying);