Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2fe360bb authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "Fix MAP SDP record generation [2/3]." into cm-10.1

parents 8120e44c c81a3f31
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -948,7 +948,15 @@ public final class BluetoothAdapter {
     */
    public BluetoothServerSocket listenUsingRfcommWithServiceRecord(String name, UUID uuid)
            throws IOException {
        return createNewRfcommSocketAndRecord(name, uuid, true, true);
        return createNewRfcommSocketAndRecord(name, -1, uuid, true, true);
    }

    /**
     * @hide
     */
    public BluetoothServerSocket listenUsingRfcommWithServiceRecordOn(String name, int port, UUID uuid)
            throws IOException {
        return createNewRfcommSocketAndRecord(name, port, uuid, true, true);
    }

    /**
@@ -979,7 +987,7 @@ public final class BluetoothAdapter {
     */
    public BluetoothServerSocket listenUsingInsecureRfcommWithServiceRecord(String name, UUID uuid)
            throws IOException {
        return createNewRfcommSocketAndRecord(name, uuid, false, false);
        return createNewRfcommSocketAndRecord(name, -1, uuid, false, false);
    }

     /**
@@ -1017,15 +1025,15 @@ public final class BluetoothAdapter {
     */
    public BluetoothServerSocket listenUsingEncryptedRfcommWithServiceRecord(
            String name, UUID uuid) throws IOException {
        return createNewRfcommSocketAndRecord(name, uuid, false, true);
        return createNewRfcommSocketAndRecord(name, -1, uuid, false, true);
    }


    private BluetoothServerSocket createNewRfcommSocketAndRecord(String name, UUID uuid,
    private BluetoothServerSocket createNewRfcommSocketAndRecord(String name, int port, UUID uuid,
            boolean auth, boolean encrypt) throws IOException {
        BluetoothServerSocket socket;
        socket = new BluetoothServerSocket(BluetoothSocket.TYPE_RFCOMM, auth,
                        encrypt, new ParcelUuid(uuid));
                        encrypt, port, new ParcelUuid(uuid));
        socket.setServiceName(name);
        int errno = socket.mSocket.bindListen();
        if (errno != 0) {
+3 −2
Original line number Diff line number Diff line
@@ -92,13 +92,14 @@ public final class BluetoothServerSocket implements Closeable {
     * @param type    type of socket
     * @param auth    require the remote device to be authenticated
     * @param encrypt require the connection to be encrypted
     * @param port    remote port
     * @param uuid    uuid
     * @throws IOException On error, for example Bluetooth not available, or
     *                     insufficient privileges
     */
    /*package*/ BluetoothServerSocket(int type, boolean auth, boolean encrypt, ParcelUuid uuid)
    /*package*/ BluetoothServerSocket(int type, boolean auth, boolean encrypt, int port, ParcelUuid uuid)
            throws IOException {
        mSocket = new BluetoothSocket(type, -1, auth, encrypt, null, -1, uuid);
        mSocket = new BluetoothSocket(type, -1, auth, encrypt, null, port, uuid);
        mChannel = mSocket.getPort();
    }