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

Commit 74f9c1db authored by Erik Kline's avatar Erik Kline Committed by android-build-merger
Browse files

Merge "Support bypassing TLS in the framework" am: aef9956d am: f12b9edf

am: ae41e69d

Change-Id: I4c49e23d8caa4d485df1c1d2f135a7282d439c0b
parents 540296f5 ae41e69d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 services.net

LOCAL_SRC_FILES := $(call all-java-files-under, src)

+3 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.net.NetworkInfo;
import android.net.NetworkRequest;
import android.net.Proxy;
import android.net.Uri;
import android.net.dns.ResolvUtil;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
@@ -119,6 +120,8 @@ public class CaptivePortalLoginActivity extends Activity {

        // Also initializes proxy system properties.
        mCm.bindProcessToNetwork(mNetwork);
        mCm.setProcessDefaultNetworkForHostResolution(
                ResolvUtil.getNetworkWithUseLocalNameserversFlag(mNetwork));

        // Proxy system properties must be initialized before setContentView is called because
        // setContentView initializes the WebView logic which in turn reads the system properties.
+2 −0
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@ LOCAL_PACKAGE_NAME := CarrierDefaultApp
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_CERTIFICATE := platform

LOCAL_STATIC_JAVA_LIBRARIES := services.net

include $(BUILD_PACKAGE)

# This finds and builds the test apk as well, so a single make does both.
+3 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.net.NetworkRequest;
import android.net.Proxy;
import android.net.TrafficStats;
import android.net.Uri;
import android.net.dns.ResolvUtil;
import android.net.http.SslError;
import android.os.Bundle;
import android.telephony.CarrierConfigManager;
@@ -115,6 +116,8 @@ public class CaptivePortalLoginActivity extends Activity {
            requestNetworkForCaptivePortal();
        } else {
            mCm.bindProcessToNetwork(mNetwork);
            mCm.setProcessDefaultNetworkForHostResolution(
                    ResolvUtil.getNetworkWithUseLocalNameserversFlag(mNetwork));
            // Start initial page load so WebView finishes loading proxy settings.
            // Actual load of mUrl is initiated by MyWebViewClient.
            mWebView.loadData("", "text/html", null);
+12 −24
Original line number Diff line number Diff line
@@ -34,22 +34,19 @@ import android.net.LinkProperties;
import android.net.Network;
import android.net.NetworkUtils;
import android.net.Uri;
import android.net.dns.ResolvUtil;
import android.os.Binder;
import android.os.INetworkManagementService;
import android.os.Handler;
import android.os.UserHandle;
import android.provider.Settings;
import android.system.GaiException;
import android.system.OsConstants;
import android.system.StructAddrinfo;
import android.text.TextUtils;
import android.util.Slog;

import com.android.server.connectivity.MockableSystemProperties;

import libcore.io.Libcore;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
@@ -126,28 +123,19 @@ public class DnsManager {
    }

    public static PrivateDnsConfig tryBlockingResolveOf(Network network, String name) {
        final StructAddrinfo hints = new StructAddrinfo();
        // Unnecessary, but expressly no AI_ADDRCONFIG.
        hints.ai_flags = 0;
        // Fetch all IP addresses at once to minimize re-resolution.
        hints.ai_family = OsConstants.AF_UNSPEC;
        hints.ai_socktype = OsConstants.SOCK_DGRAM;

        try {
            final InetAddress[] ips = Libcore.os.android_getaddrinfo(name, hints, network.netId);
            if (ips != null && ips.length > 0) {
            final InetAddress[] ips = ResolvUtil.blockingResolveAllLocally(network, name);
            return new PrivateDnsConfig(name, ips);
        } catch (UnknownHostException uhe) {
            return new PrivateDnsConfig(name, null);
        }
        } catch (GaiException ignored) {}

        return null;
    }

    public static Uri[] getPrivateDnsSettingsUris() {
        final Uri[] uris = new Uri[2];
        uris[0] = Settings.Global.getUriFor(PRIVATE_DNS_MODE);
        uris[1] = Settings.Global.getUriFor(PRIVATE_DNS_SPECIFIER);
        return uris;
        return new Uri[]{
            Settings.Global.getUriFor(PRIVATE_DNS_MODE),
            Settings.Global.getUriFor(PRIVATE_DNS_SPECIFIER),
        };
    }

    private final Context mContext;
@@ -203,7 +191,7 @@ public class DnsManager {
        // NetworkMonitor to decide which networks need validation and runs the
        // blocking calls to resolve Private DNS strict mode hostnames.
        //
        // At this time we do attempt to enable Private DNS on non-Internet
        // At this time we do not attempt to enable Private DNS on non-Internet
        // networks like IMS.
        final PrivateDnsConfig privateDnsCfg = mPrivateDnsMap.get(netId);

Loading