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

Commit 45bd6e58 authored by Rahul Sabnis's avatar Rahul Sabnis
Browse files

BluetoothAdapter.disconnectAllEnabledProfiles() now disconnects pbap

server and map profiles

Bug: 147031736
Test: Manual
Change-Id: I14a2f4d553857b4d87d0237c48fb91e4eee087a5
parent 8cef98dd
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -2460,9 +2460,14 @@ public class AdapterService extends Service {
        }
        if (mMapClientService != null && isSupported(localDeviceUuids, remoteDeviceUuids,
                BluetoothProfile.MAP_CLIENT, device)) {
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting MAP");
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting MAP Client");
            mMapClientService.disconnect(device);
        }
        if (mMapService != null && isSupported(localDeviceUuids, remoteDeviceUuids,
                BluetoothProfile.MAP, device)) {
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting MAP");
            mMapService.disconnect(device);
        }
        if (mHidDeviceService != null && isSupported(localDeviceUuids, remoteDeviceUuids,
                BluetoothProfile.HID_DEVICE, device)) {
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting Hid Device Profile");
@@ -2480,9 +2485,14 @@ public class AdapterService extends Service {
        }
        if (mPbapClientService != null && isSupported(localDeviceUuids, remoteDeviceUuids,
                BluetoothProfile.PBAP_CLIENT, device)) {
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting Pbap");
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting Pbap Client");
            mPbapClientService.disconnect(device);
        }
        if (mPbapService != null && isSupported(localDeviceUuids, remoteDeviceUuids,
                BluetoothProfile.PBAP, device)) {
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting Pbap Server");
            mPbapService.disconnect(device);
        }
        if (mHearingAidService != null && isSupported(localDeviceUuids, remoteDeviceUuids,
                BluetoothProfile.HEARING_AID, device)) {
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting Hearing Aid Profile");
+5 −1
Original line number Diff line number Diff line
@@ -493,7 +493,11 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect
        return false;
    }

    void disconnect(BluetoothDevice device) {
    /**
     * Disconnects pbap server profile with device
     * @param device is the remote bluetooth device
     */
    public void disconnect(BluetoothDevice device) {
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission");
        synchronized (mPbapStateMachineMap) {
            PbapStateMachine sm = mPbapStateMachineMap.get(device);