Loading core/java/android/net/ConnectivityManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -1345,12 +1345,15 @@ public class ConnectivityManager { } /** * Gets the URL that should be used for resolving whether a captive portal is present. * Gets a URL that can be used for resolving whether a captive portal is present. * 1. This URL should respond with a 204 response to a GET request to indicate no captive * portal is present. * 2. This URL must be HTTP as redirect responses are used to find captive portal * sign-in pages. Captive portals cannot respond to HTTPS requests with redirects. * * The system network validation may be using different strategies to detect captive portals, * so this method does not necessarily return a URL used by the system. It only returns a URL * that may be relevant for other components trying to detect captive portals. * @hide */ @SystemApi Loading core/res/res/values/config.xml +9 −0 Original line number Diff line number Diff line Loading @@ -302,6 +302,15 @@ Settings.Global.NETWORK_AVOID_BAD_WIFI. This is the default value of that setting. --> <integer translatable="false" name="config_networkAvoidBadWifi">1</integer> <!-- The URL returned by ConnectivityManager#getCaptivePortalServerUrl. The actual returned value is controlled by Settings.Global.CAPTIVE_PORTAL_HTTP_URL. This is the default value used if that setting is unset. This is *NOT* a URL that will always be used by the system network validation to detect captive portals: NetworkMonitor may use different strategies and will not necessarily use this URL. NetworkMonitor behaviour should be configured with NetworkStack resource overlays instead. --> <string translatable="false" name="config_networkDefaultCaptivePortalServerUrl">http://connectivitycheck.gstatic.com/generate_204</string> <!-- If the hardware supports specially marking packets that caused a wakeup of the main CPU, set this value to the mark used. --> <integer name="config_networkWakeupPacketMark">0</integer> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1945,6 +1945,7 @@ <java-symbol type="integer" name="config_networkNotifySwitchType" /> <java-symbol type="array" name="config_networkNotifySwitches" /> <java-symbol type="integer" name="config_networkAvoidBadWifi" /> <java-symbol type="string" name="config_networkDefaultCaptivePortalServerUrl" /> <java-symbol type="integer" name="config_networkWakeupPacketMark" /> <java-symbol type="integer" name="config_networkWakeupPacketMask" /> <java-symbol type="bool" name="config_apfDrop802_3Frames" /> Loading packages/NetworkStack/res/values/config.xml 0 → 100644 +5 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <resources> <!-- Captive portal http url --> <string name="config_captive_portal_http_url" translatable="false">http://connectivitycheck.gstatic.com/generate_204</string> </resources> No newline at end of file packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java +8 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } /** Loading Loading
core/java/android/net/ConnectivityManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -1345,12 +1345,15 @@ public class ConnectivityManager { } /** * Gets the URL that should be used for resolving whether a captive portal is present. * Gets a URL that can be used for resolving whether a captive portal is present. * 1. This URL should respond with a 204 response to a GET request to indicate no captive * portal is present. * 2. This URL must be HTTP as redirect responses are used to find captive portal * sign-in pages. Captive portals cannot respond to HTTPS requests with redirects. * * The system network validation may be using different strategies to detect captive portals, * so this method does not necessarily return a URL used by the system. It only returns a URL * that may be relevant for other components trying to detect captive portals. * @hide */ @SystemApi Loading
core/res/res/values/config.xml +9 −0 Original line number Diff line number Diff line Loading @@ -302,6 +302,15 @@ Settings.Global.NETWORK_AVOID_BAD_WIFI. This is the default value of that setting. --> <integer translatable="false" name="config_networkAvoidBadWifi">1</integer> <!-- The URL returned by ConnectivityManager#getCaptivePortalServerUrl. The actual returned value is controlled by Settings.Global.CAPTIVE_PORTAL_HTTP_URL. This is the default value used if that setting is unset. This is *NOT* a URL that will always be used by the system network validation to detect captive portals: NetworkMonitor may use different strategies and will not necessarily use this URL. NetworkMonitor behaviour should be configured with NetworkStack resource overlays instead. --> <string translatable="false" name="config_networkDefaultCaptivePortalServerUrl">http://connectivitycheck.gstatic.com/generate_204</string> <!-- If the hardware supports specially marking packets that caused a wakeup of the main CPU, set this value to the mark used. --> <integer name="config_networkWakeupPacketMark">0</integer> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1945,6 +1945,7 @@ <java-symbol type="integer" name="config_networkNotifySwitchType" /> <java-symbol type="array" name="config_networkNotifySwitches" /> <java-symbol type="integer" name="config_networkAvoidBadWifi" /> <java-symbol type="string" name="config_networkDefaultCaptivePortalServerUrl" /> <java-symbol type="integer" name="config_networkWakeupPacketMark" /> <java-symbol type="integer" name="config_networkWakeupPacketMask" /> <java-symbol type="bool" name="config_apfDrop802_3Frames" /> Loading
packages/NetworkStack/res/values/config.xml 0 → 100644 +5 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <resources> <!-- Captive portal http url --> <string name="config_captive_portal_http_url" translatable="false">http://connectivitycheck.gstatic.com/generate_204</string> </resources> No newline at end of file
packages/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java +8 −1 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } /** Loading