Loading core/java/android/bluetooth/BluetoothSocket.java +5 −5 Original line number Diff line number Diff line Loading @@ -243,7 +243,7 @@ public final class BluetoothSocket implements Closeable { } as.mPfd = new ParcelFileDescriptor(fds[0]); as.mSocket = new LocalSocket(fds[0]); as.mSocket = LocalSocket.createConnectedLocalSocket(fds[0]); as.mSocketIS = as.mSocket.getInputStream(); as.mSocketOS = as.mSocket.getOutputStream(); as.mAddress = RemoteAddr; Loading Loading @@ -367,7 +367,7 @@ public final class BluetoothSocket implements Closeable { if (mSocketState == SocketState.CLOSED) throw new IOException("socket closed"); if (mPfd == null) throw new IOException("bt socket connect failed"); FileDescriptor fd = mPfd.getFileDescriptor(); mSocket = new LocalSocket(fd); mSocket = LocalSocket.createConnectedLocalSocket(fd); mSocketIS = mSocket.getInputStream(); mSocketOS = mSocket.getOutputStream(); } Loading Loading @@ -416,8 +416,8 @@ public final class BluetoothSocket implements Closeable { if(mSocketState != SocketState.INIT) return EBADFD; if(mPfd == null) return -1; FileDescriptor fd = mPfd.getFileDescriptor(); if (DBG) Log.d(TAG, "bindListen(), new LocalSocket "); mSocket = new LocalSocket(fd); if (DBG) Log.d(TAG, "bindListen(), Create LocalSocket"); mSocket = LocalSocket.createConnectedLocalSocket(fd); if (DBG) Log.d(TAG, "bindListen(), new LocalSocket.getInputStream()"); mSocketIS = mSocket.getInputStream(); mSocketOS = mSocket.getOutputStream(); Loading core/java/android/net/LocalServerSocket.java +1 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ public class LocalServerSocket { impl.accept(acceptedImpl); return LocalSocket.createLocalSocketForAccept(acceptedImpl, LocalSocket.SOCKET_UNKNOWN); return LocalSocket.createLocalSocketForAccept(acceptedImpl); } /** Loading core/java/android/net/LocalSocket.java +20 −14 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import java.net.SocketOptions; public class LocalSocket implements Closeable { private final LocalSocketImpl impl; /** false if impl.create() needs to be called */ private volatile boolean implCreated; private LocalSocketAddress localAddress; private boolean isBound; Loading Loading @@ -61,19 +62,6 @@ public class LocalSocket implements Closeable { */ public LocalSocket(int sockType) { this(new LocalSocketImpl(), sockType); isBound = false; isConnected = false; } /** * Creates a AF_LOCAL/UNIX domain stream socket with FileDescriptor. * @hide */ public LocalSocket(FileDescriptor fd) throws IOException { this(new LocalSocketImpl(fd), SOCKET_UNKNOWN); isBound = true; isConnected = true; implCreated = true; } private LocalSocket(LocalSocketImpl impl, int sockType) { Loading @@ -83,10 +71,28 @@ public class LocalSocket implements Closeable { this.isBound = false; } /** * Creates a LocalSocket instances using the FileDescriptor for an already-connected * AF_LOCAL/UNIX domain stream socket. Note: the FileDescriptor must be closed by the caller: * closing the LocalSocket will not close it. * * @hide - used by BluetoothSocket. */ public static LocalSocket createConnectedLocalSocket(FileDescriptor fd) { return createConnectedLocalSocket(new LocalSocketImpl(fd), SOCKET_UNKNOWN); } /** * for use with LocalServerSocket.accept() */ static LocalSocket createLocalSocketForAccept(LocalSocketImpl impl, int sockType) { static LocalSocket createLocalSocketForAccept(LocalSocketImpl impl) { return createConnectedLocalSocket(impl, SOCKET_UNKNOWN); } /** * Creates a LocalSocket from an existing LocalSocketImpl that is already connected. */ private static LocalSocket createConnectedLocalSocket(LocalSocketImpl impl, int sockType) { LocalSocket socket = new LocalSocket(impl, sockType); socket.isConnected = true; socket.isBound = true; Loading core/java/android/net/LocalSocketImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -218,7 +218,7 @@ class LocalSocketImpl * * @param fd non-null; bound file descriptor */ /*package*/ LocalSocketImpl(FileDescriptor fd) throws IOException /*package*/ LocalSocketImpl(FileDescriptor fd) { this.fd = fd; } Loading Loading
core/java/android/bluetooth/BluetoothSocket.java +5 −5 Original line number Diff line number Diff line Loading @@ -243,7 +243,7 @@ public final class BluetoothSocket implements Closeable { } as.mPfd = new ParcelFileDescriptor(fds[0]); as.mSocket = new LocalSocket(fds[0]); as.mSocket = LocalSocket.createConnectedLocalSocket(fds[0]); as.mSocketIS = as.mSocket.getInputStream(); as.mSocketOS = as.mSocket.getOutputStream(); as.mAddress = RemoteAddr; Loading Loading @@ -367,7 +367,7 @@ public final class BluetoothSocket implements Closeable { if (mSocketState == SocketState.CLOSED) throw new IOException("socket closed"); if (mPfd == null) throw new IOException("bt socket connect failed"); FileDescriptor fd = mPfd.getFileDescriptor(); mSocket = new LocalSocket(fd); mSocket = LocalSocket.createConnectedLocalSocket(fd); mSocketIS = mSocket.getInputStream(); mSocketOS = mSocket.getOutputStream(); } Loading Loading @@ -416,8 +416,8 @@ public final class BluetoothSocket implements Closeable { if(mSocketState != SocketState.INIT) return EBADFD; if(mPfd == null) return -1; FileDescriptor fd = mPfd.getFileDescriptor(); if (DBG) Log.d(TAG, "bindListen(), new LocalSocket "); mSocket = new LocalSocket(fd); if (DBG) Log.d(TAG, "bindListen(), Create LocalSocket"); mSocket = LocalSocket.createConnectedLocalSocket(fd); if (DBG) Log.d(TAG, "bindListen(), new LocalSocket.getInputStream()"); mSocketIS = mSocket.getInputStream(); mSocketOS = mSocket.getOutputStream(); Loading
core/java/android/net/LocalServerSocket.java +1 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ public class LocalServerSocket { impl.accept(acceptedImpl); return LocalSocket.createLocalSocketForAccept(acceptedImpl, LocalSocket.SOCKET_UNKNOWN); return LocalSocket.createLocalSocketForAccept(acceptedImpl); } /** Loading
core/java/android/net/LocalSocket.java +20 −14 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import java.net.SocketOptions; public class LocalSocket implements Closeable { private final LocalSocketImpl impl; /** false if impl.create() needs to be called */ private volatile boolean implCreated; private LocalSocketAddress localAddress; private boolean isBound; Loading Loading @@ -61,19 +62,6 @@ public class LocalSocket implements Closeable { */ public LocalSocket(int sockType) { this(new LocalSocketImpl(), sockType); isBound = false; isConnected = false; } /** * Creates a AF_LOCAL/UNIX domain stream socket with FileDescriptor. * @hide */ public LocalSocket(FileDescriptor fd) throws IOException { this(new LocalSocketImpl(fd), SOCKET_UNKNOWN); isBound = true; isConnected = true; implCreated = true; } private LocalSocket(LocalSocketImpl impl, int sockType) { Loading @@ -83,10 +71,28 @@ public class LocalSocket implements Closeable { this.isBound = false; } /** * Creates a LocalSocket instances using the FileDescriptor for an already-connected * AF_LOCAL/UNIX domain stream socket. Note: the FileDescriptor must be closed by the caller: * closing the LocalSocket will not close it. * * @hide - used by BluetoothSocket. */ public static LocalSocket createConnectedLocalSocket(FileDescriptor fd) { return createConnectedLocalSocket(new LocalSocketImpl(fd), SOCKET_UNKNOWN); } /** * for use with LocalServerSocket.accept() */ static LocalSocket createLocalSocketForAccept(LocalSocketImpl impl, int sockType) { static LocalSocket createLocalSocketForAccept(LocalSocketImpl impl) { return createConnectedLocalSocket(impl, SOCKET_UNKNOWN); } /** * Creates a LocalSocket from an existing LocalSocketImpl that is already connected. */ private static LocalSocket createConnectedLocalSocket(LocalSocketImpl impl, int sockType) { LocalSocket socket = new LocalSocket(impl, sockType); socket.isConnected = true; socket.isBound = true; Loading
core/java/android/net/LocalSocketImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -218,7 +218,7 @@ class LocalSocketImpl * * @param fd non-null; bound file descriptor */ /*package*/ LocalSocketImpl(FileDescriptor fd) throws IOException /*package*/ LocalSocketImpl(FileDescriptor fd) { this.fd = fd; } Loading