Merge "Remove ResolveUtil from frameworks/base callers"

am: 0e1621296f

Change-Id: Ibc885ccd9531706df029154f7ec4fde71bf600d1
This commit is contained in:
Erik Kline
2018-08-28 20:12:49 -07:00
committed by android-build-merger
3 changed files with 15 additions and 18 deletions

View File

@@ -3840,7 +3840,7 @@ public class ConnectivityManager {
@UnsupportedAppUsage @UnsupportedAppUsage
public static boolean setProcessDefaultNetworkForHostResolution(Network network) { public static boolean setProcessDefaultNetworkForHostResolution(Network network) {
return NetworkUtils.bindProcessToNetworkForHostResolution( return NetworkUtils.bindProcessToNetworkForHostResolution(
network == null ? NETID_UNSET : network.netId); (network == null) ? NETID_UNSET : network.getNetIdForResolv());
} }
/** /**

View File

@@ -100,21 +100,29 @@ public class Network implements Parcelable {
// anytime and (b) receivers should be explicit about attempts to bypass // anytime and (b) receivers should be explicit about attempts to bypass
// Private DNS so that the intent of the code is easily determined and // Private DNS so that the intent of the code is easily determined and
// code search audits are possible. // code search audits are possible.
private boolean mPrivateDnsBypass = false; private final transient boolean mPrivateDnsBypass;
/** /**
* @hide * @hide
*/ */
@UnsupportedAppUsage @UnsupportedAppUsage
public Network(int netId) { public Network(int netId) {
this(netId, false);
}
/**
* @hide
*/
public Network(int netId, boolean privateDnsBypass) {
this.netId = netId; this.netId = netId;
this.mPrivateDnsBypass = privateDnsBypass;
} }
/** /**
* @hide * @hide
*/ */
public Network(Network that) { public Network(Network that) {
this.netId = that.netId; this(that.netId, that.mPrivateDnsBypass);
} }
/** /**
@@ -133,8 +141,7 @@ public class Network implements Parcelable {
* Operates the same as {@code InetAddress.getByName} except that host * Operates the same as {@code InetAddress.getByName} except that host
* resolution is done on this network. * resolution is done on this network.
* *
* @param host * @param host the hostname to be resolved to an address or {@code null}.
* the hostName to be resolved to an address or {@code null}.
* @return the {@code InetAddress} instance representing the host. * @return the {@code InetAddress} instance representing the host.
* @throws UnknownHostException * @throws UnknownHostException
* if the address lookup fails. * if the address lookup fails.
@@ -144,14 +151,14 @@ public class Network implements Parcelable {
} }
/** /**
* Specify whether or not Private DNS should be bypassed when attempting * Obtain a Network object for which Private DNS is to be bypassed when attempting
* to use {@link #getAllByName(String)}/{@link #getByName(String)} methods on the given * to use {@link #getAllByName(String)}/{@link #getByName(String)} methods on the given
* instance for hostname resolution. * instance for hostname resolution.
* *
* @hide * @hide
*/ */
public void setPrivateDnsBypass(boolean bypass) { public Network getPrivateDnsBypassingCopy() {
mPrivateDnsBypass = bypass; return new Network(netId, true);
} }
/** /**

View File

@@ -35,7 +35,6 @@ import android.net.LinkProperties;
import android.net.Network; import android.net.Network;
import android.net.NetworkUtils; import android.net.NetworkUtils;
import android.net.Uri; import android.net.Uri;
import android.net.dns.ResolvUtil;
import android.os.Binder; import android.os.Binder;
import android.os.INetworkManagementService; import android.os.INetworkManagementService;
import android.os.UserHandle; import android.os.UserHandle;
@@ -174,15 +173,6 @@ public class DnsManager {
return new PrivateDnsConfig(useTls); return new PrivateDnsConfig(useTls);
} }
public static PrivateDnsConfig tryBlockingResolveOf(Network network, String name) {
try {
final InetAddress[] ips = ResolvUtil.blockingResolveAllLocally(network, name);
return new PrivateDnsConfig(name, ips);
} catch (UnknownHostException uhe) {
return new PrivateDnsConfig(name, null);
}
}
public static Uri[] getPrivateDnsSettingsUris() { public static Uri[] getPrivateDnsSettingsUris() {
return new Uri[]{ return new Uri[]{
Settings.Global.getUriFor(PRIVATE_DNS_DEFAULT_MODE), Settings.Global.getUriFor(PRIVATE_DNS_DEFAULT_MODE),