History log of /frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
569ff225a3879363bb31548a664161fee5270a0d 14-Jul-2015 Zach Johnson <zachoverflow@google.com> 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
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
3b3d1fea94318a4892fbd4353269749af417a81a 08-May-2015 Casper Bonde <c.bonde@samsung.com> SAP: Make it possible to enforce a 16-digit pin code (4/5)

This change enable the posibility to enforce using a
16-digit pin or MITM for a RFCOMM or L2CAP connection.

This is needed for the SIM access profile.

Change-Id: I3205013f9e758c353381442a86845dab467780f8
Signed-off-by: Casper Bonde <c.bonde@samsung.com>
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
2328423d19416da0c1068883c33e612d5729fc47 21-Apr-2015 Casper Bonde <c.bonde@samsung.com> Add support for MITM for BluetoothSockets (1/4)

This change adds an option to enforce Man-in-the-middle protection
for the authentication process. This feature is needed for the Sim
Access Profile.

Change-Id: Ia3ef0caeb750f88608c9fa6bf6367d1c77de4cf3
Signed-off-by: Casper Bonde <c.bonde@samsung.com>
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
f455986a45328614c8dd07a4d60a30b9ddc3d994 04-May-2015 Andre Eisenbach <eisenbach@google.com> Add documentation for BluetoothSocket.getConnectionType()

Bug: 20824264
Change-Id: I58aa8f5bbe08ddb252f01f4ad187ae8741963f0b
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
238e0f934f1f47263b384bc745ae0678c777130d 09-Apr-2015 Casper Bonde <c.bonde@samsung.com> OBEX Over L2CAP + SDP search API for BT profiles

- Updated OBEX to support SRM
- Added support for OBEX over l2cap and SRM.
- Minor bugfixes, and reduce CPU load ALOT
- Added support to send responses without body data.
- Extend BluetoothSocket to support L2CAP
- Added functionality to get the channel number
needed to be able to create an SDP record with the channel number.
- Added interface to get socket type and max packet sizes.
- Added interface to perform SDP search and get the resulting
SDP record data.

Change-Id: I9d37a00ce73dfffc0e3ce03eab5511ba3a86e5b8
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
726652e9d3f1adf6b68dedfa4618b490b7f1b4a3 03-Sep-2014 Matthew Xie <mattx@google.com> Close the base socket when bindListen fails

Bug: 10773872
Change-Id: I0a72b2eb65055fa1959070d2dc32d40a573bd6f2
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
a0fc1b37302a82119ebc30262d881c2673b63868 17-May-2014 Joe LaPenna <jlapenna@google.com> am 3e1bbaf7: am 45734b4a: Merge "Log accept and close debug statements in BluetoothSocket." into klp-modular-dev

* commit '3e1bbaf786c12e66624c42c13a58095bc8133117':
Log accept and close debug statements in BluetoothSocket.
f3de98a2d09e2e84c0ca0eb55ab7cf7d943135d1 14-May-2014 Joe LaPenna <jlapenna@google.com> Log accept and close debug statements in BluetoothSocket.

Bug: 14902781
Bug: 14784262

Change-Id: Id0c2cd216244e05c218568427bda863a538b1041
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
3e8eb40950f4d02322ded64503314b7db2bf9825 08-Apr-2014 Sharvil Nanavati <sharvil@google.com> Make sure BluetoothSocket#connect throws on error.

It sometimes fails silently, resulting in callers using the socket
even though it hasn't been initialized.

http://b/13909270

Change-Id: Ied08982b51d44c3d2dec72785888ea6c6497a664
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
01771021e38f9dedce7910c81fea26a9bf837d9d 20-Jan-2014 Zhihai Xu <zhihaixu@google.com> bluetoothsocket fd leak, need close the file descriptor after detachFd.

Perform ParcelFileDescriptor close after detach to avoid bluetooth
socket leaks in strict mode.

bug:12647433
Change-Id: I22f422547b2fb33b9bf12065dc689ed7785a7269
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
82e95573c7348e3c5f7946b8c8d727f14047ca12 17-Dec-2013 Zhihai Xu <zhihaixu@google.com> NPE in BluetoothSocket.write()

If calling connect succeed, we should not see this NPE.
An IOException may happen after call BluetoothSocket.connect.
If you still call write after the IOException,
you will get this NPE.
add NPE protection for possible wrong calling sequence from application,
To make bluetoothSocket more error-tolerant.

bug:12104154
Change-Id: I7fa4e847b500ca9b9d2a43df432f31a1bb016c0a
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
2208e652d6881bb8747cb50d87d98a679d7c0e07 04-Jan-2014 Zhihai Xu <zhihaixu@google.com> Merge "NPE in BluetoothSocket.write()"
610770d7129a33fdca5c23939f9ee0a80d0322f9 17-Dec-2013 Zhihai Xu <zhihaixu@google.com> NPE in BluetoothSocket.write()

