wifi: support SAE password identifier in wifi dialog

Bug: 138305265
Test: atest FrameworksWifiApiTests
Test: atest FrameworksWifiTests
Test: connect to a WPA3 SAE access point with different
      password/identifer combinations.

Change-Id: Idf1f82faaafa9c5f2212a0fa1dcc2eec53a9dbd5
This commit is contained in:
Jimmy Chen
2019-07-24 18:10:59 +08:00
parent a520e36d35
commit d79363fec6
3 changed files with 49 additions and 0 deletions

View File

@@ -131,6 +131,7 @@ public class WifiConfigController implements TextWatcher,
@VisibleForTesting
int mAccessPointSecurity;
private TextView mPasswordView;
private TextView mSaePasswordIdView;
private ImageButton mSsidScanButton;
private String mUnspecifiedCertString;
@@ -786,6 +787,11 @@ public class WifiConfigController implements TextWatcher,
String password = mPasswordView.getText().toString();
config.preSharedKey = '"' + password + '"';
}
if (mSaePasswordIdView.length() != 0) {
config.saePasswordId = mSaePasswordIdView.getText().toString();
} else {
config.saePasswordId = null;
}
break;
case AccessPoint.SECURITY_OWE:
@@ -968,6 +974,23 @@ public class WifiConfigController implements TextWatcher,
}
}
if (mSaePasswordIdView == null) {
mSaePasswordIdView = (TextView) mView.findViewById(R.id.sae_password_id);
mSaePasswordIdView.setOnEditorActionListener(this);
mSaePasswordIdView.setOnKeyListener(this);
}
if (mAccessPointSecurity == AccessPoint.SECURITY_SAE) {
mView.findViewById(R.id.sae_password_id_layout).setVisibility(View.VISIBLE);
if (mAccessPoint != null && mAccessPoint.isSaved()) {
if (!TextUtils.isEmpty(mAccessPoint.getConfig().saePasswordId)) {
mSaePasswordIdView.setText(mAccessPoint.getConfig().saePasswordId);
}
}
} else {
setSaePasswordIdInvisible();
}
if (mAccessPointSecurity != AccessPoint.SECURITY_EAP &&
mAccessPointSecurity != AccessPoint.SECURITY_EAP_SUITE_B) {
mView.findViewById(R.id.eap).setVisibility(View.GONE);
@@ -1249,6 +1272,11 @@ public class WifiConfigController implements TextWatcher,
mView.findViewById(R.id.show_password_layout).setVisibility(View.GONE);
}
private void setSaePasswordIdInvisible() {
mSaePasswordIdView.setText("");
mView.findViewById(R.id.sae_password_id_layout).setVisibility(View.GONE);
}
private void setEapMethodInvisible() {
mView.findViewById(R.id.eap).setVisibility(View.GONE);
}