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

Commit 4a66729c authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by Gerrit Code Review
Browse files

Merge "Fix API for SocketUtils"

parents 2656b3d4 51569028
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -3525,16 +3525,16 @@ package android.net.metrics {
package android.net.util {
  public class SocketUtils {
  public final class SocketUtils {
    method public static void addArpEntry(@NonNull java.net.Inet4Address, @NonNull android.net.MacAddress, @NonNull String, @NonNull java.io.FileDescriptor) throws java.io.IOException;
    method public static void attachControlPacketFilter(@NonNull java.io.FileDescriptor, int) throws java.net.SocketException;
    method public static void attachDhcpFilter(@NonNull java.io.FileDescriptor) throws java.net.SocketException;
    method public static void attachRaFilter(@NonNull java.io.FileDescriptor, int) throws java.net.SocketException;
    method public static void bindSocketToInterface(@NonNull java.io.FileDescriptor, @NonNull String) throws android.system.ErrnoException;
    method public static void closeSocket(@Nullable java.io.FileDescriptor) throws java.io.IOException;
    method public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
    method public static java.net.SocketAddress makePacketSocketAddress(short, int);
    method public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
    method @NonNull public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
    method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int);
    method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
    method public static void setSocketTimeValueOption(@NonNull java.io.FileDescriptor, int, int, long) throws android.system.ErrnoException;
  }
+4 −4
Original line number Diff line number Diff line
@@ -935,16 +935,16 @@ package android.net.metrics {

package android.net.util {

  public class SocketUtils {
  public final class SocketUtils {
    method public static void addArpEntry(@NonNull java.net.Inet4Address, @NonNull android.net.MacAddress, @NonNull String, @NonNull java.io.FileDescriptor) throws java.io.IOException;
    method public static void attachControlPacketFilter(@NonNull java.io.FileDescriptor, int) throws java.net.SocketException;
    method public static void attachDhcpFilter(@NonNull java.io.FileDescriptor) throws java.net.SocketException;
    method public static void attachRaFilter(@NonNull java.io.FileDescriptor, int) throws java.net.SocketException;
    method public static void bindSocketToInterface(@NonNull java.io.FileDescriptor, @NonNull String) throws android.system.ErrnoException;
    method public static void closeSocket(@Nullable java.io.FileDescriptor) throws java.io.IOException;
    method public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
    method public static java.net.SocketAddress makePacketSocketAddress(short, int);
    method public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
    method @NonNull public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
    method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int);
    method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
    method public static void setSocketTimeValueOption(@NonNull java.io.FileDescriptor, int, int, long) throws android.system.ErrnoException;
  }

+6 −3
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ import java.net.SocketException;
 */
@SystemApi
@TestApi
public class SocketUtils {
public final class SocketUtils {
    /**
     * Create a raw datagram socket that is bound to an interface.
     *
@@ -63,6 +63,7 @@ public class SocketUtils {
    /**
     * Make a socket address to communicate with netlink.
     */
    @NonNull
    public static SocketAddress makeNetlinkSocketAddress(int portId, int groupsMask) {
        return new NetlinkSocketAddress(portId, groupsMask);
    }
@@ -70,13 +71,15 @@ public class SocketUtils {
    /**
     * Make socket address that packet sockets can bind to.
     */
    public static SocketAddress makePacketSocketAddress(short protocol, int ifIndex) {
        return new PacketSocketAddress(protocol, ifIndex);
    @NonNull
    public static SocketAddress makePacketSocketAddress(int protocol, int ifIndex) {
        return new PacketSocketAddress((short) protocol, ifIndex);
    }

    /**
     * Make a socket address that packet socket can send packets to.
     */
    @NonNull
    public static SocketAddress makePacketSocketAddress(int ifIndex, @NonNull byte[] hwAddr) {
        return new PacketSocketAddress(ifIndex, hwAddr);
    }