Loading core/java/android/bluetooth/BluetoothSocket.java +5 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,11 @@ public final class BluetoothSocket implements Closeable { throw new IOException("bt socket acept failed"); } as.mSocket = new LocalSocket(fds[0]); try { as.mSocket.closeExternalFd(); } catch (IOException e) { Log.e(TAG, "closeExternalFd failed"); } as.mSocketIS = as.mSocket.getInputStream(); as.mSocketOS = as.mSocket.getOutputStream(); as.mAddress = RemoteAddr; Loading core/java/android/net/LocalSocket.java +13 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,19 @@ public class LocalSocket implements Closeable { return impl.getOutputStream(); } /** * Set the flag to close the fd whcih was opened * externally * * @return none * @throws IOException if socket has been closed * @hide */ public void closeExternalFd() throws IOException { implCreateIfNeeded(); impl.closeExternalFd(); } /** * Closes the socket. * Loading core/java/android/net/LocalSocketImpl.java +19 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,8 @@ class LocalSocketImpl /** whether fd is created internally */ private boolean mFdCreatedInternally; private boolean mFdCreatedExternally = false; // These fields are accessed by native code; /** file descriptor array received during a previous read */ FileDescriptor[] inboundFileDescriptors; Loading Loading @@ -263,7 +265,8 @@ class LocalSocketImpl */ public void close() throws IOException { synchronized (LocalSocketImpl.this) { if ((fd == null) || (mFdCreatedInternally == false)) { if ((fd == null) || ((mFdCreatedInternally == false) && (mFdCreatedExternally == false))) { fd = null; return; } Loading Loading @@ -371,6 +374,21 @@ class LocalSocketImpl } } /** * Set the flag to close the fd which was opened * externally. * * @return none * @throws IOException if socket has been closed */ protected void closeExternalFd() throws IOException { if (fd == null) { throw new IOException("socket not created"); } mFdCreatedExternally = true; } /** * Returns the number of bytes available for reading without blocking. * Loading Loading
core/java/android/bluetooth/BluetoothSocket.java +5 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,11 @@ public final class BluetoothSocket implements Closeable { throw new IOException("bt socket acept failed"); } as.mSocket = new LocalSocket(fds[0]); try { as.mSocket.closeExternalFd(); } catch (IOException e) { Log.e(TAG, "closeExternalFd failed"); } as.mSocketIS = as.mSocket.getInputStream(); as.mSocketOS = as.mSocket.getOutputStream(); as.mAddress = RemoteAddr; Loading
core/java/android/net/LocalSocket.java +13 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,19 @@ public class LocalSocket implements Closeable { return impl.getOutputStream(); } /** * Set the flag to close the fd whcih was opened * externally * * @return none * @throws IOException if socket has been closed * @hide */ public void closeExternalFd() throws IOException { implCreateIfNeeded(); impl.closeExternalFd(); } /** * Closes the socket. * Loading
core/java/android/net/LocalSocketImpl.java +19 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,8 @@ class LocalSocketImpl /** whether fd is created internally */ private boolean mFdCreatedInternally; private boolean mFdCreatedExternally = false; // These fields are accessed by native code; /** file descriptor array received during a previous read */ FileDescriptor[] inboundFileDescriptors; Loading Loading @@ -263,7 +265,8 @@ class LocalSocketImpl */ public void close() throws IOException { synchronized (LocalSocketImpl.this) { if ((fd == null) || (mFdCreatedInternally == false)) { if ((fd == null) || ((mFdCreatedInternally == false) && (mFdCreatedExternally == false))) { fd = null; return; } Loading Loading @@ -371,6 +374,21 @@ class LocalSocketImpl } } /** * Set the flag to close the fd which was opened * externally. * * @return none * @throws IOException if socket has been closed */ protected void closeExternalFd() throws IOException { if (fd == null) { throw new IOException("socket not created"); } mFdCreatedExternally = true; } /** * Returns the number of bytes available for reading without blocking. * Loading