If calling connect succeed, we should not see this NPE.
An IOException may happen after call BluetoothSocket.connect.
If you still call write after the IOException,
you will get this NPE.
add NPE protection for possible wrong calling sequence from application,
To make bluetoothSocket more error-tolerant.

bug:12104154
Change-Id: I7fa4e847b500ca9b9d2a43df432f31a1bb016c0a
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
6090995951c6e2e4dcf38102f01793f8a94166e1 19-Nov-2013 John Spurlock <jspurlock@google.com> Remove unused imports from frameworks/base.

Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
68c692df5f667dcee42506d3c6459d3dc2e1cdd6 02-Oct-2013 Mike Lockwood <lockwood@google.com> Revert "Allow L2CAP sockets"

This reverts commit 34b0f926135b4697f091b3b39bfca8c70512af6c.
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
34b0f926135b4697f091b3b39bfca8c70512af6c 10-Aug-2013 Dmitry Grinberg <dmitrygr@google.com> Allow L2CAP sockets

Change-Id: Icb498e6c0430789b6168bec3beb1d4650e4f1238
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
560a523159c3320d8838d6ec1a2503f91bc7cad5 26-Jul-2013 Zhihai Xu <zhihaixu@google.com> Revert "Bluetooth stopped working in master - "bad file descriptor""

This reverts commit df3cedab6fce59ce1dde4316bf63df7f7e488e23.

Change-Id: I9ffaf5580924c150145d37ec38ffde602199b7e2
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
df3cedab6fce59ce1dde4316bf63df7f7e488e23 25-Jul-2013 Zhihai Xu <zhihaixu@google.com> Bluetooth stopped working in master - "bad file descriptor"

ignore IllegalArgumentException in BluetoothSocket.close().

bug: 9960585
Change-Id: I301aa388b738dcb92b643fdd96b5c9cb6f8b3efe
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
fea17de7aaa5729d3111102b2734b158403d2780 11-Jun-2013 Jeff Sharkey <jsharkey@android.com> Explicit locale when formatting machine strings.

Bug: 9390451
Change-Id: I3581c53407554a1dffd541fb42b06d68f20a7be0
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
71bfafc84af4b820748b12e1a1010b0dfa7bdea6 17-Apr-2013 zzy <zhenye@broadcom.com> Added flush() for bluetooth output stream

Bug 8498784

Zebra QL420 Plus Bluetooth printer fails on Android 4.2.2
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
d77982ef29b2d3b5de42846ba308fc9f880938a2 30-Nov-2012 Matthew Xie <mattx@google.com> Clean up debug messages

bug 7626174

Change-Id: I65cdcaf2c48a78468b6cef0b8591289435068b24
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
652678af4d18b9a6c18ce6a860de01d958bc82fe 22-Nov-2012 zzy <zhenye@broadcom.com> timeout support for accept() and added check for signal size

bug 7592240

Change-Id: Ide1868da669c190cdfed90f7af3f739ec9da690b
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
fa0fd39a4bf296d254aa398c1b19ec960efa641d 24-Oct-2012 Zhihai Xu <zhihaixu@google.com> License of files Bluetooth package is not updated to ASL2

bug 7385618

Change-Id: I6232f537f4fda979d3aabe3a059c11d3299de9b8
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
b49a89635906e0901637a4a4c1c2f5bb263b6595 11-Oct-2012 zzy <zhenye@broadcom.com> Add serial port profile support and allow to connect to rfcomm channel without sdp discovery

bug 7272974

Change-Id: Idc10edc056b48da2fd96bea84eba3fb73b97bab1
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
563e414784eb81e4ea4051667d5c8855b17f7534 10-Oct-2012 Matthew Xie <mattx@google.com> Reduce android.bluetooth package debug messages

bug 7174712

Change-Id: I8d3fdc8edbe42068b5a550660d7b24854c3c4af4
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
d6883533e4ac3f73d2fde1db9a1dddf06dac6709 26-Apr-2012 fredc <fredc@broadcom.com> Fixed socket not closing on BT off. Used RemoteCallbackList to monitor binder deaths in BluetoothManagerService.

Change-Id: I524964bd2836d8c5a4bae095b93ac9481337941d
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
903ac6f399dcd4f574bf388daa7b5f5907d448d3 24-Apr-2012 fredc <fredc@broadcom.com> Fixed issue with Settings app crashing after during on/off and unpair.

Fixed issue with BluetoothAdapter.getRemoteDevice() returning null.

