From 99a1d450da406e3377495b272b47a5d0d29a5a06 Mon Sep 17 00:00:00 2001 From: Tobias Thierer Date: Mon, 30 Oct 2017 20:21:38 +0000 Subject: Track deprecation/replacement of Os methods that depend on Mutable* Another CL in this CL topic is deprecating/removing three methods in android.system.Os, and introducing replacements. This CL tracks that change by updating frameworks/base accordingly. Test: Treehugger Bug: 67901714 Change-Id: I96ad205a305801b2cb641ba8984810dfe6474032 --- api/current.txt | 16 ++++++++++++++-- api/system-current.txt | 16 ++++++++++++++-- api/test-current.txt | 16 ++++++++++++++-- core/java/android/net/LocalSocketImpl.java | 18 +++++++++--------- 4 files changed, 51 insertions(+), 15 deletions(-) diff --git a/api/current.txt b/api/current.txt index d43dcb893ef2..376509223f06 100644 --- a/api/current.txt +++ b/api/current.txt @@ -38005,6 +38005,16 @@ package android.system { field public final int errno; } + public class Int32Ref { + ctor public Int32Ref(int); + field public int value; + } + + public class Int64Ref { + ctor public Int64Ref(long); + field public long value; + } + public final class Os { method public static java.io.FileDescriptor accept(java.io.FileDescriptor, java.net.InetSocketAddress) throws android.system.ErrnoException, java.net.SocketException; method public static boolean access(java.lang.String, int) throws android.system.ErrnoException; @@ -38074,7 +38084,8 @@ package android.system { method public static void remove(java.lang.String) throws android.system.ErrnoException; method public static void removexattr(java.lang.String, java.lang.String) throws android.system.ErrnoException; method public static void rename(java.lang.String, java.lang.String) throws android.system.ErrnoException; - method public static long sendfile(java.io.FileDescriptor, java.io.FileDescriptor, android.util.MutableLong, long) throws android.system.ErrnoException; + method public static deprecated long sendfile(java.io.FileDescriptor, java.io.FileDescriptor, android.util.MutableLong, long) throws android.system.ErrnoException; + method public static long sendfile(java.io.FileDescriptor, java.io.FileDescriptor, android.system.Int64Ref, long) throws android.system.ErrnoException; method public static int sendto(java.io.FileDescriptor, java.nio.ByteBuffer, int, java.net.InetAddress, int) throws android.system.ErrnoException, java.net.SocketException; method public static int sendto(java.io.FileDescriptor, byte[], int, int, int, java.net.InetAddress, int) throws android.system.ErrnoException, java.net.SocketException; method public static void setegid(int) throws android.system.ErrnoException; @@ -38099,7 +38110,8 @@ package android.system { method public static int umask(int); method public static android.system.StructUtsname uname(); method public static void unsetenv(java.lang.String) throws android.system.ErrnoException; - method public static int waitpid(int, android.util.MutableInt, int) throws android.system.ErrnoException; + method public static deprecated int waitpid(int, android.util.MutableInt, int) throws android.system.ErrnoException; + method public static int waitpid(int, android.system.Int32Ref, int) throws android.system.ErrnoException; method public static int write(java.io.FileDescriptor, java.nio.ByteBuffer) throws android.system.ErrnoException, java.io.InterruptedIOException; method public static int write(java.io.FileDescriptor, byte[], int, int) throws android.system.ErrnoException, java.io.InterruptedIOException; method public static int writev(java.io.FileDescriptor, java.lang.Object[], int[], int[]) throws android.system.ErrnoException, java.io.InterruptedIOException; diff --git a/api/system-current.txt b/api/system-current.txt index 8f19a687c34d..9b9df3c3eef1 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -41219,6 +41219,16 @@ package android.system { field public final int errno; } + public class Int32Ref { + ctor public Int32Ref(int); + field public int value; + } + + public class Int64Ref { + ctor public Int64Ref(long); + field public long value; + } + public final class Os { method public static java.io.FileDescriptor accept(java.io.FileDescriptor, java.net.InetSocketAddress) throws android.system.ErrnoException, java.net.SocketException; method public static boolean access(java.lang.String, int) throws android.system.ErrnoException; @@ -41288,7 +41298,8 @@ package android.system { method public static void remove(java.lang.String) throws android.system.ErrnoException; method public static void removexattr(java.lang.String, java.lang.String) throws android.system.ErrnoException; method public static void rename(java.lang.String, java.lang.String) throws android.system.ErrnoException; - method public static long sendfile(java.io.FileDescriptor, java.io.FileDescriptor, android.util.MutableLong, long) throws android.system.ErrnoException; + method public static deprecated long sendfile(java.io.FileDescriptor, java.io.FileDescriptor, android.util.MutableLong, long) throws android.system.ErrnoException; + method public static long sendfile(java.io.FileDescriptor, java.io.FileDescriptor, android.system.Int64Ref, long) throws android.system.ErrnoException; method public static int sendto(java.io.FileDescriptor, java.nio.ByteBuffer, int, java.net.InetAddress, int) throws android.system.ErrnoException, java.net.SocketException; method public static int sendto(java.io.FileDescriptor, byte[], int, int, int, java.net.InetAddress, int) throws android.system.ErrnoException, java.net.SocketException; method public static void setegid(int) throws android.system.ErrnoException; @@ -41313,7 +41324,8 @@ package android.system { method public static int umask(int); method public static android.system.StructUtsname uname(); method public static void unsetenv(java.lang.String) throws android.system.ErrnoException; - method public static int waitpid(int, android.util.MutableInt, int) throws android.system.ErrnoException; + method public static deprecated int waitpid(int, android.util.MutableInt, int) throws android.system.ErrnoException; + method public static int waitpid(int, android.system.Int32Ref, int) throws android.system.ErrnoException; method public static int write(java.io.FileDescriptor, java.nio.ByteBuffer) throws android.system.ErrnoException, java.io.InterruptedIOException; method public static int write(java.io.FileDescriptor, byte[], int, int) throws android.system.ErrnoException, java.io.InterruptedIOException; method public static int writev(java.io.FileDescriptor, java.lang.Object[], int[], int[]) throws android.system.ErrnoException, java.io.InterruptedIOException; diff --git a/api/test-current.txt b/api/test-current.txt index 9280e04d3287..07b860f3768f 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -38212,6 +38212,16 @@ package android.system { field public final int errno; } + public class Int32Ref { + ctor public Int32Ref(int); + field public int value; + } + + public class Int64Ref { + ctor public Int64Ref(long); + field public long value; + } + public final class Os { method public static java.io.FileDescriptor accept(java.io.FileDescriptor, java.net.InetSocketAddress) throws android.system.ErrnoException, java.net.SocketException; method public static boolean access(java.lang.String, int) throws android.system.ErrnoException; @@ -38281,7 +38291,8 @@ package android.system { method public static void remove(java.lang.String) throws android.system.ErrnoException; method public static void removexattr(java.lang.String, java.lang.String) throws android.system.ErrnoException; method public static void rename(java.lang.String, java.lang.String) throws android.system.ErrnoException; - method public static long sendfile(java.io.FileDescriptor, java.io.FileDescriptor, android.util.MutableLong, long) throws android.system.ErrnoException; + method public static deprecated long sendfile(java.io.FileDescriptor, java.io.FileDescriptor, android.util.MutableLong, long) throws android.system.ErrnoException; + method public static long sendfile(java.io.FileDescriptor, java.io.FileDescriptor, android.system.Int64Ref, long) throws android.system.ErrnoException; method public static int sendto(java.io.FileDescriptor, java.nio.ByteBuffer, int, java.net.InetAddress, int) throws android.system.ErrnoException, java.net.SocketException; method public static int sendto(java.io.FileDescriptor, byte[], int, int, int, java.net.InetAddress, int) throws android.system.ErrnoException, java.net.SocketException; method public static void setegid(int) throws android.system.ErrnoException; @@ -38306,7 +38317,8 @@ package android.system { method public static int umask(int); method public static android.system.StructUtsname uname(); method public static void unsetenv(java.lang.String) throws android.system.ErrnoException; - method public static int waitpid(int, android.util.MutableInt, int) throws android.system.ErrnoException; + method public static deprecated int waitpid(int, android.util.MutableInt, int) throws android.system.ErrnoException; + method public static int waitpid(int, android.system.Int32Ref, int) throws android.system.ErrnoException; method public static int write(java.io.FileDescriptor, java.nio.ByteBuffer) throws android.system.ErrnoException, java.io.InterruptedIOException; method public static int write(java.io.FileDescriptor, byte[], int, int) throws android.system.ErrnoException, java.io.InterruptedIOException; method public static int writev(java.io.FileDescriptor, java.lang.Object[], int[], int[]) throws android.system.ErrnoException, java.io.InterruptedIOException; diff --git a/core/java/android/net/LocalSocketImpl.java b/core/java/android/net/LocalSocketImpl.java index 05c8afb358b0..6e4a231bcd55 100644 --- a/core/java/android/net/LocalSocketImpl.java +++ b/core/java/android/net/LocalSocketImpl.java @@ -16,18 +16,18 @@ package android.net; -import java.io.IOException; -import java.io.OutputStream; -import java.io.InputStream; -import java.io.FileDescriptor; -import java.net.SocketOptions; - import android.system.ErrnoException; +import android.system.Int32Ref; import android.system.Os; import android.system.OsConstants; import android.system.StructLinger; import android.system.StructTimeval; -import android.util.MutableInt; + +import java.io.FileDescriptor; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.SocketOptions; /** * Socket implementation used for android.net.LocalSocket and @@ -62,7 +62,7 @@ class LocalSocketImpl FileDescriptor myFd = fd; if (myFd == null) throw new IOException("socket closed"); - MutableInt avail = new MutableInt(0); + Int32Ref avail = new Int32Ref(0); try { Os.ioctlInt(myFd, OsConstants.FIONREAD, avail); } catch (ErrnoException e) { @@ -167,7 +167,7 @@ class LocalSocketImpl if (myFd == null) throw new IOException("socket closed"); // Loop until the output buffer is empty. - MutableInt pending = new MutableInt(0); + Int32Ref pending = new Int32Ref(0); while (true) { try { // See linux/net/unix/af_unix.c -- cgit v1.2.3-59-g8ed1b