Loading api/current.xml +32 −0 Original line number Diff line number Diff line Loading @@ -29401,6 +29401,23 @@ visibility="public" > </method> <method name="listenUsingInsecureRfcommWithServiceRecord" return="android.bluetooth.BluetoothServerSocket" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="name" type="java.lang.String"> </parameter> <parameter name="uuid" type="java.util.UUID"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="listenUsingRfcommWithServiceRecord" return="android.bluetooth.BluetoothServerSocket" abstract="false" Loading Loading @@ -30587,6 +30604,21 @@ > <implements name="android.os.Parcelable"> </implements> <method name="createInsecureRfcommSocketToServiceRecord" return="android.bluetooth.BluetoothSocket" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="uuid" type="java.util.UUID"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="createRfcommSocketToServiceRecord" return="android.bluetooth.BluetoothSocket" abstract="false" core/java/android/bluetooth/BluetoothAdapter.java +55 −1 Original line number Diff line number Diff line Loading @@ -729,6 +729,15 @@ public final class BluetoothAdapter { * Create a listening, secure RFCOMM Bluetooth socket. * <p>A remote device connecting to this socket will be authenticated and * communication on this socket will be encrypted. * <p> Use this socket only if an authenticated socket link is possible. * Authentication refers to the authentication of the link key to * prevent man-in-the-middle type of attacks. * For example, for Bluetooth 2.1 devices, if any of the devices does not * have an input and output capability or just has the ability to * display a numeric key, a secure socket connection is not possible. * In such a case, use {#link listenUsingInsecureRfcommOn}. * For more details, refer to the Security Model section 5.2 (vol 3) of * Bluetooth Core Specification version 2.1 + EDR. * <p>Use {@link BluetoothServerSocket#accept} to retrieve incoming * connections from a listening {@link BluetoothServerSocket}. * <p>Valid RFCOMM channels are in range 1 to 30. Loading Loading @@ -756,6 +765,15 @@ public final class BluetoothAdapter { * Create a listening, secure RFCOMM Bluetooth socket with Service Record. * <p>A remote device connecting to this socket will be authenticated and * communication on this socket will be encrypted. * <p> Use this socket only if an authenticated socket link is possible. * Authentication refers to the authentication of the link key to * prevent man-in-the-middle type of attacks. * For example, for Bluetooth 2.1 devices, if any of the devices does not * have an input and output capability or just has the ability to * display a numeric key, a secure socket connection is not possible. * In such a case, use {#link listenUsingInsecureRfcommWithServiceRecord}. * For more details, refer to the Security Model section 5.2 (vol 3) of * Bluetooth Core Specification version 2.1 + EDR. * <p>Use {@link BluetoothServerSocket#accept} to retrieve incoming * connections from a listening {@link BluetoothServerSocket}. * <p>The system will assign an unused RFCOMM channel to listen on. Loading @@ -776,6 +794,42 @@ public final class BluetoothAdapter { */ public BluetoothServerSocket listenUsingRfcommWithServiceRecord(String name, UUID uuid) throws IOException { return createNewRfcommSocketAndRecord(name, uuid, true, true); } /** * Create a listening, insecure RFCOMM Bluetooth socket with Service Record. * <p>The link key will be unauthenticated i.e the communication is * vulnerable to Man In the Middle attacks. For Bluetooth 2.1 devices, * the link key will be encrypted, as encryption is mandartory. * For legacy devices (pre Bluetooth 2.1 devices) the link key will not * be encrypted. Use {@link #listenUsingRfcommWithServiceRecord}, if an * encrypted and authenticated communication channel is desired. * <p>Use {@link BluetoothServerSocket#accept} to retrieve incoming * connections from a listening {@link BluetoothServerSocket}. * <p>The system will assign an unused RFCOMM channel to listen on. * <p>The system will also register a Service Discovery * Protocol (SDP) record with the local SDP server containing the specified * UUID, service name, and auto-assigned channel. Remote Bluetooth devices * can use the same UUID to query our SDP server and discover which channel * to connect to. This SDP record will be removed when this socket is * closed, or if this application closes unexpectedly. * <p>Use {@link BluetoothDevice#createRfcommSocketToServiceRecord} to * connect to this socket from another device using the same {@link UUID}. * <p>Requires {@link android.Manifest.permission#BLUETOOTH} * @param name service name for SDP record * @param uuid uuid for SDP record * @return a listening RFCOMM BluetoothServerSocket * @throws IOException on error, for example Bluetooth not available, or * insufficient permissions, or channel in use. */ public BluetoothServerSocket listenUsingInsecureRfcommWithServiceRecord(String name, UUID uuid) throws IOException { return createNewRfcommSocketAndRecord(name, uuid, false, false); } private BluetoothServerSocket createNewRfcommSocketAndRecord(String name, UUID uuid, boolean auth, boolean encrypt) throws IOException { RfcommChannelPicker picker = new RfcommChannelPicker(uuid); BluetoothServerSocket socket; Loading @@ -789,7 +843,7 @@ public final class BluetoothAdapter { } socket = new BluetoothServerSocket( BluetoothSocket.TYPE_RFCOMM, true, true, channel); BluetoothSocket.TYPE_RFCOMM, auth, encrypt, channel); errno = socket.mSocket.bindListen(); if (errno == 0) { if (DBG) Log.d(TAG, "listening on RFCOMM channel " + channel); Loading core/java/android/bluetooth/BluetoothDevice.java +52 −1 Original line number Diff line number Diff line Loading @@ -693,6 +693,15 @@ public final class BluetoothDevice implements Parcelable { * outgoing connection to this remote device on given channel. * <p>The remote device will be authenticated and communication on this * socket will be encrypted. * <p> Use this socket only if an authenticated socket link is possible. * Authentication refers to the authentication of the link key to * prevent man-in-the-middle type of attacks. * For example, for Bluetooth 2.1 devices, if any of the devices does not * have an input and output capability or just has the ability to * display a numeric key, a secure socket connection is not possible. * In such a case, use {#link createInsecureRfcommSocket}. * For more details, refer to the Security Model section 5.2 (vol 3) of * Bluetooth Core Specification version 2.1 + EDR. * <p>Use {@link BluetoothSocket#connect} to initiate the outgoing * connection. * <p>Valid RFCOMM channels are in range 1 to 30. Loading Loading @@ -720,6 +729,15 @@ public final class BluetoothDevice implements Parcelable { * determine which channel to connect to. * <p>The remote device will be authenticated and communication on this * socket will be encrypted. * <p> Use this socket only if an authenticated socket link is possible. * Authentication refers to the authentication of the link key to * prevent man-in-the-middle type of attacks. * For example, for Bluetooth 2.1 devices, if any of the devices does not * have an input and output capability or just has the ability to * display a numeric key, a secure socket connection is not possible. * In such a case, use {#link createInsecureRfcommSocketToServiceRecord}. * For more details, refer to the Security Model section 5.2 (vol 3) of * Bluetooth Core Specification version 2.1 + EDR. * <p>Hint: If you are connecting to a Bluetooth serial board then try * using the well-known SPP UUID 00001101-0000-1000-8000-00805F9B34FB. * However if you are connecting to an Android peer then please generate Loading @@ -736,6 +754,39 @@ public final class BluetoothDevice implements Parcelable { new ParcelUuid(uuid)); } /** * Create an RFCOMM {@link BluetoothSocket} socket ready to start an insecure * outgoing connection to this remote device using SDP lookup of uuid. * <p> The communication channel will not have an authenticated link key * i.e it will be subject to man-in-the-middle attacks. For Bluetooth 2.1 * devices, the link key will be encrypted, as encryption is mandatory. * For legacy devices (pre Bluetooth 2.1 devices) the link key will * be not be encrypted. Use {@link #createRfcommSocketToServiceRecord} if an * encrypted and authenticated communication channel is desired. * <p>This is designed to be used with {@link * BluetoothAdapter#listenUsingInsecureRfcommWithServiceRecord} for peer-peer * Bluetooth applications. * <p>Use {@link BluetoothSocket#connect} to initiate the outgoing * connection. This will also perform an SDP lookup of the given uuid to * determine which channel to connect to. * <p>The remote device will be authenticated and communication on this * socket will be encrypted. * <p>Hint: If you are connecting to a Bluetooth serial board then try * using the well-known SPP UUID 00001101-0000-1000-8000-00805F9B34FB. * However if you are connecting to an Android peer then please generate * your own unique UUID. * <p>Requires {@link android.Manifest.permission#BLUETOOTH} * * @param uuid service record uuid to lookup RFCOMM channel * @return a RFCOMM BluetoothServerSocket ready for an outgoing connection * @throws IOException on error, for example Bluetooth not available, or * insufficient permissions */ public BluetoothSocket createInsecureRfcommSocketToServiceRecord(UUID uuid) throws IOException { return new BluetoothSocket(BluetoothSocket.TYPE_RFCOMM, -1, false, false, this, -1, new ParcelUuid(uuid)); } /** * Construct an insecure RFCOMM socket ready to start an outgoing * connection. Loading Loading
api/current.xml +32 −0 Original line number Diff line number Diff line Loading @@ -29401,6 +29401,23 @@ visibility="public" > </method> <method name="listenUsingInsecureRfcommWithServiceRecord" return="android.bluetooth.BluetoothServerSocket" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="name" type="java.lang.String"> </parameter> <parameter name="uuid" type="java.util.UUID"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="listenUsingRfcommWithServiceRecord" return="android.bluetooth.BluetoothServerSocket" abstract="false" Loading Loading @@ -30587,6 +30604,21 @@ > <implements name="android.os.Parcelable"> </implements> <method name="createInsecureRfcommSocketToServiceRecord" return="android.bluetooth.BluetoothSocket" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="uuid" type="java.util.UUID"> </parameter> <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="createRfcommSocketToServiceRecord" return="android.bluetooth.BluetoothSocket" abstract="false"
core/java/android/bluetooth/BluetoothAdapter.java +55 −1 Original line number Diff line number Diff line Loading @@ -729,6 +729,15 @@ public final class BluetoothAdapter { * Create a listening, secure RFCOMM Bluetooth socket. * <p>A remote device connecting to this socket will be authenticated and * communication on this socket will be encrypted. * <p> Use this socket only if an authenticated socket link is possible. * Authentication refers to the authentication of the link key to * prevent man-in-the-middle type of attacks. * For example, for Bluetooth 2.1 devices, if any of the devices does not * have an input and output capability or just has the ability to * display a numeric key, a secure socket connection is not possible. * In such a case, use {#link listenUsingInsecureRfcommOn}. * For more details, refer to the Security Model section 5.2 (vol 3) of * Bluetooth Core Specification version 2.1 + EDR. * <p>Use {@link BluetoothServerSocket#accept} to retrieve incoming * connections from a listening {@link BluetoothServerSocket}. * <p>Valid RFCOMM channels are in range 1 to 30. Loading Loading @@ -756,6 +765,15 @@ public final class BluetoothAdapter { * Create a listening, secure RFCOMM Bluetooth socket with Service Record. * <p>A remote device connecting to this socket will be authenticated and * communication on this socket will be encrypted. * <p> Use this socket only if an authenticated socket link is possible. * Authentication refers to the authentication of the link key to * prevent man-in-the-middle type of attacks. * For example, for Bluetooth 2.1 devices, if any of the devices does not * have an input and output capability or just has the ability to * display a numeric key, a secure socket connection is not possible. * In such a case, use {#link listenUsingInsecureRfcommWithServiceRecord}. * For more details, refer to the Security Model section 5.2 (vol 3) of * Bluetooth Core Specification version 2.1 + EDR. * <p>Use {@link BluetoothServerSocket#accept} to retrieve incoming * connections from a listening {@link BluetoothServerSocket}. * <p>The system will assign an unused RFCOMM channel to listen on. Loading @@ -776,6 +794,42 @@ public final class BluetoothAdapter { */ public BluetoothServerSocket listenUsingRfcommWithServiceRecord(String name, UUID uuid) throws IOException { return createNewRfcommSocketAndRecord(name, uuid, true, true); } /** * Create a listening, insecure RFCOMM Bluetooth socket with Service Record. * <p>The link key will be unauthenticated i.e the communication is * vulnerable to Man In the Middle attacks. For Bluetooth 2.1 devices, * the link key will be encrypted, as encryption is mandartory. * For legacy devices (pre Bluetooth 2.1 devices) the link key will not * be encrypted. Use {@link #listenUsingRfcommWithServiceRecord}, if an * encrypted and authenticated communication channel is desired. * <p>Use {@link BluetoothServerSocket#accept} to retrieve incoming * connections from a listening {@link BluetoothServerSocket}. * <p>The system will assign an unused RFCOMM channel to listen on. * <p>The system will also register a Service Discovery * Protocol (SDP) record with the local SDP server containing the specified * UUID, service name, and auto-assigned channel. Remote Bluetooth devices * can use the same UUID to query our SDP server and discover which channel * to connect to. This SDP record will be removed when this socket is * closed, or if this application closes unexpectedly. * <p>Use {@link BluetoothDevice#createRfcommSocketToServiceRecord} to * connect to this socket from another device using the same {@link UUID}. * <p>Requires {@link android.Manifest.permission#BLUETOOTH} * @param name service name for SDP record * @param uuid uuid for SDP record * @return a listening RFCOMM BluetoothServerSocket * @throws IOException on error, for example Bluetooth not available, or * insufficient permissions, or channel in use. */ public BluetoothServerSocket listenUsingInsecureRfcommWithServiceRecord(String name, UUID uuid) throws IOException { return createNewRfcommSocketAndRecord(name, uuid, false, false); } private BluetoothServerSocket createNewRfcommSocketAndRecord(String name, UUID uuid, boolean auth, boolean encrypt) throws IOException { RfcommChannelPicker picker = new RfcommChannelPicker(uuid); BluetoothServerSocket socket; Loading @@ -789,7 +843,7 @@ public final class BluetoothAdapter { } socket = new BluetoothServerSocket( BluetoothSocket.TYPE_RFCOMM, true, true, channel); BluetoothSocket.TYPE_RFCOMM, auth, encrypt, channel); errno = socket.mSocket.bindListen(); if (errno == 0) { if (DBG) Log.d(TAG, "listening on RFCOMM channel " + channel); Loading
core/java/android/bluetooth/BluetoothDevice.java +52 −1 Original line number Diff line number Diff line Loading @@ -693,6 +693,15 @@ public final class BluetoothDevice implements Parcelable { * outgoing connection to this remote device on given channel. * <p>The remote device will be authenticated and communication on this * socket will be encrypted. * <p> Use this socket only if an authenticated socket link is possible. * Authentication refers to the authentication of the link key to * prevent man-in-the-middle type of attacks. * For example, for Bluetooth 2.1 devices, if any of the devices does not * have an input and output capability or just has the ability to * display a numeric key, a secure socket connection is not possible. * In such a case, use {#link createInsecureRfcommSocket}. * For more details, refer to the Security Model section 5.2 (vol 3) of * Bluetooth Core Specification version 2.1 + EDR. * <p>Use {@link BluetoothSocket#connect} to initiate the outgoing * connection. * <p>Valid RFCOMM channels are in range 1 to 30. Loading Loading @@ -720,6 +729,15 @@ public final class BluetoothDevice implements Parcelable { * determine which channel to connect to. * <p>The remote device will be authenticated and communication on this * socket will be encrypted. * <p> Use this socket only if an authenticated socket link is possible. * Authentication refers to the authentication of the link key to * prevent man-in-the-middle type of attacks. * For example, for Bluetooth 2.1 devices, if any of the devices does not * have an input and output capability or just has the ability to * display a numeric key, a secure socket connection is not possible. * In such a case, use {#link createInsecureRfcommSocketToServiceRecord}. * For more details, refer to the Security Model section 5.2 (vol 3) of * Bluetooth Core Specification version 2.1 + EDR. * <p>Hint: If you are connecting to a Bluetooth serial board then try * using the well-known SPP UUID 00001101-0000-1000-8000-00805F9B34FB. * However if you are connecting to an Android peer then please generate Loading @@ -736,6 +754,39 @@ public final class BluetoothDevice implements Parcelable { new ParcelUuid(uuid)); } /** * Create an RFCOMM {@link BluetoothSocket} socket ready to start an insecure * outgoing connection to this remote device using SDP lookup of uuid. * <p> The communication channel will not have an authenticated link key * i.e it will be subject to man-in-the-middle attacks. For Bluetooth 2.1 * devices, the link key will be encrypted, as encryption is mandatory. * For legacy devices (pre Bluetooth 2.1 devices) the link key will * be not be encrypted. Use {@link #createRfcommSocketToServiceRecord} if an * encrypted and authenticated communication channel is desired. * <p>This is designed to be used with {@link * BluetoothAdapter#listenUsingInsecureRfcommWithServiceRecord} for peer-peer * Bluetooth applications. * <p>Use {@link BluetoothSocket#connect} to initiate the outgoing * connection. This will also perform an SDP lookup of the given uuid to * determine which channel to connect to. * <p>The remote device will be authenticated and communication on this * socket will be encrypted. * <p>Hint: If you are connecting to a Bluetooth serial board then try * using the well-known SPP UUID 00001101-0000-1000-8000-00805F9B34FB. * However if you are connecting to an Android peer then please generate * your own unique UUID. * <p>Requires {@link android.Manifest.permission#BLUETOOTH} * * @param uuid service record uuid to lookup RFCOMM channel * @return a RFCOMM BluetoothServerSocket ready for an outgoing connection * @throws IOException on error, for example Bluetooth not available, or * insufficient permissions */ public BluetoothSocket createInsecureRfcommSocketToServiceRecord(UUID uuid) throws IOException { return new BluetoothSocket(BluetoothSocket.TYPE_RFCOMM, -1, false, false, this, -1, new ParcelUuid(uuid)); } /** * Construct an insecure RFCOMM socket ready to start an outgoing * connection. Loading