diff options
author | xinhe <xinhe@google.com> | 2015-01-07 17:41:51 -0800 |
---|---|---|
committer | xinhe <xinhe@google.com> | 2015-01-16 10:50:56 -0800 |
commit | 82ff3d5c568b698995c3360595065cff10eaf384 (patch) | |
tree | 7136f2e804b8d51151d6f24cb798c977944fe0db /src/com/android | |
parent | c3068f078887f3357b498a0851591c324d3c55d5 (diff) | |
download | packages_apps_Settings-82ff3d5c568b698995c3360595065cff10eaf384.tar.gz packages_apps_Settings-82ff3d5c568b698995c3360595065cff10eaf384.tar.bz2 packages_apps_Settings-82ff3d5c568b698995c3360595065cff10eaf384.zip |
set softAP on a specified band, including both 2.4 and 5 GHz band
Bug:18929692
Change-Id: I455e9b17e5091596beb0246ccfd981c5d2b932f0
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/settings/wifi/WifiApDialog.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/com/android/settings/wifi/WifiApDialog.java b/src/com/android/settings/wifi/WifiApDialog.java index fb8026a9f..352ae143f 100644 --- a/src/com/android/settings/wifi/WifiApDialog.java +++ b/src/com/android/settings/wifi/WifiApDialog.java @@ -32,9 +32,13 @@ import android.widget.CheckBox; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; +import android.widget.RadioGroup; +import android.widget.RadioButton; import com.android.settings.R; +import android.util.Log; + /** * Dialog to configure the SSID and security settings * for Access Point operation @@ -53,8 +57,12 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, private TextView mSsid; private int mSecurityTypeIndex = OPEN_INDEX; private EditText mPassword; + private RadioGroup mChannel; + private RadioButton mChannel2G; + private RadioButton mChannel5G; WifiConfiguration mWifiConfig; + private static final String TAG = "WifiApDialog"; public WifiApDialog(Context context, DialogInterface.OnClickListener listener, WifiConfiguration wifiConfig) { @@ -85,6 +93,16 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, */ config.SSID = mSsid.getText().toString(); + //obtain the band configure + if (mChannel2G.isChecked()) { + config.apBand = 0; + } else if(mChannel5G.isChecked()) { + config.apBand = 1; + } else { + Log.e("TAG", "AP band configure error!"); + return null; + } + switch (mSecurityTypeIndex) { case OPEN_INDEX: config.allowedKeyManagement.set(KeyMgmt.NONE); @@ -118,15 +136,25 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, mSsid = (TextView) mView.findViewById(R.id.ssid); mPassword = (EditText) mView.findViewById(R.id.password); + mChannel = (RadioGroup) mView.findViewById(R.id.choose_channel); + mChannel2G = (RadioButton) mView.findViewById(R.id.ap_2G_band); + mChannel5G = (RadioButton) mView.findViewById(R.id.ap_5G_band); + setButton(BUTTON_SUBMIT, context.getString(R.string.wifi_save), mListener); setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(R.string.wifi_cancel), mListener); if (mWifiConfig != null) { mSsid.setText(mWifiConfig.SSID); + if (mWifiConfig.apBand == 0) { + mChannel2G.setChecked(true); + } else { + mChannel5G.setChecked(true); + } + mSecurity.setSelection(mSecurityTypeIndex); if (mSecurityTypeIndex == WPA2_INDEX) { - mPassword.setText(mWifiConfig.preSharedKey); + mPassword.setText(mWifiConfig.preSharedKey); } } |