禁止不安全网络

禁止不安全网络,第1张

----------- src/com/android/settings/wifi/WifiConfigController.java -----------
index 88acd88..c143258 100644
@@ -474,4 +474,8 @@ public class WifiConfigController implements TextWatcher,
         boolean enabled = false;
         boolean passwordInvalid = false;
+        // not allow unsafe net work
+        if(mAccessPointSecurity == AccessPoint.SECURITY_WEP || mAccessPointSecurity == AccessPoint.SECURITY_NONE){
+            return false;
+        }
         if (mPasswordView != null
                 && ((mAccessPointSecurity == AccessPoint.SECURITY_WEP

--------------- src/com/android/settings/wifi/WifiSettings.java ---------------
index ccc6abe..1516522 100644
@@ -531,4 +531,9 @@ public class WifiSettings extends RestrictedSettingsFragment
         switch (item.getItemId()) {
             case MENU_ID_CONNECT: {
+                // add for unsafe network
+                if (mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_NONE || mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_WEP){
+                    //Toast.makeText(getActivity(), R.string.wifi_failed_connect_message,Toast.LENGTH_SHORT).show();
+                    return false;
+                }
                 boolean isSavedNetwork = mSelectedAccessPoint.isSaved();
                 if (isSavedNetwork) {
@@ -580,4 +585,9 @@ public class WifiSettings extends RestrictedSettingsFragment
                 return false;
             }
+            //add for network
+            if(mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_NONE) {
+                //Toast.makeText(getActivity(),R.string.wifi_not_allow_connect.Toast.LENGTH_SHORT).show();
+                return true;
+            }
             if (mSelectedAccessPoint.isActive()) {
                 return super.onPreferenceTreeClick(preference);

----------- src/com/android/settings/wifi/WifiConfigController.java -----------
index 88acd88..c143258 100644
@@ -474,4 +474,8 @@ public class WifiConfigController implements TextWatcher,
         boolean enabled = false;
         boolean passwordInvalid = false;
+        // not allow unsafe net work
+        if(mAccessPointSecurity == AccessPoint.SECURITY_WEP || mAccessPointSecurity == AccessPoint.SECURITY_NONE){
+            return false;
+        }
         if (mPasswordView != null
                 && ((mAccessPointSecurity == AccessPoint.SECURITY_WEP

--------------- src/com/android/settings/wifi/WifiSettings.java ---------------
index ccc6abe..1516522 100644
@@ -531,4 +531,9 @@ public class WifiSettings extends RestrictedSettingsFragment
         switch (item.getItemId()) {
             case MENU_ID_CONNECT: {
+                // add for unsafe network
+                if (mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_NONE || mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_WEP){
+                    //Toast.makeText(getActivity(), R.string.wifi_failed_connect_message,Toast.LENGTH_SHORT).show();
+                    return false;
+                }
                 boolean isSavedNetwork = mSelectedAccessPoint.isSaved();
                 if (isSavedNetwork) {
@@ -580,4 +585,9 @@ public class WifiSettings extends RestrictedSettingsFragment
                 return false;
             }
+            //add for network
+            if(mSelectedAccessPoint.getSecurity() == AccessPoint.SECURITY_NONE) {
+                //Toast.makeText(getActivity(),R.string.wifi_not_allow_connect.Toast.LENGTH_SHORT).show();
+                return true;
+            }
             if (mSelectedAccessPoint.isActive()) {
                 return super.onPreferenceTreeClick(preference);

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/725635.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-26
下一篇 2022-04-26

发表评论

登录后才能评论

评论列表(0条)

保存