summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2013-10-04 18:33:51 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-10-04 18:33:51 +0000
commitcac2fd302e844a4a46bb1749a2d2ed4739b4dc53 (patch)
treea654005bbde664bcfbb63a70e2f120380072aac1 /wifi
parent548622a26ac758f72eb0dbb16cd83aa5d51f2b2b (diff)
parent3ea0c99b67407bb1612875762b037e50f013fd6d (diff)
downloadframeworks_base-cac2fd302e844a4a46bb1749a2d2ed4739b4dc53.zip
frameworks_base-cac2fd302e844a4a46bb1749a2d2ed4739b4dc53.tar.gz
frameworks_base-cac2fd302e844a4a46bb1749a2d2ed4739b4dc53.tar.bz2
Merge "Revert "Use a build-specific wifi country code"" into klp-dev
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/WifiStateMachine.java14
-rw-r--r--wifi/java/android/net/wifi/p2p/WifiP2pService.java6
2 files changed, 18 insertions, 2 deletions
diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java
index cf09836..349fe24 100644
--- a/wifi/java/android/net/wifi/WifiStateMachine.java
+++ b/wifi/java/android/net/wifi/WifiStateMachine.java
@@ -1466,6 +1466,9 @@ public class WifiStateMachine extends StateMachine {
public void setCountryCode(String countryCode, boolean persist) {
if (persist) {
mPersistedCountryCode = countryCode;
+ Settings.Global.putString(mContext.getContentResolver(),
+ Settings.Global.WIFI_COUNTRY_CODE,
+ countryCode);
}
sendMessage(CMD_SET_COUNTRY_CODE, countryCode);
mWifiP2pChannel.sendMessage(WifiP2pService.SET_COUNTRY_CODE, countryCode);
@@ -1698,8 +1701,8 @@ public class WifiStateMachine extends StateMachine {
* Set the country code from the system setting value, if any.
*/
private void setCountryCode() {
- String countryCode = mContext.getResources().getString(
- R.string.config_wifi_default_country_code);
+ String countryCode = Settings.Global.getString(mContext.getContentResolver(),
+ Settings.Global.WIFI_COUNTRY_CODE);
if (countryCode != null && !countryCode.isEmpty()) {
setCountryCode(countryCode, false);
} else {
@@ -2424,6 +2427,13 @@ public class WifiStateMachine extends StateMachine {
case CMD_BOOT_COMPLETED:
String countryCode = mPersistedCountryCode;
if (TextUtils.isEmpty(countryCode) == false) {
+ Settings.Global.putString(mContext.getContentResolver(),
+ Settings.Global.WIFI_COUNTRY_CODE,
+ countryCode);
+ // it may be that the state transition that should send this info
+ // to the driver happened between mPersistedCountryCode getting set
+ // and now, so simply persisting it here would mean we have sent
+ // nothing to the driver. Send the cmd so it might be set now.
sendMessageAtFrontOfQueue(CMD_SET_COUNTRY_CODE, countryCode);
}
break;
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
index 50e8e3d..625ffb8 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
@@ -2545,6 +2545,12 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
mServiceTransactionId = 0;
mServiceDiscReqId = null;
+ String countryCode = Settings.Global.getString(mContext.getContentResolver(),
+ Settings.Global.WIFI_COUNTRY_CODE);
+ if (countryCode != null && !countryCode.isEmpty()) {
+ mP2pStateMachine.sendMessage(SET_COUNTRY_CODE, countryCode);
+ }
+
updatePersistentNetworks(RELOAD);
}