summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorxinhe <xinhe@google.com>2015-02-23 17:10:08 -0800
committerxinhe <xinhe@google.com>2015-02-24 10:09:56 -0800
commitd51b9525c913b4a34a8ea1f2cf18b0f8555da51a (patch)
tree540a64b854eaec1a2eca7fec2297ac347ef3da2f /src
parent82ff3d5c568b698995c3360595065cff10eaf384 (diff)
downloadpackages_apps_Settings-d51b9525c913b4a34a8ea1f2cf18b0f8555da51a.zip
packages_apps_Settings-d51b9525c913b4a34a8ea1f2cf18b0f8555da51a.tar.gz
packages_apps_Settings-d51b9525c913b4a34a8ea1f2cf18b0f8555da51a.tar.bz2
Do not provide 5GHz option for softap if there is no country code available
Bug:19414134 Change-Id: I3899d9daa33eca5d2c5528c2e4da97b02d019160
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/wifi/WifiApDialog.java15
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 352ae14..eee3db9 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);