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

Commit d324dcec authored by Erik Kline's avatar Erik Kline
Browse files

Fix CaptivePortalLoginActivity probes to bypass Private DNS

Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
    - manual testing on captive portal networks
Bug: 64133961
Bug: 77140445
Bug: 78548486

Merged-In: I749e8b5dba3b4af9ecb82bfb558c6f0e664531a4
Merged-In: Ic76d55861f385d1aecd360adda7f10142d083a47
Change-Id: Idbc4d90eeec257b36c5f374d61dea4600a0f8ebb
(cherry picked from commit 848d842a)
parent 13d650d7
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);
            }
        };
    }
}