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

Commit 587ecb3a authored by markchien's avatar markchien Committed by Chalard Jean
Browse files

Expose netId by adding getter API

Bug: 151156820
Test: m
      atest TetetheringTests
Change-Id: Ieb1483c146aa2f7d8f251157e6e81d71c44ae899
(cherry picked from commit 8831c4b54178753013d568c0b76bbf7487db8122)
parent 6051bff9
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -6270,8 +6270,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 {
+1 −0
Original line number Original line Diff line number Diff line
@@ -1819,6 +1819,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();
  }
  }


+12 −1
Original line number Original line Diff line number Diff line
@@ -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.
     *
     *
+1 −1
Original line number Original line Diff line number Diff line
@@ -1458,7 +1458,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(