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:
@@ -72,7 +72,13 @@ class WifiApDialog extends AlertDialog implements View.OnClickListener,
|
||||
|
||||
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) {
|
||||
case AccessPoint.SECURITY_NONE:
|
||||
@@ -115,7 +121,7 @@ class WifiApDialog extends AlertDialog implements View.OnClickListener,
|
||||
context.getString(R.string.wifi_cancel), mListener);
|
||||
|
||||
if (mWifiConfig != null) {
|
||||
mSsid.setText(AccessPoint.removeDoubleQuotes(mWifiConfig.SSID));
|
||||
mSsid.setText(mWifiConfig.SSID);
|
||||
switch (mSecurityType) {
|
||||
case AccessPoint.SECURITY_NONE:
|
||||
mSecurity.setSelection(OPEN_INDEX);
|
||||
|
@@ -153,8 +153,7 @@ public class WifiApEnabler implements Preference.OnPreferenceChangeListener {
|
||||
com.android.internal.R.string.wifi_tether_configure_ssid_default);
|
||||
mCheckBox.setSummary(String.format(
|
||||
mContext.getString(R.string.wifi_tether_enabled_subtext),
|
||||
(wifiConfig == null) ? s : AccessPoint.removeDoubleQuotes(
|
||||
wifiConfig.SSID)));
|
||||
(wifiConfig == null) ? s : wifiConfig.SSID));
|
||||
}
|
||||
|
||||
private void updateTetherState(Object[] available, Object[] tethered, Object[] errored) {
|
||||
|
@@ -81,7 +81,7 @@ public class WifiApSettings extends PreferenceActivity
|
||||
s, mSecurityType[OPEN_INDEX]));
|
||||
} else {
|
||||
mCreateNetwork.setSummary(String.format(getString(CONFIG_SUBTEXT),
|
||||
AccessPoint.removeDoubleQuotes(mWifiConfig.SSID),
|
||||
mWifiConfig.SSID,
|
||||
mWifiConfig.allowedKeyManagement.get(KeyMgmt.WPA_PSK) ?
|
||||
mSecurityType[WPA_INDEX] : mSecurityType[OPEN_INDEX]));
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class WifiApSettings extends PreferenceActivity
|
||||
if(mWifiConfig != null) {
|
||||
mWifiManager.setWifiApEnabled(mWifiConfig, true);
|
||||
mCreateNetwork.setSummary(String.format(getString(CONFIG_SUBTEXT),
|
||||
AccessPoint.removeDoubleQuotes(mWifiConfig.SSID),
|
||||
mWifiConfig.SSID,
|
||||
mWifiConfig.allowedKeyManagement.get(KeyMgmt.WPA_PSK) ?
|
||||
mSecurityType[WPA_INDEX] : mSecurityType[OPEN_INDEX]));
|
||||
/**
|
||||
|
Reference in New Issue
Block a user