diff options
author | Remi NGUYEN VAN <reminv@google.com> | 2019-03-20 14:22:49 +0900 |
---|---|---|
committer | Remi NGUYEN VAN <reminv@google.com> | 2019-03-22 15:11:14 +0900 |
commit | b4f486921e4c79ccaf9e28706d18a5abf9c06efa (patch) | |
tree | d0e850b95ee9c37107504d5dfacaed9a3e2fe424 /src | |
parent | a9451963029be607c34ca533e46a58dbac88889c (diff) |
Separate NetworkMonitor/framework portal URL
The framework cannot return URLs used by the updatable NetworkStack,
which may use configurable URLs, changing URLs, or mechanisms not
involving URLs to detect captive portals. NetworkMonitor has already
been using random fallback URLs for a while that do not match the value
returned by ConnectivityManager#getCaptivePortalServerUrl.
With this change, the default value returned by the framework is
configured in framework resources as
config_networkDefaultCaptivePortalServerUrl. NetworkMonitor behavior may
change as it is an updatable component, but the current URL is
configured in NetworkMonitor resources as
config_captive_portal_http_url.
Test: flashed, booted, WiFi and captive portal working
Test: ConnectivityManager#getCaptivePortalServerUrl returns correct
value.
Bug: 127908503
Change-Id: I371dedc5b22efa909d7fd58e1ebe9b8aaced9780
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/server/connectivity/NetworkMonitor.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/server/connectivity/NetworkMonitor.java b/src/com/android/server/connectivity/NetworkMonitor.java index 48d9d7b..bd3d463 100644 --- a/src/com/android/server/connectivity/NetworkMonitor.java +++ b/src/com/android/server/connectivity/NetworkMonitor.java @@ -83,6 +83,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.RingBufferIndices; import com.android.internal.util.State; import com.android.internal.util.StateMachine; +import com.android.networkstack.R; import java.io.IOException; import java.net.HttpURLConnection; @@ -1710,9 +1711,15 @@ public class NetworkMonitor extends StateMachine { /** * Get the captive portal server HTTP URL that is configured on the device. + * + * NetworkMonitor does not use {@link ConnectivityManager#getCaptivePortalServerUrl()} as + * it has its own updatable strategies to detect captive portals. The framework only advises + * on one URL that can be used, while NetworkMonitor may implement more complex logic. */ public String getCaptivePortalServerHttpUrl(Context context) { - return NetworkMonitorUtils.getCaptivePortalServerHttpUrl(context); + final String defaultUrl = + context.getResources().getString(R.string.config_captive_portal_http_url); + return NetworkMonitorUtils.getCaptivePortalServerHttpUrl(context, defaultUrl); } /** |