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

Commit d5f4043a authored by Hemant Gupta's avatar Hemant Gupta Committed by Linux Build Service Account
Browse files

PBAP-C: Add support for dynamic SDP record creation

This patch adds support for dynamic creation of PBAP Client SDP
record. Without this patch it is not possible to add pbap client
sdp record when pbap client test application is launched, leading
to BT spec violation and resulting in PTS IOPT test case TP/SDSS/BV-02
to fail.

Change-Id: I420063c17637ec6c55af7ab23b267fc18f9b03ac
parent 2b227316
Loading
Loading
Loading
Loading
+29 −1
Original line number Diff line number Diff line
@@ -1820,6 +1820,34 @@ public final class BluetoothAdapter {
        return -1;
    }

    /**
     * Create a client side Phonebook Access Profile Service Record.
     * Create the record once, and reuse it for all connections.
     * If changes to a record is needed remove the old record using {@link removeSdpRecord}
     * and then create a new one.
     * WARNING: This API requires removeSdpRecord() to be called, to avoid leaking resources!
     *          A second call to this function - either from two different apps or from the
     *          same app, without first calling removeSdpRecord() - will make the device
     *          break the Bluetooth spec, which could lead to severe IOP issues.
     * @param serviceName   The textual name of the service
     * @param version       The Profile version number (As specified in the Bluetooth
     *                      PBAP specification)
     * @return a handle to the record created. The record can be removed again
     *          using {@link removeSdpRecord}(). The record is not linked to the
     *          creation/destruction of BluetoothSockets, hence SDP record cleanup
     *          is a separate process.
     *          returns -1 if an error occure and the record was not created.
     * @hide
     */
    public int createPbapPceSdpRecord(String serviceName, int version) {
        try {
            return mService.createPbapPceSdpRecord(serviceName, version);
        } catch (RemoteException e) {
            Log.e(TAG, "createPbapPceSdpRecord: ", e);
        }
        return -1;
    }

    /**
     * Remove a SDP record created using createSdpRecord().
     * This function shall be called before a new call to createSdpRecord for the same record
@@ -1832,7 +1860,7 @@ public final class BluetoothAdapter {
        try {
            return mService.removeSdpRecord(recordHandle);
        } catch (RemoteException e) {
            Log.e(TAG, "createMapMnsSdpRecord: ", e);
            Log.e(TAG, "removeSdpRecord: ", e);
        }
        return false;
    }
+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ interface IBluetooth

    int createMapMnsSdpRecord(in String serviceName, in int rfcommChannel,
            in int l2capPsm, in int version, in int features);
    int createPbapPceSdpRecord(in String serviceName, in int version);
    boolean removeSdpRecord(in int recordHandle);

    boolean setPin(in BluetoothDevice device, boolean accept, int len, in byte[] pinCode);