Merge "[Wi-Fi] Remove 'Do not validate' option in CA certificate spinner"
This commit is contained in:
@@ -214,18 +214,6 @@
|
||||
android:entries="@array/eap_ocsp_type" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/no_ca_cert_warning"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
style="@style/wifi_item" >
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/wifi_item_warning"
|
||||
android:text="@string/wifi_do_not_validate_eap_server_warning" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout android:id="@+id/l_domain"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@@ -2141,8 +2141,6 @@
|
||||
<string name="wifi_do_not_provide_eap_user_cert">Do not provide</string>
|
||||
<!-- Menu option for not validating the EAP server -->
|
||||
<string name="wifi_do_not_validate_eap_server">Do not validate</string>
|
||||
<!-- Warning message displayed if user choses not to validate the EAP server -->
|
||||
<string name="wifi_do_not_validate_eap_server_warning">No certificate specified. Your connection will not be private.</string>
|
||||
<!-- Warning message displayed if network name (ssid) is too long -->
|
||||
<string name="wifi_ssid_too_long">Network name is too long.</string>
|
||||
<!-- Warning message displayed if user does not specify a domain for the CA certificate.
|
||||
|
@@ -160,7 +160,6 @@ public class WifiConfigController implements TextWatcher,
|
||||
private String mMultipleCertSetString;
|
||||
private String mUseSystemCertsString;
|
||||
private String mDoNotProvideEapUserCertString;
|
||||
private String mDoNotValidateEapServerString;
|
||||
|
||||
private ScrollView mDialogContainer;
|
||||
private Spinner mSecuritySpinner;
|
||||
@@ -265,8 +264,6 @@ public class WifiConfigController implements TextWatcher,
|
||||
mUseSystemCertsString = mContext.getString(R.string.wifi_use_system_certs);
|
||||
mDoNotProvideEapUserCertString =
|
||||
mContext.getString(R.string.wifi_do_not_provide_eap_user_cert);
|
||||
mDoNotValidateEapServerString =
|
||||
mContext.getString(R.string.wifi_do_not_validate_eap_server);
|
||||
|
||||
mSsidScanButton = (ImageButton) mView.findViewById(R.id.ssid_scanner_button);
|
||||
mDialogContainer = mView.findViewById(R.id.dialog_scrollview);
|
||||
@@ -549,8 +546,7 @@ public class WifiConfigController implements TextWatcher,
|
||||
// Disallow submit if the user has not selected a CA certificate for an EAP network
|
||||
// configuration.
|
||||
enabled = false;
|
||||
} else if (!caCertSelection.equals(mDoNotValidateEapServerString)
|
||||
&& mEapDomainView != null
|
||||
} else if (mEapDomainView != null
|
||||
&& mView.findViewById(R.id.l_domain).getVisibility() != View.GONE
|
||||
&& TextUtils.isEmpty(mEapDomainView.getText().toString())) {
|
||||
// Disallow submit if the user chooses to use a certificate for EAP server
|
||||
@@ -571,7 +567,6 @@ public class WifiConfigController implements TextWatcher,
|
||||
}
|
||||
|
||||
void showWarningMessagesIfAppropriate() {
|
||||
mView.findViewById(R.id.no_ca_cert_warning).setVisibility(View.GONE);
|
||||
mView.findViewById(R.id.no_user_cert_warning).setVisibility(View.GONE);
|
||||
mView.findViewById(R.id.no_domain_warning).setVisibility(View.GONE);
|
||||
mView.findViewById(R.id.ssid_too_long_warning).setVisibility(View.GONE);
|
||||
@@ -584,13 +579,7 @@ public class WifiConfigController implements TextWatcher,
|
||||
}
|
||||
if (mEapCaCertSpinner != null
|
||||
&& mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) {
|
||||
String caCertSelection = (String) mEapCaCertSpinner.getSelectedItem();
|
||||
if (caCertSelection.equals(mDoNotValidateEapServerString)) {
|
||||
// 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);
|
||||
} else if (!caCertSelection.equals(mUnspecifiedCertString)
|
||||
&& mEapDomainView != null
|
||||
if (mEapDomainView != null
|
||||
&& mView.findViewById(R.id.l_domain).getVisibility() != View.GONE
|
||||
&& TextUtils.isEmpty(mEapDomainView.getText().toString())) {
|
||||
// Display warning if user chooses to use a certificate without restricting the
|
||||
@@ -728,8 +717,7 @@ public class WifiConfigController implements TextWatcher,
|
||||
config.enterpriseConfig.setCaCertificateAliases(null);
|
||||
config.enterpriseConfig.setCaPath(null);
|
||||
config.enterpriseConfig.setDomainSuffixMatch(mEapDomainView.getText().toString());
|
||||
if (caCert.equals(mUnspecifiedCertString)
|
||||
|| caCert.equals(mDoNotValidateEapServerString)) {
|
||||
if (caCert.equals(mUnspecifiedCertString)) {
|
||||
// ca_cert already set to null, so do nothing.
|
||||
} else if (caCert.equals(mUseSystemCertsString)) {
|
||||
config.enterpriseConfig.setCaPath(SYSTEM_CA_STORE_PATH);
|
||||
@@ -763,8 +751,7 @@ public class WifiConfigController implements TextWatcher,
|
||||
}
|
||||
|
||||
// Only set OCSP option if there is a valid CA certificate.
|
||||
if (caCert.equals(mUnspecifiedCertString)
|
||||
|| caCert.equals(mDoNotValidateEapServerString)) {
|
||||
if (caCert.equals(mUnspecifiedCertString)) {
|
||||
config.enterpriseConfig.setOcsp(WifiEnterpriseConfig.OCSP_NONE);
|
||||
} else {
|
||||
config.enterpriseConfig.setOcsp(mEapOcspSpinner.getSelectedItemPosition());
|
||||
@@ -1039,15 +1026,15 @@ public class WifiConfigController implements TextWatcher,
|
||||
loadCertificates(
|
||||
mEapCaCertSpinner,
|
||||
Credentials.CA_CERTIFICATE,
|
||||
mDoNotValidateEapServerString,
|
||||
false,
|
||||
true);
|
||||
null /* noCertificateString */,
|
||||
false /* showMultipleCerts */,
|
||||
true /* showUsePreinstalledCertOption */);
|
||||
loadCertificates(
|
||||
mEapUserCertSpinner,
|
||||
Credentials.USER_PRIVATE_KEY,
|
||||
mDoNotProvideEapUserCertString,
|
||||
false,
|
||||
false);
|
||||
false /* showMultipleCerts */,
|
||||
false /* showUsePreinstalledCertOption */);
|
||||
// To avoid the user connects to a non-secure network unexpectedly,
|
||||
// request using system trusted certificates by default
|
||||
// unless the user explicitly chooses "Do not validate" or other
|
||||
@@ -1112,7 +1099,7 @@ public class WifiConfigController implements TextWatcher,
|
||||
} else {
|
||||
String[] caCerts = enterpriseConfig.getCaCertificateAliases();
|
||||
if (caCerts == null) {
|
||||
setSelection(mEapCaCertSpinner, mDoNotValidateEapServerString);
|
||||
setSelection(mEapCaCertSpinner, mUnspecifiedCertString);
|
||||
} else if (caCerts.length == 1) {
|
||||
setSelection(mEapCaCertSpinner, caCerts[0]);
|
||||
} else {
|
||||
@@ -1120,9 +1107,9 @@ public class WifiConfigController implements TextWatcher,
|
||||
loadCertificates(
|
||||
mEapCaCertSpinner,
|
||||
Credentials.CA_CERTIFICATE,
|
||||
mDoNotValidateEapServerString,
|
||||
true,
|
||||
true);
|
||||
null /* noCertificateString */,
|
||||
true /* showMultipleCerts */,
|
||||
true /* showUsePreinstalledCertOption */);
|
||||
setSelection(mEapCaCertSpinner, mMultipleCertSetString);
|
||||
}
|
||||
}
|
||||
@@ -1249,8 +1236,7 @@ public class WifiConfigController implements TextWatcher,
|
||||
|
||||
if (mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) {
|
||||
String eapCertSelection = (String) mEapCaCertSpinner.getSelectedItem();
|
||||
if (eapCertSelection.equals(mDoNotValidateEapServerString)
|
||||
|| eapCertSelection.equals(mUnspecifiedCertString)) {
|
||||
if (eapCertSelection.equals(mUnspecifiedCertString)) {
|
||||
// Domain suffix matching is not relevant if the user hasn't chosen a CA
|
||||
// certificate yet, or chooses not to validate the EAP server.
|
||||
setDomainInvisible();
|
||||
@@ -1472,7 +1458,8 @@ public class WifiConfigController implements TextWatcher,
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
if (mAccessPointSecurity != AccessPoint.SECURITY_EAP_SUITE_B) {
|
||||
if (!TextUtils.isEmpty(noCertificateString)
|
||||
&& mAccessPointSecurity != AccessPoint.SECURITY_EAP_SUITE_B) {
|
||||
certs.add(noCertificateString);
|
||||
}
|
||||
|
||||
|
@@ -157,7 +157,6 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
private String mMultipleCertSetString;
|
||||
private String mUseSystemCertsString;
|
||||
private String mDoNotProvideEapUserCertString;
|
||||
private String mDoNotValidateEapServerString;
|
||||
|
||||
private ScrollView mDialogContainer;
|
||||
private Spinner mSecuritySpinner;
|
||||
@@ -257,8 +256,6 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
mUseSystemCertsString = mContext.getString(R.string.wifi_use_system_certs);
|
||||
mDoNotProvideEapUserCertString =
|
||||
mContext.getString(R.string.wifi_do_not_provide_eap_user_cert);
|
||||
mDoNotValidateEapServerString =
|
||||
mContext.getString(R.string.wifi_do_not_validate_eap_server);
|
||||
|
||||
mSsidScanButton = (ImageButton) mView.findViewById(R.id.ssid_scanner_button);
|
||||
mDialogContainer = mView.findViewById(R.id.dialog_scrollview);
|
||||
@@ -518,8 +515,7 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
// Disallow submit if the user has not selected a CA certificate for an EAP network
|
||||
// configuration.
|
||||
enabled = false;
|
||||
} else if (!caCertSelection.equals(mDoNotValidateEapServerString)
|
||||
&& mEapDomainView != null
|
||||
} else if (mEapDomainView != null
|
||||
&& mView.findViewById(R.id.l_domain).getVisibility() != View.GONE
|
||||
&& TextUtils.isEmpty(mEapDomainView.getText().toString())) {
|
||||
// Disallow submit if the user chooses to use a certificate for EAP server
|
||||
@@ -540,7 +536,6 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
}
|
||||
|
||||
void showWarningMessagesIfAppropriate() {
|
||||
mView.findViewById(R.id.no_ca_cert_warning).setVisibility(View.GONE);
|
||||
mView.findViewById(R.id.no_user_cert_warning).setVisibility(View.GONE);
|
||||
mView.findViewById(R.id.no_domain_warning).setVisibility(View.GONE);
|
||||
mView.findViewById(R.id.ssid_too_long_warning).setVisibility(View.GONE);
|
||||
@@ -553,13 +548,7 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
}
|
||||
if (mEapCaCertSpinner != null
|
||||
&& mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) {
|
||||
String caCertSelection = (String) mEapCaCertSpinner.getSelectedItem();
|
||||
if (caCertSelection.equals(mDoNotValidateEapServerString)) {
|
||||
// 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);
|
||||
} else if (!caCertSelection.equals(mUnspecifiedCertString)
|
||||
&& mEapDomainView != null
|
||||
if (mEapDomainView != null
|
||||
&& mView.findViewById(R.id.l_domain).getVisibility() != View.GONE
|
||||
&& TextUtils.isEmpty(mEapDomainView.getText().toString())) {
|
||||
// Display warning if user chooses to use a certificate without restricting the
|
||||
@@ -704,8 +693,7 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
config.enterpriseConfig.setCaCertificateAliases(null);
|
||||
config.enterpriseConfig.setCaPath(null);
|
||||
config.enterpriseConfig.setDomainSuffixMatch(mEapDomainView.getText().toString());
|
||||
if (caCert.equals(mUnspecifiedCertString)
|
||||
|| caCert.equals(mDoNotValidateEapServerString)) {
|
||||
if (caCert.equals(mUnspecifiedCertString)) {
|
||||
// ca_cert already set to null, so do nothing.
|
||||
} else if (caCert.equals(mUseSystemCertsString)) {
|
||||
config.enterpriseConfig.setCaPath(SYSTEM_CA_STORE_PATH);
|
||||
@@ -738,8 +726,7 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
}
|
||||
|
||||
// Only set OCSP option if there is a valid CA certificate.
|
||||
if (caCert.equals(mUnspecifiedCertString)
|
||||
|| caCert.equals(mDoNotValidateEapServerString)) {
|
||||
if (caCert.equals(mUnspecifiedCertString)) {
|
||||
config.enterpriseConfig.setOcsp(WifiEnterpriseConfig.OCSP_NONE);
|
||||
} else {
|
||||
config.enterpriseConfig.setOcsp(mEapOcspSpinner.getSelectedItemPosition());
|
||||
@@ -1017,15 +1004,15 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
loadCertificates(
|
||||
mEapCaCertSpinner,
|
||||
Credentials.CA_CERTIFICATE,
|
||||
mDoNotValidateEapServerString,
|
||||
false,
|
||||
true);
|
||||
null /* noCertificateString */,
|
||||
false /* showMultipleCerts */,
|
||||
true /* showUsePreinstalledCertOption */);
|
||||
loadCertificates(
|
||||
mEapUserCertSpinner,
|
||||
Credentials.USER_PRIVATE_KEY,
|
||||
mDoNotProvideEapUserCertString,
|
||||
false,
|
||||
false);
|
||||
false /* showMultipleCerts */,
|
||||
false /* showUsePreinstalledCertOption */);
|
||||
// To avoid the user connects to a non-secure network unexpectedly,
|
||||
// request using system trusted certificates by default
|
||||
// unless the user explicitly chooses "Do not validate" or other
|
||||
@@ -1101,7 +1088,7 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
} else {
|
||||
String[] caCerts = enterpriseConfig.getCaCertificateAliases();
|
||||
if (caCerts == null) {
|
||||
setSelection(mEapCaCertSpinner, mDoNotValidateEapServerString);
|
||||
setSelection(mEapCaCertSpinner, mUnspecifiedCertString);
|
||||
} else if (caCerts.length == 1) {
|
||||
setSelection(mEapCaCertSpinner, caCerts[0]);
|
||||
} else {
|
||||
@@ -1109,9 +1096,9 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
loadCertificates(
|
||||
mEapCaCertSpinner,
|
||||
Credentials.CA_CERTIFICATE,
|
||||
mDoNotValidateEapServerString,
|
||||
true,
|
||||
true);
|
||||
null /* noCertificateString */,
|
||||
true /* showMultipleCerts */,
|
||||
true /* showUsePreinstalledCertOption */);
|
||||
setSelection(mEapCaCertSpinner, mMultipleCertSetString);
|
||||
}
|
||||
}
|
||||
@@ -1242,8 +1229,7 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
|
||||
if (mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) {
|
||||
String eapCertSelection = (String) mEapCaCertSpinner.getSelectedItem();
|
||||
if (eapCertSelection.equals(mDoNotValidateEapServerString)
|
||||
|| eapCertSelection.equals(mUnspecifiedCertString)) {
|
||||
if (eapCertSelection.equals(mUnspecifiedCertString)) {
|
||||
// Domain suffix matching is not relevant if the user hasn't chosen a CA
|
||||
// certificate yet, or chooses not to validate the EAP server.
|
||||
setDomainInvisible();
|
||||
@@ -1505,7 +1491,8 @@ public class WifiConfigController2 implements TextWatcher,
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
if (mWifiEntrySecurity != WifiEntry.SECURITY_EAP_SUITE_B) {
|
||||
if (!TextUtils.isEmpty(noCertificateString)
|
||||
&& mWifiEntrySecurity != WifiEntry.SECURITY_EAP_SUITE_B) {
|
||||
certs.add(noCertificateString);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user