Bug 953036 - Set HSP flag when BluetoothHfpManager chooses to connect HSP. r=echou

This commit is contained in:
Jamin Liu 2014-01-10 08:23:13 -05:00
parent 1acb8c0912
commit 91f62414a0
2 changed files with 7 additions and 4 deletions

View File

@ -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;

View File

@ -191,7 +191,7 @@ private:
bool mCMER;
bool mConnectScoRequest;
bool mSlcConnected;
bool mHspConnected;
bool mIsHsp;
#ifdef MOZ_B2G_RIL
bool mFirstCKPD;
int mNetworkSelectionMode;