diff options
| author | Remi NGUYEN VAN <reminv@google.com> | 2020-04-09 06:41:16 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-04-09 06:41:16 +0000 |
| commit | 2fc6dfb4e7ede6e7769ba51e844271d4d6f1b1eb (patch) | |
| tree | b4eb3c45f999586987eafd2322ae01103c315047 /common | |
| parent | 6ac9066f60dfd8fa2fc00e67a96faefc80a2951c (diff) | |
| parent | b52e03889a030acf7c2e0cc1fab63c1d1bfda380 (diff) | |
| download | platform_packages_modules_NetworkStack-2fc6dfb4e7ede6e7769ba51e844271d4d6f1b1eb.tar.gz platform_packages_modules_NetworkStack-2fc6dfb4e7ede6e7769ba51e844271d4d6f1b1eb.tar.bz2 platform_packages_modules_NetworkStack-2fc6dfb4e7ede6e7769ba51e844271d4d6f1b1eb.zip | |
Merge "Do not detect portals when DNS returns private IPs" am: a9068317c9 am: b52e03889a
Change-Id: Iaa65370031138a4f16743d899228ee284cdda468
Diffstat (limited to 'common')
| -rwxr-xr-x[-rw-r--r--] | common/captiveportal/src/android/net/captiveportal/CaptivePortalProbeResult.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/common/captiveportal/src/android/net/captiveportal/CaptivePortalProbeResult.java b/common/captiveportal/src/android/net/captiveportal/CaptivePortalProbeResult.java index 48cd48b3..deee91aa 100644..100755 --- a/common/captiveportal/src/android/net/captiveportal/CaptivePortalProbeResult.java +++ b/common/captiveportal/src/android/net/captiveportal/CaptivePortalProbeResult.java @@ -36,6 +36,12 @@ public final class CaptivePortalProbeResult { */ public static final int PARTIAL_CODE = -1; + // DNS response with private IP on the probe URL means the network, especially Wi-Fi network is + // not connected to the Internet. This code represents the result of a single probe, for correct + // logging of the probe results. The result of the whole evaluation would typically be FAILED if + // one of the probes returns this status. + public static final int DNS_PRIVATE_IP_RESPONSE_CODE = -2; + @NonNull public static final CaptivePortalProbeResult FAILED = new CaptivePortalProbeResult(FAILED_CODE); @NonNull @@ -43,6 +49,8 @@ public final class CaptivePortalProbeResult { new CaptivePortalProbeResult(SUCCESS_CODE); public static final CaptivePortalProbeResult PARTIAL = new CaptivePortalProbeResult(PARTIAL_CODE); + public static final CaptivePortalProbeResult PRIVATE_IP = + new CaptivePortalProbeResult(DNS_PRIVATE_IP_RESPONSE_CODE); private final int mHttpResponseCode; // HTTP response code returned from Internet probe. @Nullable @@ -85,4 +93,8 @@ public final class CaptivePortalProbeResult { public boolean isPartialConnectivity() { return mHttpResponseCode == PARTIAL_CODE; } + + public boolean isDnsPrivateIpResponse() { + return mHttpResponseCode == DNS_PRIVATE_IP_RESPONSE_CODE; + } } |
