Android 11/12 修改源码, 允许802.1x不安装证书登录企业wifi
//android-12.0.0_r11/packages/apps/Settings/src/com/android/settings/wifi/WifiConfigController2.java
boolean isSubmittable() {
boolean enabled = false;
boolean passwordInvalid = false;
if (mPasswordView != null
&& ((mWifiEntrySecurity == WifiEntry.SECURITY_WEP
&& mPasswordView.length() == 0)
|| (mWifiEntrySecurity == WifiEntry.SECURITY_PSK
&& !isValidPsk(mPasswordView.getText().toString()))
|| (mWifiEntrySecurity == WifiEntry.SECURITY_SAE
&& !isValidSaePassword(mPasswordView.getText().toString())))) {
passwordInvalid = true;
}
if ((mSsidView != null && mSsidView.length() == 0)
// If WifiEntry is not saved, apply passwordInvalid check
|| ((mWifiEntry == null || !mWifiEntry.isSaved()) && passwordInvalid
// If WifiEntry is saved (modifying network) and password is changed, apply
// Invalid password check
|| mWifiEntry != null && mWifiEntry.isSaved() && passwordInvalid
&& mPasswordView.length() > 0)) {
enabled = false;
} else {
enabled = ipAndProxyFieldsAreValid();
}
if ((mWifiEntrySecurity == WifiEntry.SECURITY_EAP
|| mWifiEntrySecurity == WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE
|| mWifiEntrySecurity == WifiEntry.SECURITY_EAP_SUITE_B)
&& mEapCaCertSpinner != null
&& mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) {
String caCertSelection = (String) mEapCaCertSpinner.getSelectedItem();
if (caCertSelection.equals(mUnspecifiedCertString)) {
// Disallow submit if the user has not selected a CA certificate for an EAP network
// configuration.
// enabled = false;
} 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
// validation, but does not provide a domain.
enabled = false;
}
}
if ((mWifiEntrySecurity == WifiEntry.SECURITY_EAP
|| mWifiEntrySecurity == WifiEntry.SECURITY_EAP_WPA3_ENTERPRISE
|| mWifiEntrySecurity == WifiEntry.SECURITY_EAP_SUITE_B)
&& mEapUserCertSpinner != null
&& mView.findViewById(R.id.l_user_cert).getVisibility() != View.GONE
&& mEapUserCertSpinner.getSelectedItem().equals(mUnspecifiedCertString)) {
// Disallow submit if the user has not selected a user certificate for an EAP network
// configuration.
// enabled = false;
}
return enabled;
}