compat/src/main/java/androidx/core/net/TrafficStatsCompat.java
public static void untagDatagramSocket(@NonNull DatagramSocket socket) throws SocketException {
        if (Build.VERSION.SDK_INT >= 24) {
            TrafficStats.untagDatagramSocket(socket);
        } else {
            final ParcelFileDescriptor pfd = ParcelFileDescriptor.fromDatagramSocket(socket);
            TrafficStats.untagSocket(new DatagramSocketWrapper(socket, pfd.getFileDescriptor()));
            // The developer is still using the FD, so we need to detach it to
            // prevent the PFD finalizer from closing it in their face. We had to
            // wait until after the tagging call above, since detaching clears out
            // the getFileDescriptor() result which tagging depends on.
            pfd.detachFd();
        }
    }
/**
     * Remove any statistics parameters from the given {@link DatagramSocket}.
     */
Remove any statistics parameters from the given  DatagramSocket.
Remove any statistics parameters from the given DatagramSocket .
public static void untagDatagramSocket(@NonNull DatagramSocket socket) throws SocketException {
        if (Build.VERSION.SDK_INT >= 24) {
            TrafficStats.untagDatagramSocket(socket);
        } else {
            final ParcelFileDescriptor pfd = ParcelFileDescriptor.fromDatagramSocket(socket);
            TrafficStats.untagSocket(new DatagramSocketWrapper(socket, pfd.getFileDescriptor()));
            pfd.detachFd();
        }
    }
public static void untagDatagramSocket ( @ NonNull DatagramSocket socket ) throws SocketException { if ( Build . VERSION . SDK_INT >= 24 ) { TrafficStats . untagDatagramSocket ( socket ) ; } else { final ParcelFileDescriptor pfd = ParcelFileDescriptor . fromDatagramSocket ( socket ) ; TrafficStats . untagSocket ( new DatagramSocketWrapper ( socket , pfd . getFileDescriptor ( ) ) ) ; pfd . detachFd ( ) ; } }
Remove any statistics parameters from the given {@link DatagramSocket}.
Remove any statistics parameters from the given { @link DatagramSocket } .
// The developer is still using the FD, so we need to detach it to // prevent the PFD finalizer from closing it in their face. We had to // wait until after the tagging call above, since detaching clears out // the getFileDescriptor() result which tagging depends on.