From 605bb642f09a7e05bdf40516209e3acc14cf35c0 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Thu, 29 Aug 2013 13:40:43 +0100 Subject: [PATCH] Remove captive portal code that has no effect. Note that this CL does not change any behaviour. At the center of this change is CaptivePortalTracker#detectCaptivePortal(), which does nothing except call back into ConnectivityService. Removing it allows us to simplify code in ConnectivityService. It also allows us to remove ConnectivityService#captivePortalCheckComplete which was only ever called in response to this method. While this does not change any behaviour, it preserves existing bad behaviour, i.e, that the CAPTIVE_PORTAL_CHECK NetworkInfo state does not correspond to actual captive portal detection. We transition into that state and immediately (and unconditionally) out of it and into CONNECTED. Change-Id: Ib3797f956d2db5e3cacaaa53e899d81aa8e958af --- .../java/android/net/ConnectivityManager.java | 18 ---------- .../android/net/IConnectivityManager.aidl | 2 -- .../android/server/ConnectivityService.java | 33 ------------------- 3 files changed, 53 deletions(-) diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index c78a973cee..0f8dc7aa07 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -1328,24 +1328,6 @@ public class ConnectivityManager { } } - /** - * Signal that the captive portal check on the indicated network - * is complete and we can turn the network on for general use. - * - * @param info the {@link NetworkInfo} object for the networkType - * in question. - * - *

This method requires the call to hold the permission - * {@link android.Manifest.permission#CONNECTIVITY_INTERNAL}. - * {@hide} - */ - public void captivePortalCheckComplete(NetworkInfo info) { - try { - mService.captivePortalCheckComplete(info); - } catch (RemoteException e) { - } - } - /** * Signal that the captive portal check on the indicated network * is complete and whether its a captive portal or not. diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl index c1da2e32aa..b3217eb907 100644 --- a/core/java/android/net/IConnectivityManager.aidl +++ b/core/java/android/net/IConnectivityManager.aidl @@ -129,8 +129,6 @@ interface IConnectivityManager boolean updateLockdownVpn(); - void captivePortalCheckComplete(in NetworkInfo info); - void captivePortalCheckCompleted(in NetworkInfo info, boolean isCaptivePortal); void supplyMessenger(int networkType, in Messenger messenger); diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index b5f0697472..5418b3b03d 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -2316,36 +2316,6 @@ public class ConnectivityService extends IConnectivityManager.Stub { } } - private void handleCaptivePortalTrackerCheck(NetworkInfo info) { - if (DBG) log("Captive portal check " + info); - int type = info.getType(); - final NetworkStateTracker thisNet = mNetTrackers[type]; - if (mNetConfigs[type].isDefault()) { - if (mActiveDefaultNetwork != -1 && mActiveDefaultNetwork != type) { - if (isNewNetTypePreferredOverCurrentNetType(type)) { - if (DBG) log("Captive check on " + info.getTypeName()); - mCaptivePortalTracker.detectCaptivePortal(new NetworkInfo(info)); - return; - } else { - if (DBG) log("Tear down low priority net " + info.getTypeName()); - teardown(thisNet); - return; - } - } - } - - if (DBG) log("handleCaptivePortalTrackerCheck: call captivePortalCheckComplete ni=" + info); - thisNet.captivePortalCheckComplete(); - } - - /** @hide */ - @Override - public void captivePortalCheckComplete(NetworkInfo info) { - enforceConnectivityInternalPermission(); - if (DBG) log("captivePortalCheckComplete: ni=" + info); - mNetTrackers[info.getType()].captivePortalCheckComplete(); - } - /** @hide */ @Override public void captivePortalCheckCompleted(NetworkInfo info, boolean isCaptivePortal) { @@ -2972,9 +2942,6 @@ public class ConnectivityService extends IConnectivityManager.Stub { if (info.getDetailedState() == NetworkInfo.DetailedState.FAILED) { handleConnectionFailure(info); - } else if (info.getDetailedState() == - DetailedState.CAPTIVE_PORTAL_CHECK) { - handleCaptivePortalTrackerCheck(info); } else if (info.isConnectedToProvisioningNetwork()) { /** * TODO: Create ConnectivityManager.TYPE_MOBILE_PROVISIONING