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

Commit ac925d9a authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "BluetoothAdapter.disconnectAllEnabledProfiles() now disconnects pbap...

Merge "BluetoothAdapter.disconnectAllEnabledProfiles() now disconnects pbap server and map profiles" am: 4320d764 am: 4feb9df5 am: cb8d667b

Change-Id: I65dc333191d8b916c04e7319336640099d3173c8
parents 31ee5f20 cb8d667b
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -2462,9 +2462,14 @@ public class AdapterService extends Service {
        }
        }
        if (mMapClientService != null && isSupported(localDeviceUuids, remoteDeviceUuids,
        if (mMapClientService != null && isSupported(localDeviceUuids, remoteDeviceUuids,
                BluetoothProfile.MAP_CLIENT, device)) {
                BluetoothProfile.MAP_CLIENT, device)) {
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting MAP");
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting MAP Client");
            mMapClientService.disconnect(device);
            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,
        if (mHidDeviceService != null && isSupported(localDeviceUuids, remoteDeviceUuids,
                BluetoothProfile.HID_DEVICE, device)) {
                BluetoothProfile.HID_DEVICE, device)) {
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting Hid Device Profile");
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting Hid Device Profile");
@@ -2482,9 +2487,14 @@ public class AdapterService extends Service {
        }
        }
        if (mPbapClientService != null && isSupported(localDeviceUuids, remoteDeviceUuids,
        if (mPbapClientService != null && isSupported(localDeviceUuids, remoteDeviceUuids,
                BluetoothProfile.PBAP_CLIENT, device)) {
                BluetoothProfile.PBAP_CLIENT, device)) {
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting Pbap");
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting Pbap Client");
            mPbapClientService.disconnect(device);
            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,
        if (mHearingAidService != null && isSupported(localDeviceUuids, remoteDeviceUuids,
                BluetoothProfile.HEARING_AID, device)) {
                BluetoothProfile.HEARING_AID, device)) {
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting Hearing Aid Profile");
            Log.i(TAG, "disconnectAllEnabledProfiles: Disconnecting Hearing Aid Profile");
+5 −1
Original line number Original line Diff line number Diff line
@@ -493,7 +493,11 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect
        return false;
        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");
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission");
        synchronized (mPbapStateMachineMap) {
        synchronized (mPbapStateMachineMap) {
            PbapStateMachine sm = mPbapStateMachineMap.get(device);
            PbapStateMachine sm = mPbapStateMachineMap.get(device);