Add method to get socket cookie from socket FileDescriptor

aosp/3502915 use this method from ConnectivityService to get socket
cookie that is required for closing QUIC connection.

Bug: 311792075
Test: m, boot
Change-Id: I17d8a4dd24cfb84e9b008b8eb87eedec67b29020
This commit is contained in:
Motomu Utsumi 2025-02-20 11:57:39 +09:00 • committed by Maciej Żenczykowski
commit b9b8828bf5

View file

@ -443,4 +443,13 @@ public class NetworkUtils {
/** Returns whether the Linux Kernel is x86 */
public static native boolean isKernelX86();
/**
* Returns socket cookie.
*
* @param fd The socket file descriptor
* @return The socket cookie.
* @throws ErrnoException if retrieving the socket cookie fails.
*/
public static native long getSocketCookie(FileDescriptor fd) throws ErrnoException;
}