diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp index 8f83e9b80e43..58924c23c52a 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.cpp +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.cpp @@ -818,13 +818,18 @@ BluetoothHandsfreeInterface::ClccResponse( /* Phone State */ -bt_status_t +void BluetoothHandsfreeInterface::PhoneStateChange(int aNumActive, int aNumHeld, bthf_call_state_t aCallSetupState, const char* aNumber, - bthf_call_addrtype_t aType) + bthf_call_addrtype_t aType, BluetoothHandsfreeResultHandler* aRes) { - return mInterface->phone_state_change(aNumActive, aNumHeld, aCallSetupState, - aNumber, aType); + bt_status_t status = mInterface->phone_state_change(aNumActive, aNumHeld, + aCallSetupState, + aNumber, aType); + if (aRes) { + DispatchBluetoothHandsfreeResult( + aRes, &BluetoothHandsfreeResultHandler::PhoneStateChange, status); + } } // diff --git a/dom/bluetooth2/bluedroid/BluetoothInterface.h b/dom/bluetooth2/bluedroid/BluetoothInterface.h index ac76fe548154..b3ff596e77e1 100644 --- a/dom/bluetooth2/bluedroid/BluetoothInterface.h +++ b/dom/bluetooth2/bluedroid/BluetoothInterface.h @@ -164,10 +164,10 @@ public: /* Phone State */ - bt_status_t PhoneStateChange(int aNumActive, int aNumHeld, - bthf_call_state_t aCallSetupState, - const char* aNumber, - bthf_call_addrtype_t aType); + void PhoneStateChange(int aNumActive, int aNumHeld, + bthf_call_state_t aCallSetupState, + const char* aNumber, bthf_call_addrtype_t aType, + BluetoothHandsfreeResultHandler* aRes); protected: BluetoothHandsfreeInterface(const bthf_interface_t* aInterface); diff --git a/dom/bluetooth2/bluedroid/hfp/BluetoothHfpManager.cpp b/dom/bluetooth2/bluedroid/hfp/BluetoothHfpManager.cpp index 8c00f2020d11..9fe956796b1f 100644 --- a/dom/bluetooth2/bluedroid/hfp/BluetoothHfpManager.cpp +++ b/dom/bluetooth2/bluedroid/hfp/BluetoothHfpManager.cpp @@ -1210,6 +1210,17 @@ BluetoothHfpManager::SendResponse(bthf_at_response_t aResponseCode) aResponseCode, 0, new AtResponseResultHandler()); } +class PhoneStateChangeResultHandler MOZ_FINAL +: public BluetoothHandsfreeResultHandler +{ +public: + void OnError(bt_status_t aStatus) MOZ_OVERRIDE + { + BT_WARNING("BluetoothHandsfreeInterface::PhoneStateChange failed: %d", + (int)aStatus); + } +}; + void BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex) { @@ -1227,9 +1238,9 @@ BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex) aCallIndex, mCurrentCallArray[aCallIndex].mState, numActive, numHeld, callSetupState); - NS_ENSURE_TRUE_VOID(BT_STATUS_SUCCESS == - sBluetoothHfpInterface->PhoneStateChange( - numActive, numHeld, callSetupState, number.get(), type)); + sBluetoothHfpInterface->PhoneStateChange( + numActive, numHeld, callSetupState, number.get(), type, + new PhoneStateChangeResultHandler()); } class DeviceStatusNotificationResultHandler MOZ_FINAL