diff options
| author | 2019-04-04 16:12:51 +0900 | |
|---|---|---|
| committer | 2019-04-04 18:02:49 +0900 | |
| commit | fecb63075b566a3314ab64e70484119f1612745f (patch) | |
| tree | b1dfac7e02074c8e7453e8e5ae9a95aa18a67e68 | |
| parent | 8dedf2b5e48637f4cb9dce0e1466ae49ca265d73 (diff) | |
Remove SocketUtils#setSocketTimeValueOption
This API was added in Q but is not necessary anymore as
Os#setsockoptTimeval was exposed as public API.
Test: m
Fixes: 129433363
Change-Id: Ifd04c0314f7f7c0dbd0ed89dbaf69b9c152d3330
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | api/test-current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/net/util/SocketUtils.java | 9 | ||||
| -rw-r--r-- | services/net/java/android/net/netlink/NetlinkSocket.java | 5 |
4 files changed, 3 insertions, 13 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 373ff18aa382..e4c10269f109 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -3497,7 +3497,6 @@ package android.net.util { 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; } } diff --git a/api/test-current.txt b/api/test-current.txt index 3c7e7610d483..50a9158df8bd 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -916,7 +916,6 @@ package android.net.util { 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; } } diff --git a/core/java/android/net/util/SocketUtils.java b/core/java/android/net/util/SocketUtils.java index 6f8aece848f8..2b9ec540dccd 100644 --- a/core/java/android/net/util/SocketUtils.java +++ b/core/java/android/net/util/SocketUtils.java @@ -29,7 +29,6 @@ import android.system.ErrnoException; import android.system.NetlinkSocketAddress; import android.system.Os; import android.system.PacketSocketAddress; -import android.system.StructTimeval; import libcore.io.IoBridge; @@ -85,14 +84,6 @@ public final class SocketUtils { } /** - * Set an option on a socket that takes a time value argument. - */ - public static void setSocketTimeValueOption( - @NonNull FileDescriptor fd, int level, int option, long millis) throws ErrnoException { - Os.setsockoptTimeval(fd, level, option, StructTimeval.fromMillis(millis)); - } - - /** * @see IoBridge#closeAndSignalBlockedThreads(FileDescriptor) */ public static void closeSocket(@Nullable FileDescriptor fd) throws IOException { diff --git a/services/net/java/android/net/netlink/NetlinkSocket.java b/services/net/java/android/net/netlink/NetlinkSocket.java index 4240d240ca23..7311fc537205 100644 --- a/services/net/java/android/net/netlink/NetlinkSocket.java +++ b/services/net/java/android/net/netlink/NetlinkSocket.java @@ -30,6 +30,7 @@ import static android.system.OsConstants.SO_SNDTIMEO; import android.net.util.SocketUtils; import android.system.ErrnoException; import android.system.Os; +import android.system.StructTimeval; import android.util.Log; import java.io.FileDescriptor; @@ -128,7 +129,7 @@ public class NetlinkSocket { throws ErrnoException, IllegalArgumentException, InterruptedIOException { checkTimeout(timeoutMs); - SocketUtils.setSocketTimeValueOption(fd, SOL_SOCKET, SO_RCVTIMEO, timeoutMs); + Os.setsockoptTimeval(fd, SOL_SOCKET, SO_RCVTIMEO, StructTimeval.fromMillis(timeoutMs)); ByteBuffer byteBuffer = ByteBuffer.allocate(bufsize); int length = Os.read(fd, byteBuffer); @@ -151,7 +152,7 @@ public class NetlinkSocket { FileDescriptor fd, byte[] bytes, int offset, int count, long timeoutMs) throws ErrnoException, IllegalArgumentException, InterruptedIOException { checkTimeout(timeoutMs); - SocketUtils.setSocketTimeValueOption(fd, SOL_SOCKET, SO_SNDTIMEO, timeoutMs); + Os.setsockoptTimeval(fd, SOL_SOCKET, SO_SNDTIMEO, StructTimeval.fromMillis(timeoutMs)); return Os.write(fd, bytes, offset, count); } } |