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 | 2797429bd85c3578eccace7394d7c6f7e34ad9fb (patch) | |
tree | cf716d5ff9f52568df310eb8ef02fda2c3acf632 | |
parent | 9a4b136ffb6012d8bd9926c7106b258d940e6abf (diff) | |
parent | 82ff3d5c568b698995c3360595065cff10eaf384 (diff) | |
download | packages_apps_Settings-2797429bd85c3578eccace7394d7c6f7e34ad9fb.zip packages_apps_Settings-2797429bd85c3578eccace7394d7c6f7e34ad9fb.tar.gz packages_apps_Settings-2797429bd85c3578eccace7394d7c6f7e34ad9fb.tar.bz2 |
am "set softAP on a specified band, including both 2.4 and 5 GHz band"
merged from partner/m-wireless-wifi-dev
82ff3d5 set softAP on a specified band, including both 2.4 and 5 GHz band
-rw-r--r-- | res/layout/wifi_ap_dialog.xml | 25 | ||||
-rw-r--r-- | res/values/strings.xml | 6 | ||||
-rw-r--r-- | src/com/android/settings/wifi/WifiApDialog.java | 30 |
3 files changed, 60 insertions, 1 deletions
diff --git a/res/layout/wifi_ap_dialog.xml b/res/layout/wifi_ap_dialog.xml index 30043c4..7a038cb 100644 --- a/res/layout/wifi_ap_dialog.xml +++ b/res/layout/wifi_ap_dialog.xml @@ -66,6 +66,31 @@ style="@style/wifi_item_content" android:prompt="@string/wifi_security" android:entries="@array/wifi_ap_security" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + style="@style/wifi_item_label" + android:layout_marginTop="8dip" + android:text="@string/wifi_ap_band_config" /> + + <RadioGroup android:id = "@+id/choose_channel" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <RadioButton android:id="@+id/ap_2G_band" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_ap_choose_2G" + android:layout_marginTop="8dip"/> + + <RadioButton android:id="@+id/ap_5G_band" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/wifi_ap_choose_5G" + android:layout_marginTop="8dip"/> + </RadioGroup> </LinearLayout> <LinearLayout android:id="@+id/fields" diff --git a/res/values/strings.xml b/res/values/strings.xml index 8e29e5d..c956e7b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1582,6 +1582,12 @@ <string name="wifi_password">Password</string> <!-- Label for the check box to show password --> <string name="wifi_show_password">Show password</string> + <!-- Label for the RadioGroup to choose wifi ap band --> + <string name="wifi_ap_band_config">Config AP Band</string> + <!-- Label for the radio button to choose wifi ap 2.4 GHz band --> + <string name="wifi_ap_choose_2G">2.4 GHz Band</string> + <!-- Label for the radio button to choose wifi ap 5GHz band --> + <string name="wifi_ap_choose_5G">5 GHz Band</string> <!-- Label for the spinner to show ip settings [CHAR LIMIT=25] --> <string name="wifi_ip_settings">IP settings</string> <!-- Hint for unchanged fields --> diff --git a/src/com/android/settings/wifi/WifiApDialog.java b/src/com/android/settings/wifi/WifiApDialog.java index fb8026a..352ae14 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); } } |