diff options
| author | Irfan Sheriff <isheriff@google.com> | 2010-10-29 15:32:10 -0700 |
|---|---|---|
| committer | Irfan Sheriff <isheriff@google.com> | 2010-11-02 16:35:56 -0700 |
| commit | ed4f28b492da3ff140bbaabbbda798a08c40ea5b (patch) | |
| tree | 5676b10fe89f58e9c460e766532a24d2104fc62c /core | |
| parent | 98444a944c9126898bc4c370f831a79bb3b30bd8 (diff) | |
| download | frameworks_base-ed4f28b492da3ff140bbaabbbda798a08c40ea5b.zip frameworks_base-ed4f28b492da3ff140bbaabbbda798a08c40ea5b.tar.gz frameworks_base-ed4f28b492da3ff140bbaabbbda798a08c40ea5b.tar.bz2 | |
Set country code in the driver and remove channel set
With dual band support, using country code
settings is the way to go
Bug: 2936741
Change-Id: I760dce4c43b1af19ee205c28f0d287420c8d9e85
Diffstat (limited to 'core')
| -rw-r--r-- | core/java/android/provider/Settings.java | 14 | ||||
| -rw-r--r-- | core/jni/android_net_wifi_Wifi.cpp | 46 | ||||
| -rwxr-xr-x | core/res/res/values/strings.xml | 5 |
3 files changed, 23 insertions, 42 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index ee53828..2229964 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -1199,12 +1199,6 @@ public final class Settings { */ public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2"; - /** - * The number of radio channels that are allowed in the local - * 802.11 regulatory domain. - * @hide - */ - public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels"; /** * Determines whether remote devices may discover and/or connect to @@ -2701,11 +2695,11 @@ public final class Settings { "wifi_networks_available_repeat_delay"; /** - * The number of radio channels that are allowed in the local - * 802.11 regulatory domain. + * 802.11 country code in ISO 3166 format * @hide */ - public static final String WIFI_NUM_ALLOWED_CHANNELS = "wifi_num_allowed_channels"; + public static final String WIFI_COUNTRY_CODE = "wifi_country_code"; + /** * When the number of open networks exceeds this number, the @@ -3638,7 +3632,7 @@ public final class Settings { TTS_ENABLED_PLUGINS, WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, - WIFI_NUM_ALLOWED_CHANNELS, + WIFI_COUNTRY_CODE, WIFI_NUM_OPEN_NETWORKS_KEPT, MOUNT_PLAY_NOTIFICATION_SND, MOUNT_UMS_AUTOSTART, diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp index a024420..0663e98 100644 --- a/core/jni/android_net_wifi_Wifi.cpp +++ b/core/jni/android_net_wifi_Wifi.cpp @@ -198,11 +198,25 @@ static jint android_net_wifi_wpsPinFromDeviceCommand(JNIEnv* env, jobject clazz, env->ReleaseStringUTFChars(bssid, bssidStr); if ((numWritten == -1) || (numWritten >= (int)sizeof(cmdstr))) { - return false; + return -1; } return doIntCommand(cmdstr); } +static jboolean android_net_wifi_setCountryCodeCommand(JNIEnv* env, jobject clazz, jstring country) +{ + char cmdstr[BUF_SIZE]; + jboolean isCopy; + + const char *countryStr = env->GetStringUTFChars(country, &isCopy); + int numWritten = snprintf(cmdstr, sizeof(cmdstr), "DRIVER COUNTRY %s", countryStr); + env->ReleaseStringUTFChars(country, countryStr); + + if ((numWritten == -1) || (numWritten >= (int)sizeof(cmdstr))) { + return false; + } + return doBooleanCommand(cmdstr, "OK"); +} static jboolean android_net_wifi_setNetworkVariableCommand(JNIEnv* env, jobject clazz, @@ -484,32 +498,6 @@ static jint android_net_wifi_getBandCommand(JNIEnv* env, jobject clazz) return (jint)band; } -static jboolean android_net_wifi_setNumAllowedChannelsCommand(JNIEnv* env, jobject clazz, jint numChannels) -{ - char cmdstr[BUF_SIZE]; - - int numWritten = snprintf(cmdstr, sizeof(cmdstr), "DRIVER SCAN-CHANNELS %u", numChannels); - int cmdTooLong = numWritten >= (int)sizeof(cmdstr); - - return (jboolean)!cmdTooLong && doBooleanCommand(cmdstr, "OK"); -} - -static jint android_net_wifi_getNumAllowedChannelsCommand(JNIEnv* env, jobject clazz) -{ - char reply[BUF_SIZE]; - int numChannels; - - if (doCommand("DRIVER SCAN-CHANNELS", reply, sizeof(reply)) != 0) { - return -1; - } - // reply comes back in the form "Scan-Channels = X" where X is the - // number of channels - if (sscanf(reply, "%*s = %u", &numChannels) == 1) - return numChannels; - else - return -1; -} - static jboolean android_net_wifi_setBluetoothCoexistenceModeCommand(JNIEnv* env, jobject clazz, jint mode) { char cmdstr[BUF_SIZE]; @@ -645,8 +633,6 @@ static JNINativeMethod gWifiMethods[] = { { "getPowerModeCommand", "()I", (void*) android_net_wifi_getPowerModeCommand }, { "setBandCommand", "(I)Z", (void*) android_net_wifi_setBandCommand}, { "getBandCommand", "()I", (void*) android_net_wifi_getBandCommand}, - { "setNumAllowedChannelsCommand", "(I)Z", (void*) android_net_wifi_setNumAllowedChannelsCommand }, - { "getNumAllowedChannelsCommand", "()I", (void*) android_net_wifi_getNumAllowedChannelsCommand }, { "setBluetoothCoexistenceModeCommand", "(I)Z", (void*) android_net_wifi_setBluetoothCoexistenceModeCommand }, { "setBluetoothCoexistenceScanModeCommand", "(Z)Z", @@ -668,6 +654,8 @@ static JNINativeMethod gWifiMethods[] = { (void*) android_net_wifi_wpsPinFromDeviceCommand }, { "setSuspendOptimizationsCommand", "(Z)Z", (void*) android_net_wifi_setSuspendOptimizationsCommand}, + { "setCountryCodeCommand", "(Ljava/lang/String;)Z", + (void*) android_net_wifi_setCountryCodeCommand}, { "doDhcpRequest", "(Landroid/net/DhcpInfo;)Z", (void*) android_net_wifi_doDhcpRequest }, { "getDhcpError", "()Ljava/lang/String;", (void*) android_net_wifi_getDhcpError }, }; diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 541835f..c89789e 100755 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -2345,10 +2345,9 @@ <!-- This string appears (on two lines) when you type a number into contacts search, to let you create a contact whose phone number is the number you typed. The first line will be in bigger type than the second. --> <string name="create_contact_using">Create contact\nusing <xliff:g id="number" example="555">%s</xliff:g></string> - <!-- This string array should be overridden by the manufacture to present a list of carrier-id,locale,wifi-channel sets. This is used at startup to set system defaults by checking the system property ro.carrier for the carrier-id and searching through this array --> + <!-- This string array should be overridden by the manufacture to present a list of carrier-id,locale. The wifi regulatory domain is extracted from the locale information. This is used at startup to set system defaults by checking the system property ro.carrier for the carrier-id and searching through this array --> <!-- An Array of [[Carrier-ID] --> - <!-- [default-locale] --> - <!-- [default-wifi-allowed-channels]] --> + <!-- [default-locale]] --> <string-array translatable="false" name="carrier_properties"> </string-array> |
