summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorAndrew Dodd <atd7@cornell.edu>2012-09-12 21:57:51 -0400
committerAndrew Dodd <atd7@cornell.edu>2012-12-17 08:10:57 -0500
commite34357d14cd2aadd3a6dc8ddb0c53bc48d3d87f4 (patch)
tree6e40d15b34784a60401d44ad7f4173dcedb88b92 /wifi
parent24a86e7b0605586f6d11b510527ce93448f1d6ba (diff)
downloadframeworks_base-e34357d14cd2aadd3a6dc8ddb0c53bc48d3d87f4.zip
frameworks_base-e34357d14cd2aadd3a6dc8ddb0c53bc48d3d87f4.tar.gz
frameworks_base-e34357d14cd2aadd3a6dc8ddb0c53bc48d3d87f4.tar.bz2
wifi: Allow Settings to retrieve country code
This makes getCountryCode behave like getFrequencyBand This allows Settings to get/set country code like it can for frequency band. Change-Id: Id9f00d3a678642c6c142fd1511af820d729507a7
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/IWifiManager.aidl2
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java12
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java14
3 files changed, 27 insertions, 1 deletions
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 55de065..1e67938 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -61,6 +61,8 @@ interface IWifiManager
void setCountryCode(String country, boolean persist);
+ String getCountryCode();
+
void setFrequencyBand(int band, boolean persist);
int getFrequencyBand();
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index b871cdc..5e4f117 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -810,6 +810,18 @@ public class WifiManager {
}
/**
+ * Get the operational country code.
+ * @hide
+ */
+ public String getCountryCode() {
+ try {
+ return mService.getCountryCode();
+ } catch (RemoteException e) {
+ return null;
+ }
+ }
+
+ /**
* Set the operational frequency band.
* @param band One of
* {@link #WIFI_FREQUENCY_BAND_AUTO},
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index ff6c692..9a9cad2 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -209,6 +209,9 @@ public class WifiStateMachine extends StateMachine {
/* Tracks current frequency mode */
private AtomicInteger mFrequencyBand = new AtomicInteger(WifiManager.WIFI_FREQUENCY_BAND_AUTO);
+ /* Tracks current country code */
+ private String mCountryCode = "GB";
+
/* Tracks if we are filtering Multicast v4 packets. Default is to filter. */
private AtomicBoolean mFilteringMulticastV4Packets = new AtomicBoolean(true);
@@ -1079,6 +1082,13 @@ public class WifiStateMachine extends StateMachine {
}
/**
+ * Returns the operational country code
+ */
+ public String getCountryCode() {
+ return mCountryCode;
+ }
+
+ /**
* Set the operational frequency band
* @param band
* @param persist {@code true} if the setting should be remembered.
@@ -2792,7 +2802,9 @@ 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())) {
+ if (mWifiNative.setCountryCode(country.toUpperCase())) {
+ mCountryCode = country;
+ } else {
loge("Failed to set country code " + country);
}
break;