Fix BluetoothSocket file descriptor leak

Sockets accepted on a server socket didn't populate
the mPfd field, which is used to close out the java
end of the native-and-java communication socket when
the overall rfcomm socket is closed. #badnewsbears

b/21398841

Change-Id: I3adb0a9965f83d0f3006fa4f79ea4abeab5c9a17
This commit is contained in:
Zach Johnson
2015-07-13 18:00:35 -07:00
committed by Sharvil Nanavati
parent c3d69a798e
commit 7bcb9597c8

View File

@@ -191,6 +191,8 @@ public final class BluetoothSocket implements Closeable {
as.close();
throw new IOException("bt socket acept failed");
}
as.mPfd = new ParcelFileDescriptor(fds[0]);
as.mSocket = new LocalSocket(fds[0]);
as.mSocketIS = as.mSocket.getInputStream();
as.mSocketOS = as.mSocket.getOutputStream();