Bug 869306: Update call direction if call state changes, r=echou

This commit is contained in:
Shawn Huang 2013-05-10 17:47:16 +08:00
parent d46bece2b0
commit 77a3d4dcb3
3 changed files with 9 additions and 6 deletions

View File

@ -1208,6 +1208,7 @@ void
BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
const bool aIsOutgoing,
bool aSend)
{
if (!IsConnected()) {
@ -1222,6 +1223,7 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
uint16_t prevCallState = mCurrentCallArray[aCallIndex].mState;
mCurrentCallArray[aCallIndex].mState = aCallState;
mCurrentCallArray[aCallIndex].mDirection = !aIsOutgoing;
// Same logic as implementation in ril_worker.js
if (aNumber.Length() && aNumber[0] == '+') {
@ -1240,7 +1242,6 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
SendCommand("+CIEV: ", CINDType::CALLHELD);
break;
case nsITelephonyProvider::CALL_STATE_INCOMING:
mCurrentCallArray[aCallIndex].mDirection = true;
if (mCurrentCallIndex) {
if (mCCWA) {
@ -1274,14 +1275,12 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
mBLDNProcessed = true;
}
mCurrentCallArray[aCallIndex].mDirection = false;
UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING, aSend);
mSocket->GetAddress(address);
OpenScoSocket(address);
break;
case nsITelephonyProvider::CALL_STATE_ALERTING:
mCurrentCallArray[aCallIndex].mDirection = false;
UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING_ALERTING, aSend);
// If there's an ongoing call when the headset is just connected, we have

View File

@ -78,7 +78,9 @@ public:
* @param aSend A boolean indicates whether we need to notify headset or not
*/
void HandleCallStateChanged(uint32_t aCallIndex, uint16_t aCallState,
const nsAString& aNumber, bool aSend);
const nsAString& aNumber, const bool aIsOutgoing,
bool aSend);
bool IsConnected();
void GetAddress(nsAString& aDeviceAddress);

View File

@ -34,7 +34,8 @@ TelephonyListener::CallStateChanged(uint32_t aCallIndex,
bool aIsOutgoing)
{
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
hfp->HandleCallStateChanged(aCallIndex, aCallState, aNumber, true);
hfp->HandleCallStateChanged(aCallIndex, aCallState, aNumber,
aIsOutgoing, true);
return NS_OK;
}
@ -48,7 +49,8 @@ TelephonyListener::EnumerateCallState(uint32_t aCallIndex,
bool* aResult)
{
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
hfp->HandleCallStateChanged(aCallIndex, aCallState, aNumber, false);
hfp->HandleCallStateChanged(aCallIndex, aCallState, aNumber,
aIsOutgoing, false);
*aResult = true;
return NS_OK;
}