OSDN Git Service

Add debug and remove SocketTimeoutException.
authorWink Saville <wink@google.com>
Thu, 29 Aug 2013 23:42:44 +0000 (16:42 -0700)
committerWink Saville <wink@google.com>
Thu, 29 Aug 2013 23:42:44 +0000 (16:42 -0700)
Bad merge from jb-mr2 to klp, the SocketTimeoutException
in isCaptivePortal should not be present. Also add debug
for bug 9972012. The SocketTimeoutException is a possible
cause of 9972012 but the logs from post #24 it was not
caused by a timeout, so this is not a fix.

Bug: 9972012
Change-Id: I290518832f8258d4682821815834f5621245b643

core/java/android/net/CaptivePortalTracker.java

index 6b96ad4..01977cd 100644 (file)
@@ -397,17 +397,14 @@ public class CaptivePortalTracker extends StateMachine {
             long responseTimestamp = SystemClock.elapsedRealtime();
 
             // we got a valid response, but not from the real google
-            boolean isCaptivePortal = urlConnection.getResponseCode() != 204;
+            int rspCode = urlConnection.getResponseCode();
+            boolean isCaptivePortal = rspCode != 204;
 
             sendNetworkConditionsBroadcast(true /* response received */, isCaptivePortal,
                     requestTimestamp, responseTimestamp);
+
+            if (DBG) log("isCaptivePortal: ret=" + isCaptivePortal + " rspCode=" + rspCode);
             return isCaptivePortal;
-        } catch (SocketTimeoutException e) {
-            if (DBG) log("Probably a portal: exception " + e);
-            if (requestTimestamp != -1) {
-                sendFailedCaptivePortalCheckBroadcast(requestTimestamp);
-            } // else something went wrong with setting up the urlConnection
-            return true;
         } catch (IOException e) {
             if (DBG) log("Probably not a portal: exception " + e);
             if (requestTimestamp != -1) {