diff options
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/SupplicantStaIfaceHal.java | 4 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiCountryCode.java | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java index 5bf44ce66..2c9b5e5ec 100644 --- a/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java +++ b/service/java/com/android/server/wifi/SupplicantStaIfaceHal.java @@ -1853,7 +1853,9 @@ public class SupplicantStaIfaceHal { public boolean setCountryCode(@NonNull String ifaceName, String codeStr) { synchronized (mLock) { if (TextUtils.isEmpty(codeStr)) return false; - return setCountryCode(ifaceName, NativeUtil.stringToByteArray(codeStr)); + byte[] countryCodeBytes = NativeUtil.stringToByteArray(codeStr); + if (countryCodeBytes.length != 2) return false; + return setCountryCode(ifaceName, countryCodeBytes); } } diff --git a/service/java/com/android/server/wifi/WifiCountryCode.java b/service/java/com/android/server/wifi/WifiCountryCode.java index 04bd38bda..41a366dbf 100644 --- a/service/java/com/android/server/wifi/WifiCountryCode.java +++ b/service/java/com/android/server/wifi/WifiCountryCode.java @@ -21,6 +21,7 @@ import android.util.Log; import java.io.FileDescriptor; import java.io.PrintWriter; +import java.util.Locale; /** * Provide functions for making changes to WiFi country code. @@ -51,7 +52,7 @@ public class WifiCountryCode { mRevertCountryCodeOnCellularLoss = revertCountryCodeOnCellularLoss; if (!TextUtils.isEmpty(oemDefaultCountryCode)) { - mDefaultCountryCode = oemDefaultCountryCode.toUpperCase(); + mDefaultCountryCode = oemDefaultCountryCode.toUpperCase(Locale.US); } else { if (mRevertCountryCodeOnCellularLoss) { Log.w(TAG, "config_wifi_revert_country_code_on_cellular_loss is set, " @@ -122,7 +123,7 @@ public class WifiCountryCode { mTelephonyCountryCode = null; } } else { - mTelephonyCountryCode = countryCode.toUpperCase(); + mTelephonyCountryCode = countryCode.toUpperCase(Locale.US); } // If wpa_supplicant is ready we set the country code now, otherwise it will be // set once wpa_supplicant is ready. |