[Wi-Fi] Check if domain field is not empty when users choose a ca certificate
Domain is required for client to validate server's certificate. This change disable Save button for a new Wi-Fi network of a specified CA certificate but empty domain. Bug: 161378819 Test: make RunSettingsRoboTests ROBOTEST_FILTER=WifiConfigControllerTest make RunSettingsRoboTests ROBOTEST_FILTER=WifiConfigController2Test manual 1. Install a certificate. 2. Add a new Wi-Fi network of EAP method PEAP 3. Set CA certificate to the certificate installed at 1. 4. Save button should be disabled. 5. Input something in domain field. 6. Save button should be enabled. Change-Id: I65c8b29ec7a03b21403ddbfc087ce48c2a4a69e4
This commit is contained in:
@@ -511,12 +511,11 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
// Disallow submit if the user has not selected a CA certificate for an EAP network
|
||||
// configuration.
|
||||
enabled = false;
|
||||
}
|
||||
if (caCertSelection.equals(mUseSystemCertsString)
|
||||
} else if (!caCertSelection.equals(mDoNotValidateEapServerString)
|
||||
&& mEapDomainView != null
|
||||
&& mView.findViewById(R.id.l_domain).getVisibility() != View.GONE
|
||||
&& TextUtils.isEmpty(mEapDomainView.getText().toString())) {
|
||||
// Disallow submit if the user chooses to use system certificates for EAP server
|
||||
// Disallow submit if the user chooses to use a certificate for EAP server
|
||||
// validation, but does not provide a domain.
|
||||
enabled = false;
|
||||
}
|
||||
@@ -552,14 +551,12 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
// Display warning if user chooses not to validate the EAP server with a
|
||||
// user-supplied CA certificate in an EAP network configuration.
|
||||
mView.findViewById(R.id.no_ca_cert_warning).setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (caCertSelection.equals(mUseSystemCertsString)
|
||||
} else if (!caCertSelection.equals(mUnspecifiedCertString)
|
||||
&& mEapDomainView != null
|
||||
&& mView.findViewById(R.id.l_domain).getVisibility() != View.GONE
|
||||
&& TextUtils.isEmpty(mEapDomainView.getText().toString())) {
|
||||
// Display warning if user chooses to use pre-installed public CA certificates
|
||||
// without restricting the server domain that these certificates can be used to
|
||||
// validate.
|
||||
// Display warning if user chooses to use a certificate without restricting the
|
||||
// server domain that these certificates can be used to validate.
|
||||
mView.findViewById(R.id.no_domain_warning).setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
@@ -1666,7 +1663,8 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
mContext.getResources().getStringArray(contentStringArrayResId));
|
||||
}
|
||||
|
||||
private ArrayAdapter<CharSequence> getSpinnerAdapter(
|
||||
@VisibleForTesting
|
||||
ArrayAdapter<CharSequence> getSpinnerAdapter(
|
||||
String[] contentStringArray) {
|
||||
ArrayAdapter<CharSequence> spinnerAdapter = new ArrayAdapter<>(mContext,
|
||||
android.R.layout.simple_spinner_item, contentStringArray);
|
||||
|
Reference in New Issue
Block a user