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

Commit 1d7b632b authored by Zach Johnson's avatar Zach Johnson Committed by Automerger Merge Worker
Browse files

Merge "Remove listenUsingEncryptedRfcommOn & listenUsingScoOn" am: 22399aae...

Merge "Remove listenUsingEncryptedRfcommOn & listenUsingScoOn" am: 22399aae am: e32671c7 am: dc08329e am: 8f732788 am: 99666c45

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1404838

Change-Id: I20e64adddf20667dc2abbfd5582a8cb34e3f0285
parents 2c4282de 99666c45
Loading
Loading
Loading
Loading
+0 −46
Original line number Diff line number Diff line
@@ -2673,52 +2673,6 @@ public final class BluetoothAdapter {
        return socket;
    }

    /**
     * Construct an encrypted, RFCOMM server socket.
     * Call #accept to retrieve connections to this socket.
     *
     * @return An RFCOMM BluetoothServerSocket
     * @throws IOException On error, for example Bluetooth not available, or insufficient
     * permissions.
     * @hide
     */
    public BluetoothServerSocket listenUsingEncryptedRfcommOn(int port) throws IOException {
        BluetoothServerSocket socket =
                new BluetoothServerSocket(BluetoothSocket.TYPE_RFCOMM, false, true, port);
        int errno = socket.mSocket.bindListen();
        if (port == SOCKET_CHANNEL_AUTO_STATIC_NO_SDP) {
            socket.setChannel(socket.mSocket.getPort());
        }
        if (errno < 0) {
            //TODO(BT): Throw the same exception error code
            // that the previous code was using.
            //socket.mSocket.throwErrnoNative(errno);
            throw new IOException("Error: " + errno);
        }
        return socket;
    }

    /**
     * Construct a SCO server socket.
     * Call #accept to retrieve connections to this socket.
     *
     * @return A SCO BluetoothServerSocket
     * @throws IOException On error, for example Bluetooth not available, or insufficient
     * permissions.
     * @hide
     */
    public static BluetoothServerSocket listenUsingScoOn() throws IOException {
        BluetoothServerSocket socket =
                new BluetoothServerSocket(BluetoothSocket.TYPE_SCO, false, false, -1);
        int errno = socket.mSocket.bindListen();
        if (errno < 0) {
            //TODO(BT): Throw the same exception error code
            // that the previous code was using.
            //socket.mSocket.throwErrnoNative(errno);
        }
        return socket;
    }

    /**
     * Construct an encrypted, authenticated, L2CAP server socket.
     * Call #accept to retrieve connections to this socket.