diff options
author | Vinit Deshpande <vinitd@google.com> | 2015-03-06 13:56:02 -0800 |
---|---|---|
committer | Vinit Deshpande <vinitd@google.com> | 2015-03-06 13:56:02 -0800 |
commit | 128e25cec0a45b8b3620cf47d55527ee591b0f6e (patch) | |
tree | 1435571f720057d1e3a25b2366b1f83f15350996 /src/com/android | |
parent | 2797429bd85c3578eccace7394d7c6f7e34ad9fb (diff) | |
parent | d51b9525c913b4a34a8ea1f2cf18b0f8555da51a (diff) | |
download | packages_apps_Settings-128e25cec0a45b8b3620cf47d55527ee591b0f6e.tar.gz packages_apps_Settings-128e25cec0a45b8b3620cf47d55527ee591b0f6e.tar.bz2 packages_apps_Settings-128e25cec0a45b8b3620cf47d55527ee591b0f6e.zip |
am "Do not provide 5GHz option for softap if there is no country code available"
merged from partner/m-wireless-wifi-dev
d51b952 Do not provide 5GHz option for softap if there is no country code available
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/settings/wifi/WifiApDialog.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/com/android/settings/wifi/WifiApDialog.java b/src/com/android/settings/wifi/WifiApDialog.java index 352ae143f..eee3db970 100644 --- a/src/com/android/settings/wifi/WifiApDialog.java +++ b/src/com/android/settings/wifi/WifiApDialog.java @@ -22,6 +22,7 @@ import android.content.DialogInterface; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiConfiguration.AuthAlgorithm; import android.net.wifi.WifiConfiguration.KeyMgmt; +import android.net.wifi.WifiManager; import android.os.Bundle; import android.text.Editable; import android.text.InputType; @@ -62,6 +63,8 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, private RadioButton mChannel5G; WifiConfiguration mWifiConfig; + WifiManager mWifiManager; + private static final String TAG = "WifiApDialog"; public WifiApDialog(Context context, DialogInterface.OnClickListener listener, @@ -72,6 +75,7 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, if (wifiConfig != null) { mSecurityTypeIndex = getSecurityTypeIndex(wifiConfig); } + mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); } public static int getSecurityTypeIndex(WifiConfiguration wifiConfig) { @@ -140,6 +144,17 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, mChannel2G = (RadioButton) mView.findViewById(R.id.ap_2G_band); mChannel5G = (RadioButton) mView.findViewById(R.id.ap_5G_band); + String countryCode = mWifiManager.getCountryCode(); + if (!mWifiManager.is5GHzBandSupported() || countryCode == null) { + //If no country code, 5GHz AP is forbidden + Log.e(TAG," NO country code, forbid 5GHz"); + mChannel5G.setVisibility(View.INVISIBLE); + mWifiConfig.apBand = 0; + } else { + mChannel5G.setVisibility(View.VISIBLE); + } + + setButton(BUTTON_SUBMIT, context.getString(R.string.wifi_save), mListener); setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(R.string.wifi_cancel), mListener); |