Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45a3a6ec authored by Erik Kline's avatar Erik Kline Committed by Android (Google) Code Review
Browse files

Merge "Fix CaptivePortalLoginActivity probes to bypass Private DNS" into pi-dev

parents 1072d0d1 d324dcec
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -321,6 +321,7 @@ public class CaptivePortalLoginActivity extends Activity {
        // TODO: reuse NetworkMonitor facilities for consistent captive portal detection.
        new Thread(new Runnable() {
            public void run() {
                final Network network = ResolvUtil.makeNetworkWithPrivateDnsBypass(mNetwork);
                // Give time for captive portal to open.
                try {
                    Thread.sleep(1000);
@@ -329,7 +330,7 @@ public class CaptivePortalLoginActivity extends Activity {
                HttpURLConnection urlConnection = null;
                int httpResponseCode = 500;
                try {
                    urlConnection = (HttpURLConnection) mNetwork.openConnection(mUrl);
                    urlConnection = (HttpURLConnection) network.openConnection(mUrl);
                    urlConnection.setInstanceFollowRedirects(false);
                    urlConnection.setConnectTimeout(SOCKET_TIMEOUT_MS);
                    urlConnection.setReadTimeout(SOCKET_TIMEOUT_MS);
+9 −0
Original line number Diff line number Diff line
@@ -62,4 +62,13 @@ public class ResolvUtil {
        final long netidForResolv = NETID_USE_LOCAL_NAMESERVERS | (long) network.netId;
        return new Network((int) netidForResolv);
    }

    public static Network makeNetworkWithPrivateDnsBypass(Network network) {
        return new Network(network) {
            @Override
            public InetAddress[] getAllByName(String host) throws UnknownHostException {
                return blockingResolveAllLocally(network, host);
            }
        };
    }
}