文件名称:android 6.0 连wifi有感叹号,提示已连接WiFi无法连接网络.doc
文件大小:22KB
文件格式:DOC
更新时间:2023-04-22 05:10:21
wifi去感叹号
framework-base diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java index 35e80ca..06a07c2 100755 --- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java +++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java @@ -671,7 +671,7 @@ public class NetworkMonitor extends StateMachine { HttpURLConnection urlConnection = null; int httpResponseCode = 599; try { - URL url = new URL("http", mServer, "/generate_204"); + URL url = new URL("http", "www.baidu.com", "/more/index.html"); // On networks with a PAC instead of fetching a URL that should result in a 204 // reponse, we instead simply fetch the PAC script. This is done for a few reasons: // 1. At present our PAC code does not yet handle multiple PACs on multiple networks @@ -730,6 +730,11 @@ public class NetworkMonitor extends StateMachine { // There's no point in considering this a captive portal as the user cannot // sign-in to an empty page. Probably the result of a broken transparent proxy. // See http://b/9972012. + if (httpResponseCode == 200) { + if (DBG) log("www.baidu.com 200 response interpreted as 204 response."); + httpResponseCode = 204; + } + if (httpResponseCode == 200 && urlConnection.getContentLength() == 0) { if (DBG) log("Empty 200 response interpreted as 204 response."); httpResponseCode = 204;