Change-Id: Ie86813532530a6b57bde1c430c7b4875ecc7354c
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
0f42037eb7b5118015c2caca635538324ccf0ccf 12-Apr-2012 fredc <fredc@broadcom.com> Non persistent adapter service

Change-Id: Ib13d5c77416e58161df0e04d7a15ec0dddbde8b5

Conflicts:

core/java/android/bluetooth/BluetoothInputDevice.java

Conflicts:

core/java/com/android/internal/app/ShutdownThread.java
services/java/com/android/server/SystemServer.java

Conflicts:

services/java/com/android/server/SystemServer.java
services/java/com/android/server/pm/ShutdownThread.java
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
3b147b770269173d5d711d6c33f142dc5e723824 04-Apr-2012 zzy <zhenye@broadcom.com> Added new rfcomm multi accept code
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
e4caddbb7a3b39fd6a1ccf107c7dbf09bc8978e8 26-Jan-2012 Jaikumar Ganesh <jaikumar@google.com> Changes for new Bluetooth APIs.

Changes to Bluetooth Adapter, Device and IBluetooth interfaces
for new Bluetooth APIs. Delete AudioGateway.

Change-Id: Ib51b31187eafde261441b9311b5e7e13c8bff82f
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
34b2feb041e263e11bbcec1f2a5094e21be9dc13 04-May-2012 Jason Simmons <jsimmons@google.com> Avoid calling BluetoothSocket.destroyNative twice

If the destroyNative JNI method is called twice, it will attempt to free
the socketData twice, and the second free will cause an assertion failure.

To avoid this, check whether mSocketState has already been set to CLOSED
while holding the write lock. If it has, then destroyNative has already
been called and should not be called again.

Bug: 3096033
Change-Id: Ic7c0bbf21823d389b26919da8c533d8ac4d49064
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
3aef8e1d1b2f0b87d470bcccf37ba4ebb6560c45 20-Dec-2011 Joe Fernandez <joefernandez@google.com> docs: Add developer guide cross-references, Project ACRE, round 4

Change-Id: I1b43414aaec8ea217b39a0d780c80a25409d0991
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
ceb6c9f517ede73bfb677e55fda9d9db6089ae69 04-May-2011 Matthew Xie <mattx@google.com> Add public api BluetoothSocket.isConnected.

It's a convenent function to get the connection status of the bluetooth
socket, ie, whether there is an active connection with remote device.
bug 2149043

Change-Id: I4ca4e98c646f70746d838632f3035376b22d579b
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
f51eadaf1f83abfe16a609a4ded6d789494689b2 21-Sep-2010 Jake Hamby <jhamby@google.com> Typo fixes in comments and minor code cleanups.

* Fix some typos in Javadoc and log messages.
* Remove redundant initializer in BluetoothAdapter.readOutOfBandData()
* Use canonical "UTF-8" charset name instead of "UTF8" in
BluetoothDevice.convertPinToBytes()

Change-Id: I58cd5dc48a7ad0053d204c5f590b4b3d438d8672
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
6d95fc0a2ca910212a43c4547c0ef000659b72dc 20-Nov-2009 Scott Main <smain@google.com> docs for ESR: add docs to bluetooth explainin that discovery should
be cancelled before connecting to a device

bug: 2160782,2198463
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
9fab0aef19a4633d2e4670564e5d7ae9e52fe11f 04-Nov-2009 Scott Main <smain@google.com> docs: add more documentation for the bluetooth apis.

more descriptions for some of the classes and a new
overview and pseudo-code example for using BT APIs
in the package summary.
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
16fb88a673c41b93c5d57ccb28c2697e7d87701a 07-Oct-2009 Nick Pelly <npelly@google.com> Encourage developers to connect RFCOMM by UUID instead of Channel.

Hide createRfcommSocket(int channel)
Add createRfcommSocketWithServiceRecord(UUID uuid)

Rename listenUsingRfcomm(String,UUID) -> listenUsingRfcommWithServiceRecord(..)

Now we have a complete API for developers to make peer-peer RFCOMM connections
with hard-coding the limited (30) RFCOMM channels, instead using SDP lookup
of an UUID.

This commit addresses two serious bugs:
- Do not throw IOException on accepting an incoming RFCOMM connection with
BluetoothSocket. This was a regression from commit 24bb9b8af4ff6915
- Workaround failure of bluez to update SDP cache when channel changes by
trying to use the same RFCOMM channel on the server every time, instead
of picking server channels randomly. This is a pretty ugly workaround,
and we are still trying to fix the caching issue - but with this
workaround we are at least shippable and apps will work at least until
they start colliding on the 30 RFCOMM channels.

