From 3ea0c99b67407bb1612875762b037e50f013fd6d Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Thu, 3 Oct 2013 21:13:49 +0000 Subject: Revert "Use a build-specific wifi country code" This reverts commit c33cd23c17c24df33550a6662cedfe60b323604a. bug:11064682 Change-Id: I35825a7005e75f3abf02f23f31dee1cb7b101c31 --- wifi/java/android/net/wifi/WifiStateMachine.java | 14 ++++++++++++-- wifi/java/android/net/wifi/p2p/WifiP2pService.java | 6 ++++++ 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'wifi/java/android/net') diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 798bc2e..76bd636 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -1456,6 +1456,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); @@ -1688,8 +1691,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 { @@ -2414,6 +2417,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); } -- cgit v1.1