From 91f62414a0ba15f211c72796fd69df08d311e015 Mon Sep 17 00:00:00 2001 From: Jamin Liu Date: Fri, 10 Jan 2014 08:23:13 -0500 Subject: [PATCH] Bug 953036 - Set HSP flag when BluetoothHfpManager chooses to connect HSP. r=echou --- dom/bluetooth/bluez/BluetoothHfpManager.cpp | 9 ++++++--- dom/bluetooth/bluez/BluetoothHfpManager.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dom/bluetooth/bluez/BluetoothHfpManager.cpp b/dom/bluetooth/bluez/BluetoothHfpManager.cpp index 6ca59a0e3407..4369490c19c1 100644 --- a/dom/bluetooth/bluez/BluetoothHfpManager.cpp +++ b/dom/bluetooth/bluez/BluetoothHfpManager.cpp @@ -389,7 +389,7 @@ BluetoothHfpManager::Reset() mCMER = false; mConnectScoRequest = false; mSlcConnected = false; - mHspConnected = false; + mIsHsp = false; mReceiveVgsFlag = false; #ifdef MOZ_B2G_RIL @@ -1638,13 +1638,14 @@ BluetoothHfpManager::OnSocketConnectSuccess(BluetoothSocket* aSocket) */ if (aSocket == mHandsfreeSocket) { MOZ_ASSERT(!mSocket); + mIsHsp = false; mHandsfreeSocket.swap(mSocket); mHeadsetSocket->Disconnect(); mHeadsetSocket = nullptr; } else if (aSocket == mHeadsetSocket) { MOZ_ASSERT(!mSocket); - mHspConnected = true; + mIsHsp = true; mHeadsetSocket.swap(mSocket); mHandsfreeSocket->Disconnect(); @@ -1739,6 +1740,8 @@ BluetoothHfpManager::OnGetServiceChannel(const nsAString& aDeviceAddress, } else if (NS_FAILED(bs->GetServiceChannel(aDeviceAddress, hspUuid, this))) { OnConnect(NS_LITERAL_STRING(ERR_NO_AVAILABLE_RESOURCE)); + } else { + mIsHsp = true; } return; @@ -1825,7 +1828,7 @@ BluetoothHfpManager::ConnectSco(BluetoothReplyRunnable* aRunnable) // If we are not using HSP, we have to make sure Service Level Connection // established before we start to set up SCO (synchronous connection). - if (!mSlcConnected && !mHspConnected) { + if (!mSlcConnected && !mIsHsp) { mConnectScoRequest = true; BT_WARNING("ConnectSco called before Service Level Connection established"); return false; diff --git a/dom/bluetooth/bluez/BluetoothHfpManager.h b/dom/bluetooth/bluez/BluetoothHfpManager.h index eaff1eb9cd79..a3f3ca05237c 100644 --- a/dom/bluetooth/bluez/BluetoothHfpManager.h +++ b/dom/bluetooth/bluez/BluetoothHfpManager.h @@ -191,7 +191,7 @@ private: bool mCMER; bool mConnectScoRequest; bool mSlcConnected; - bool mHspConnected; + bool mIsHsp; #ifdef MOZ_B2G_RIL bool mFirstCKPD; int mNetworkSelectionMode;