DrNo: eastham
Bug: 2158900
Joke: What did the digital watch say to his mom? "Look mom no hands."
Change-Id: Ia4879943b83afac06b6f1a3f2391cf1628afce7d
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
52cde7279bad58285704498eea57bdaf9e595b49 06-Oct-2009 Nick Pelly <npelly@google.com> Fix docs builds.
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
24bb9b8af4ff691538fe9e517e8156016b0da6cd 03-Oct-2009 Nick Pelly <npelly@google.com> Provide an API for apps to use a dynamic RFCOMM channel and SDP record.

Hide listenUsingRfcommOn(int channel)
Add listenUsingRfcomm(String name, ParcelUuid uuid)

The new API automatically finds a free RFCOMM channel and registers an SDP
record with the given uuid and name. The SDP record is automatically
removed when the socket is closed, or if the application dies.

Apps are prevented from registering SDP records with the uuid of system
Bluetooth profiles, such as A2DP, HFP and OPP.

Apps are prevented from removing SDP records that they did not create. This is
tracked by pid.

TODO: Provide an API for the connecting app to look up an SDP record.

Bug: 2158900
DrNo: eastham
Joke: "What did the dog say to the tree? bark."
Change-Id: Ia92f51c34615a7270a403255ad2b8faa98c4a3f5
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
cf44059813539bf7f36dabd278cef93ba3122c56 08-Sep-2009 Nick Pelly <npelly@google.com> Add javadoc to explain which permissions are required for Public BT API's.
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
71c3c7806acb2b2b7b8441817c26a2101d447bbe 02-Sep-2009 Nick Pelly <npelly@google.com> Immediately destroy BluetoothSocket's on close().

Unfortunatley, shutdown() on the underlying fd does not actually stop a
listening socket from listening. You need to call close() on the fd to
do this. There is no way around it.

So this means the Java BluetoothSocket code has to call destroyNative() during
BluetoothSocket.close().

Since native methods cannot be called after destroyNative(), add a ReadWrite
lock and mClosed field to protect access to native methods.

This fixes the "resource busy" error when Bluetooth OPP and Bluetooth PBAP
tried to resume listening after turning BT off and then on.
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
45e2704ff512d41e22af2801d76e96955469ce8d 19-Aug-2009 Nick Pelly <npelly@google.com> API CHANGE

Javadoc, and unhide the first pieces of the Bluetooth API.

With this commit there is enough public API to connect and use an RFCOMM
connection between Bluetooth devices.
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
bd022f423a33f0794bb53e5b0720da2d67e4631c 15-Aug-2009 Nick Pelly <npelly@google.com> Bluetooth: API change.

Split BluetoothDevice into BluetoothDevice and BluetoothAdapter.

BluetoothAdapter: Represents the local BT adapter. Operations on the local
adapter (start a scan, etc).
BluetoothDevice: Represents a remote BT device. Operations on remote devices
(pair, connect, etc).

IBluetoothDevice.aidl -> Bluetooth.aidl
BluetoothDeviceService.java -> BluetoothDeviceService.java

TODO:
Javadoc
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
6a669fac385b51b8bb01844b77a9a43840dda854 03-Jun-2009 Nick Pelly <npelly@google.com> Implement and expose SCO socket support in BluetoothSocket.java.

Implement L2CAP socket support, but do not expose it (untested).

NEXT: Switch to Builder style constructor instead of factory method.
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
47e82dee6b18c33fab8c2cdf4f68b20d3663079e 02-Jun-2009 Nick Pelly <npelly@google.com> Implement bulk read and writes for Bluetooth sockets.

Before: 0.1 kB/s
After: 100 kB/s
(in my java BT speed test app)
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java
0b6955a48bad9aee01ae2f0c06d3f168ca603ab7 27-May-2009 Nick Pelly <npelly@google.com> New BluetoothSocket API.

Modeled on blocking java.net.Socket and java.net.ServerSocket library.

Public interface is:

public final class BluetoothSocket implements Closeable {
public static BluetoothSocket createRfcommSocket(String address, int port) throws IOException;
public static BluetoothSocket createInsecureRfcommSocket(String address, int port) throws IOException;

public void connect() throws IOException;
public void close() throws IOException;

public String getAddress();
public InputStream getInputStream() throws IOException;
public OutputStream getOutputStream() throws IOException;
}

public final class BluetoothServerSocket implements Closeable {
public static BluetoothServerSocket listenUsingRfcommOn(int port) throws IOException;
public static BluetoothServerSocket listenUsingUnsecureRfcommOn(int port) throws IOException;

public BluetoothSocket accept() throws IOException;
public BluetoothSocket accept(int timeout) throws IOException;
public void close() throws IOException;

}
/frameworks/base/core/java/android/bluetooth/BluetoothSocket.java