Merge "[Mainline] Core Platform APIs migration"
This commit is contained in:
@@ -2030,7 +2030,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
mHandler.sendMessage(mHandler.obtainMessage(
|
mHandler.sendMessage(mHandler.obtainMessage(
|
||||||
EVENT_PRIVATE_DNS_VALIDATION_UPDATE,
|
EVENT_PRIVATE_DNS_VALIDATION_UPDATE,
|
||||||
new PrivateDnsValidationUpdate(netId,
|
new PrivateDnsValidationUpdate(netId,
|
||||||
InetAddress.parseNumericAddress(ipAddress),
|
InetAddresses.parseNumericAddress(ipAddress),
|
||||||
hostname, validated)));
|
hostname, validated)));
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
loge("Error parsing ip address in validation event");
|
loge("Error parsing ip address in validation event");
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import android.util.SparseArray;
|
|||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.net.module.util.NetdUtils;
|
import com.android.net.module.util.NetdUtils;
|
||||||
|
import com.android.net.module.util.NetworkStackConstants;
|
||||||
|
|
||||||
import java.io.UncheckedIOException;
|
import java.io.UncheckedIOException;
|
||||||
import java.net.Inet4Address;
|
import java.net.Inet4Address;
|
||||||
@@ -280,10 +281,12 @@ class TestNetworkService extends ITestNetworkManager.Stub {
|
|||||||
|
|
||||||
// Add global routes (but as non-default, non-internet providing network)
|
// Add global routes (but as non-default, non-internet providing network)
|
||||||
if (allowIPv4) {
|
if (allowIPv4) {
|
||||||
lp.addRoute(new RouteInfo(new IpPrefix(Inet4Address.ANY, 0), null, iface));
|
lp.addRoute(new RouteInfo(new IpPrefix(
|
||||||
|
NetworkStackConstants.IPV4_ADDR_ANY, 0), null, iface));
|
||||||
}
|
}
|
||||||
if (allowIPv6) {
|
if (allowIPv6) {
|
||||||
lp.addRoute(new RouteInfo(new IpPrefix(Inet6Address.ANY, 0), null, iface));
|
lp.addRoute(new RouteInfo(new IpPrefix(
|
||||||
|
NetworkStackConstants.IPV6_ADDR_ANY, 0), null, iface));
|
||||||
}
|
}
|
||||||
|
|
||||||
final TestNetworkAgent agent = new TestNetworkAgent(context, looper, nc, lp,
|
final TestNetworkAgent agent = new TestNetworkAgent(context, looper, nc, lp,
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import android.content.ContentResolver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.IDnsResolver;
|
import android.net.IDnsResolver;
|
||||||
|
import android.net.InetAddresses;
|
||||||
import android.net.LinkProperties;
|
import android.net.LinkProperties;
|
||||||
import android.net.Network;
|
import android.net.Network;
|
||||||
import android.net.ResolverOptionsParcel;
|
import android.net.ResolverOptionsParcel;
|
||||||
@@ -190,7 +191,7 @@ public class DnsManager {
|
|||||||
for (String ipAddress : ipAddresses) {
|
for (String ipAddress : ipAddresses) {
|
||||||
try {
|
try {
|
||||||
latestDnses.add(new Pair(hostname,
|
latestDnses.add(new Pair(hostname,
|
||||||
InetAddress.parseNumericAddress(ipAddress)));
|
InetAddresses.parseNumericAddress(ipAddress)));
|
||||||
} catch (IllegalArgumentException e) {}
|
} catch (IllegalArgumentException e) {}
|
||||||
}
|
}
|
||||||
// Remove <hostname, ipAddress> pairs that should not be tracked.
|
// Remove <hostname, ipAddress> pairs that should not be tracked.
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ import android.util.Log;
|
|||||||
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.util.ArrayUtils;
|
import com.android.internal.util.ArrayUtils;
|
||||||
|
import com.android.net.module.util.NetworkStackConstants;
|
||||||
import com.android.server.net.BaseNetworkObserver;
|
import com.android.server.net.BaseNetworkObserver;
|
||||||
|
|
||||||
import java.net.Inet4Address;
|
|
||||||
import java.net.Inet6Address;
|
import java.net.Inet6Address;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -433,7 +433,7 @@ public class Nat464Xlat extends BaseNetworkObserver {
|
|||||||
// clat IPv4 address itself (for those apps, it doesn't matter what
|
// clat IPv4 address itself (for those apps, it doesn't matter what
|
||||||
// the IP of the gateway is, only that there is one).
|
// the IP of the gateway is, only that there is one).
|
||||||
RouteInfo ipv4Default = new RouteInfo(
|
RouteInfo ipv4Default = new RouteInfo(
|
||||||
new LinkAddress(Inet4Address.ANY, 0),
|
new LinkAddress(NetworkStackConstants.IPV4_ADDR_ANY, 0),
|
||||||
clatAddress.getAddress(), mIface);
|
clatAddress.getAddress(), mIface);
|
||||||
stacked.addRoute(ipv4Default);
|
stacked.addRoute(ipv4Default);
|
||||||
stacked.addLinkAddress(clatAddress);
|
stacked.addLinkAddress(clatAddress);
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ import android.net.DnsResolver;
|
|||||||
import android.net.INetd;
|
import android.net.INetd;
|
||||||
import android.net.INetworkManagementEventObserver;
|
import android.net.INetworkManagementEventObserver;
|
||||||
import android.net.Ikev2VpnProfile;
|
import android.net.Ikev2VpnProfile;
|
||||||
|
import android.net.InetAddresses;
|
||||||
import android.net.IpPrefix;
|
import android.net.IpPrefix;
|
||||||
import android.net.IpSecManager;
|
import android.net.IpSecManager;
|
||||||
import android.net.IpSecManager.IpSecTunnelInterface;
|
import android.net.IpSecManager.IpSecTunnelInterface;
|
||||||
@@ -111,6 +112,7 @@ import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
|||||||
import com.android.internal.net.LegacyVpnInfo;
|
import com.android.internal.net.LegacyVpnInfo;
|
||||||
import com.android.internal.net.VpnConfig;
|
import com.android.internal.net.VpnConfig;
|
||||||
import com.android.internal.net.VpnProfile;
|
import com.android.internal.net.VpnProfile;
|
||||||
|
import com.android.net.module.util.NetworkStackConstants;
|
||||||
import com.android.server.DeviceIdleInternal;
|
import com.android.server.DeviceIdleInternal;
|
||||||
import com.android.server.LocalServices;
|
import com.android.server.LocalServices;
|
||||||
import com.android.server.net.BaseNetworkObserver;
|
import com.android.server.net.BaseNetworkObserver;
|
||||||
@@ -332,7 +334,7 @@ public class Vpn {
|
|||||||
public InetAddress resolve(final String endpoint)
|
public InetAddress resolve(final String endpoint)
|
||||||
throws ExecutionException, InterruptedException {
|
throws ExecutionException, InterruptedException {
|
||||||
try {
|
try {
|
||||||
return InetAddress.parseNumericAddress(endpoint);
|
return InetAddresses.parseNumericAddress(endpoint);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
// Endpoint is not numeric : fall through and resolve
|
// Endpoint is not numeric : fall through and resolve
|
||||||
}
|
}
|
||||||
@@ -1125,7 +1127,7 @@ public class Vpn {
|
|||||||
|
|
||||||
if (mConfig.dnsServers != null) {
|
if (mConfig.dnsServers != null) {
|
||||||
for (String dnsServer : mConfig.dnsServers) {
|
for (String dnsServer : mConfig.dnsServers) {
|
||||||
InetAddress address = InetAddress.parseNumericAddress(dnsServer);
|
InetAddress address = InetAddresses.parseNumericAddress(dnsServer);
|
||||||
lp.addDnsServer(address);
|
lp.addDnsServer(address);
|
||||||
allowIPv4 |= address instanceof Inet4Address;
|
allowIPv4 |= address instanceof Inet4Address;
|
||||||
allowIPv6 |= address instanceof Inet6Address;
|
allowIPv6 |= address instanceof Inet6Address;
|
||||||
@@ -1135,10 +1137,12 @@ public class Vpn {
|
|||||||
lp.setHttpProxy(mConfig.proxyInfo);
|
lp.setHttpProxy(mConfig.proxyInfo);
|
||||||
|
|
||||||
if (!allowIPv4) {
|
if (!allowIPv4) {
|
||||||
lp.addRoute(new RouteInfo(new IpPrefix(Inet4Address.ANY, 0), RTN_UNREACHABLE));
|
lp.addRoute(new RouteInfo(new IpPrefix(
|
||||||
|
NetworkStackConstants.IPV4_ADDR_ANY, 0), RTN_UNREACHABLE));
|
||||||
}
|
}
|
||||||
if (!allowIPv6) {
|
if (!allowIPv6) {
|
||||||
lp.addRoute(new RouteInfo(new IpPrefix(Inet6Address.ANY, 0), RTN_UNREACHABLE));
|
lp.addRoute(new RouteInfo(new IpPrefix(
|
||||||
|
NetworkStackConstants.IPV6_ADDR_ANY, 0), RTN_UNREACHABLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Concatenate search domains into a string.
|
// Concatenate search domains into a string.
|
||||||
|
|||||||
Reference in New Issue
Block a user