From 4662cafd4ad149d2842faa4bc56ef18a9ed5c9f2 Mon Sep 17 00:00:00 2001 From: Louis Chang Date: Mon, 7 Mar 2016 15:05:49 +0800 Subject: [PATCH] Bug 1252787 - Patch : Add HID profile when device is remote, r=shawnjohnjr --- .../common/BluetoothProfileController.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dom/bluetooth/common/BluetoothProfileController.cpp b/dom/bluetooth/common/BluetoothProfileController.cpp index 2b72975d9ca8..2a5664ce6764 100644 --- a/dom/bluetooth/common/BluetoothProfileController.cpp +++ b/dom/bluetooth/common/BluetoothProfileController.cpp @@ -199,11 +199,19 @@ BluetoothProfileController::SetupProfiles(bool aAssignServiceClass) } // Rendering bit should be set if remote device supports A2DP. - // A device which supports AVRCP should claim that it's a peripheral and it's - // a remote control. - if (hasRendering || (isPeripheral && isRemoteControl)) { + if (hasRendering) { AddProfile(BluetoothA2dpManager::Get()); - AddProfile(BluetoothAvrcpManager::Get()); // register after A2DP + } + + // A remote control may either support HID or AVRCP since class of device + // value are the same. So we can only differentiate between AVRCP and HID + // by using hasRendering bit. + if ((isPeripheral && isRemoteControl)) { + if (hasRendering) { + AddProfile(BluetoothAvrcpManager::Get()); + } else { + AddProfile(BluetoothHidManager::Get()); + } } // A device which supports HID should claim that it's a peripheral and it's