summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorJorge Ruesga <jorge@ruesga.com>2012-12-22 17:01:27 +0100
committerGerrit Code Review <gerrit@review.cyanogenmod.com>2013-01-14 06:49:57 -0800
commit24369cdae7fd0765d493728af31067491ddea004 (patch)
tree15cdc0f1d87c15d58259c77082de68efaaafc27f /wifi
parent056a2699d1db51b3397c36040fdd5e56faec6ce6 (diff)
downloadframeworks_base-24369cdae7fd0765d493728af31067491ddea004.zip
frameworks_base-24369cdae7fd0765d493728af31067491ddea004.tar.gz
frameworks_base-24369cdae7fd0765d493728af31067491ddea004.tar.bz2
Wi-Fi: Ping the driver for wifi-only devices
Wifi-only devices are not capable to find APs with hidden SSID unless a DRIVER COUNTRY command will send to wifi driver. This change has: - Send DRIVER COUNTRY command to ping the driver (to correct the seek of hiddens SSIDs) - Save mCountryCode as uppercase because the wifi_countrycode_values array is in uppercase. Otherwise the preference will not be found. Patchset 7: Rebase Do not set mCountryCode if country is null Change-Id: Ie0f838aef07eaf683b713f7f0e46ff3c751523ab
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/WifiNative.java4
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java17
2 files changed, 18 insertions, 3 deletions
diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java
index 54b758a..15d2378 100644
--- a/wifi/java/android/net/wifi/WifiNative.java
+++ b/wifi/java/android/net/wifi/WifiNative.java
@@ -360,6 +360,10 @@ public class WifiNative {
}
public boolean setCountryCode(String countryCode) {
+ if (countryCode == null) {
+ // Ping the driver
+ return doBooleanCommand("DRIVER COUNTRY");
+ }
return doBooleanCommand("DRIVER COUNTRY " + countryCode);
}
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index 26bb095..e823601 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -1346,7 +1346,15 @@ public class WifiStateMachine extends StateMachine {
if (countryCode != null && !countryCode.isEmpty()) {
setCountryCode(countryCode, false);
} else {
- //use driver default
+ // On wifi-only devices, some drivers don't find hidden SSIDs unless DRIVER COUNTRY
+ // is called. Pinging the wifi driver without country code resolves this issue.
+ ConnectivityManager cm =
+ (ConnectivityManager)mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (!cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)) {
+ setCountryCode(null, false);
+ }
+
+ // In other case, mmc tables from carrier do the trick of starting up the wifi driver
}
}
@@ -2804,8 +2812,11 @@ public class WifiStateMachine extends StateMachine {
case CMD_SET_COUNTRY_CODE:
String country = (String) message.obj;
if (DBG) log("set country code " + country);
- if (mWifiNative.setCountryCode(country.toUpperCase())) {
- mCountryCode = country;
+ String countryCode = country != null ? country.toUpperCase() : null;
+ if (mWifiNative.setCountryCode(countryCode)) {
+ if (countryCode != null) {
+ mCountryCode = countryCode;
+ }
} else {
loge("Failed to set country code " + country);
}