Merge "Expose netId by adding getter API" into rvc-dev am: e281e579ca

Change-Id: I169aabae9037f8d16fdd9e70166794173ae3c995
This commit is contained in:
Junyu Lai
2020-03-20 11:23:03 +00:00
committed by Automerger Merge Worker
4 changed files with 15 additions and 3 deletions

View File

@@ -6258,8 +6258,8 @@ package android.net {
public class Network implements android.os.Parcelable { public class Network implements android.os.Parcelable {
ctor public Network(@NonNull android.net.Network); ctor public Network(@NonNull android.net.Network);
method public int getNetId();
method @NonNull public android.net.Network getPrivateDnsBypassingCopy(); method @NonNull public android.net.Network getPrivateDnsBypassingCopy();
field public final int netId;
} }
public abstract class NetworkAgent { public abstract class NetworkAgent {

View File

@@ -1820,6 +1820,7 @@ package android.net {
public class Network implements android.os.Parcelable { public class Network implements android.os.Parcelable {
ctor public Network(@NonNull android.net.Network); ctor public Network(@NonNull android.net.Network);
method public int getNetId();
method @NonNull public android.net.Network getPrivateDnsBypassingCopy(); method @NonNull public android.net.Network getPrivateDnsBypassingCopy();
} }

View File

@@ -64,7 +64,7 @@ public class Network implements Parcelable {
* The unique id of the network. * The unique id of the network.
* @hide * @hide
*/ */
@SystemApi @UnsupportedAppUsage
public final int netId; public final int netId;
// Objects used to perform per-network operations such as getSocketFactory // Objects used to perform per-network operations such as getSocketFactory
@@ -169,6 +169,17 @@ public class Network implements Parcelable {
return new Network(netId, true); return new Network(netId, true);
} }
/**
* Get the unique id of the network.
*
* @hide
*/
@TestApi
@SystemApi
public int getNetId() {
return netId;
}
/** /**
* Returns a netid marked with the Private DNS bypass flag. * Returns a netid marked with the Private DNS bypass flag.
* *

View File

@@ -1494,7 +1494,7 @@ public class Tethering {
} else { } else {
dnsServers = mConfig.defaultIPv4DNS; dnsServers = mConfig.defaultIPv4DNS;
} }
final int netId = (network != null) ? network.netId : NETID_UNSET; final int netId = (network != null) ? network.getNetId() : NETID_UNSET;
try { try {
mNetd.tetherDnsSet(netId, dnsServers); mNetd.tetherDnsSet(netId, dnsServers);
mLog.log(String.format( mLog.log(String.format(