Fix crash for tether with quotes in SSID

Multiple quotes cause havoc with netd interaction right now.
The solution is to revert the changes for WifiConfiguration on
Access Point side done in Change I0f1e508b and remove all quotes
in the SSID.

Essentially a low risk one line change on top of the revert.

We dont expose API for WifiConfiguration on AP side. This solution
essentially means we treat SSID in WifiConfiguration on AP side
differently. When we do expose things, we should make things consistent.

Change-Id: I0a7e5074b83ace743fc843ee61c1ff86cde8267f
This commit is contained in:
Irfan Sheriff
2010-05-17 12:46:03 -07:00
parent 8c81257f70
commit 18dc7ea709
3 changed files with 11 additions and 6 deletions

View File

@@ -72,7 +72,13 @@ class WifiApDialog extends AlertDialog implements View.OnClickListener,
WifiConfiguration config = new WifiConfiguration(); WifiConfiguration config = new WifiConfiguration();
config.SSID = AccessPoint.convertToQuotedString(mSsid.getText().toString()); /**
* TODO: SSID in WifiConfiguration for soft ap
* is being stored as a raw string without quotes.
* This is not the case on the client side. We need to
* make things consistent and clean it up
*/
config.SSID = mSsid.getText().toString().replaceAll("\"","");
switch (mSecurityType) { switch (mSecurityType) {
case AccessPoint.SECURITY_NONE: case AccessPoint.SECURITY_NONE:
@@ -115,7 +121,7 @@ class WifiApDialog extends AlertDialog implements View.OnClickListener,
context.getString(R.string.wifi_cancel), mListener); context.getString(R.string.wifi_cancel), mListener);
if (mWifiConfig != null) { if (mWifiConfig != null) {
mSsid.setText(AccessPoint.removeDoubleQuotes(mWifiConfig.SSID)); mSsid.setText(mWifiConfig.SSID);
switch (mSecurityType) { switch (mSecurityType) {
case AccessPoint.SECURITY_NONE: case AccessPoint.SECURITY_NONE:
mSecurity.setSelection(OPEN_INDEX); mSecurity.setSelection(OPEN_INDEX);

View File

@@ -153,8 +153,7 @@ public class WifiApEnabler implements Preference.OnPreferenceChangeListener {
com.android.internal.R.string.wifi_tether_configure_ssid_default); com.android.internal.R.string.wifi_tether_configure_ssid_default);
mCheckBox.setSummary(String.format( mCheckBox.setSummary(String.format(
mContext.getString(R.string.wifi_tether_enabled_subtext), mContext.getString(R.string.wifi_tether_enabled_subtext),
(wifiConfig == null) ? s : AccessPoint.removeDoubleQuotes( (wifiConfig == null) ? s : wifiConfig.SSID));
wifiConfig.SSID)));
} }
private void updateTetherState(Object[] available, Object[] tethered, Object[] errored) { private void updateTetherState(Object[] available, Object[] tethered, Object[] errored) {

View File

@@ -81,7 +81,7 @@ public class WifiApSettings extends PreferenceActivity
s, mSecurityType[OPEN_INDEX])); s, mSecurityType[OPEN_INDEX]));
} else { } else {
mCreateNetwork.setSummary(String.format(getString(CONFIG_SUBTEXT), mCreateNetwork.setSummary(String.format(getString(CONFIG_SUBTEXT),
AccessPoint.removeDoubleQuotes(mWifiConfig.SSID), mWifiConfig.SSID,
mWifiConfig.allowedKeyManagement.get(KeyMgmt.WPA_PSK) ? mWifiConfig.allowedKeyManagement.get(KeyMgmt.WPA_PSK) ?
mSecurityType[WPA_INDEX] : mSecurityType[OPEN_INDEX])); mSecurityType[WPA_INDEX] : mSecurityType[OPEN_INDEX]));
} }
@@ -123,7 +123,7 @@ public class WifiApSettings extends PreferenceActivity
if(mWifiConfig != null) { if(mWifiConfig != null) {
mWifiManager.setWifiApEnabled(mWifiConfig, true); mWifiManager.setWifiApEnabled(mWifiConfig, true);
mCreateNetwork.setSummary(String.format(getString(CONFIG_SUBTEXT), mCreateNetwork.setSummary(String.format(getString(CONFIG_SUBTEXT),
AccessPoint.removeDoubleQuotes(mWifiConfig.SSID), mWifiConfig.SSID,
mWifiConfig.allowedKeyManagement.get(KeyMgmt.WPA_PSK) ? mWifiConfig.allowedKeyManagement.get(KeyMgmt.WPA_PSK) ?
mSecurityType[WPA_INDEX] : mSecurityType[OPEN_INDEX])); mSecurityType[WPA_INDEX] : mSecurityType[OPEN_INDEX]));
/** /**