Closed
Bug 875719
Opened 11 years ago
Closed 11 years ago
[Bluetooth]Bluetooth SCO does not disconnect after immediately receiving AT+CHUP while dialing an outgoing call
Categories
(Firefox OS Graveyard :: Bluetooth, defect, P1)
Tracking
(blocking-b2g:tef+, firefox22 wontfix, firefox23 wontfix, firefox24 fixed, b2g18 fixed, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 fixed)
RESOLVED
FIXED
blocking-b2g | tef+ |
People
(Reporter: shawnjohnjr, Assigned: echou)
References
Details
(Whiteboard: [fixed-in-birch])
Attachments
(2 files, 4 obsolete files)
8.97 KB,
patch
|
Details | Diff | Splinter Review | |
8.99 KB,
patch
|
Details | Diff | Splinter Review |
TC_AG_TCA_BV_04_I.
STR:
1. Make an outgoing call via Bluetooth (using ATDxxxxxxxxx)
2. BT headset immediately sends AT+CHUP to cancel call
Problem:
After call cancel, Bluetooth SCO does not disconnect.
Reporter | ||
Comment 1•11 years ago
|
||
It looks like mCurrentCallIndex is 0
Call disconnected: call state: 10
Call disconnected: call aCallIndex: 1
Call disconnected: call mCurrentCallIndex: 0
Call disconnected: call index: 1
mCurrentCallIndex will be updated, only call state changed to CALL_STATE_CONNECTED.
Reporter | ||
Updated•11 years ago
|
blocking-b2g: --- → tef?
Reporter | ||
Comment 2•11 years ago
|
||
It looks like the logic is dangerous. If outgoing call was been performed (BT headset connected), and if call state does not go into connected, SCO connection could still exist. It's not a good thing if SCO connection remains, it means power consumption problem might raise.
How to recover this problem:
If the next incoming/outgoing call with BT headset connected, and call state changed to connected, after call hang up, SCO connection will be disconnected again.
Reporter | ||
Comment 3•11 years ago
|
||
How to recover this problem:
If the next incoming/outgoing call with BT headset connected, and call state changed to connected, after call hang up, SCO connection will be disconnected again.
Summary: [Bluetooth][Certification]Bluetooth SCO does not disconnect after immediately receiving AT+CHUP while dialing an outgoing call → [Bluetooth]Bluetooth SCO does not disconnect after immediately receiving AT+CHUP while dialing an outgoing call
Reporter | ||
Comment 4•11 years ago
|
||
Hello Gina,
Can we simply remove this check? mCurrentCallIndex is not been assigned.
----->if (aCallIndex == mCurrentCallIndex) {
// Find the first non-disconnected call (like connected, held),
// and update mCurrentCallIndex
----->}
It seems checking mCurrentCallIndex is not a good idea here. Also, another bug Bug 869902 is also related to mCurrentCallIndex.
Flags: needinfo?(gyeh)
Comment 5•11 years ago
|
||
Hi Shawn, thanks for reporting. I found this issue last week and forgot to file a new bug :(
I'm afraid that we can't remove the check here. Think about the following scenario. There are two calls: one is active and the other is on hold. Then, receiving "AT+CHLD=1" from headset, then we should hang up the first call and then answer the second call. For this case, we shouldn't disconnect SCO, right?
I think I got a solution. Let me update here after testing.
Flags: needinfo?(gyeh)
Comment 6•11 years ago
|
||
What do you think about this? Can you help to run the test case again with this patch? Thanks.
Attachment #753819 -
Flags: feedback?(shuang)
Reporter | ||
Comment 7•11 years ago
|
||
Comment on attachment 753819 [details] [diff] [review]
Patch 1(v1): Set mCurrentCallIndex when making an outgoing call
I have re-run TCA series test cases. All pass.
Attachment #753819 -
Flags: feedback?(shuang) → feedback+
Reporter | ||
Comment 8•11 years ago
|
||
Transfer to Gina, because she has a better solution.
Assignee: shuang → gyeh
OS: Linux → Gonk (Firefox OS)
Hardware: x86_64 → All
Reporter | ||
Updated•11 years ago
|
Comment 9•11 years ago
|
||
Thanks for your help, Shawn. Let me ask Eric to review my patch.
Updated•11 years ago
|
Attachment #753819 -
Flags: review?(echou)
Comment 10•11 years ago
|
||
This patch modified the following parts:
- Rename |mCurrentCallArray| to |mCallArray|
- Rename |mCurrentCallIndex| to |mActiveCallIndex|
- Put data members in BluetoothHfpManager in alphabetical order
- Assign new value to |mActiveCallIndex| whenever set up a SCO socket successfully
Attachment #753819 -
Attachment is obsolete: true
Attachment #753819 -
Flags: review?(echou)
Attachment #754314 -
Flags: review?(echou)
Attachment #754314 -
Flags: feedback?(shuang)
Reporter | ||
Comment 11•11 years ago
|
||
I will do PTS scanning again for Attachment #754314 [details] [diff] and expect be done two hours later.
Comment 12•11 years ago
|
||
Discussed with Eric. He's going to provide a new patch for this issue.
Assignee: gyeh → echou
Comment 13•11 years ago
|
||
Comment on attachment 754314 [details] [diff] [review]
Patch 1(v2): Set mActiveCallIndex whenever set up a SCO socket
>From a074cd87403f6cc505ce01dab7ce69e1c9af68f1 Mon Sep 17 00:00:00 2001
>From: Gina Yeh <gyeh@mozilla.com>
>Date: Mon, 27 May 2013 10:57:32 +0800
>Subject: [PATCH] Bug 875719 - Patch 1(v2): Bluetooth SCO does not disconnect
> after immediately receiving AT+CHUP while dialing an
> outgoing call
>
>---
> dom/bluetooth/BluetoothHfpManager.cpp | 63 +++++++++++++++++----------------
> dom/bluetooth/BluetoothHfpManager.h | 13 ++++---
> 2 files changed, 41 insertions(+), 35 deletions(-)
>
>diff --git a/dom/bluetooth/BluetoothHfpManager.cpp b/dom/bluetooth/BluetoothHfpManager.cpp
>index 11ecef1..55a5fa9 100644
>--- a/dom/bluetooth/BluetoothHfpManager.cpp
>+++ b/dom/bluetooth/BluetoothHfpManager.cpp
>@@ -371,14 +371,14 @@ BluetoothHfpManager::BluetoothHfpManager()
> void
> BluetoothHfpManager::ResetCallArray()
> {
> LOG("[H] %s", __FUNCTION__);
>- mCurrentCallIndex = 0;
>- mCurrentCallArray.Clear();
>- // Append a call object at the beginning of mCurrentCallArray since call
>+ mActiveCallIndex = 0;
>+ mCallArray.Clear();
>+ // Append a call object at the beginning of mCallArray since call
> // index from RIL starts at 1.
> Call call;
>- mCurrentCallArray.AppendElement(call);
>+ mCallArray.AppendElement(call);
> }
>
> void
> BluetoothHfpManager::Reset()
>@@ -974,9 +974,9 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
> // Bluetooth HSP spec 4.5
> // There are two ways to release SCO: sending CHUP to dialer or closing
> // SCO socket directly. We notify dialer only if there is at least one
> // active call.
>- if (mCurrentCallArray.Length() > 1) {
>+ if (mCallArray.Length() > 1) {
> NotifyDialer(NS_LITERAL_STRING("CHUP"));
> } else {
> DisconnectSco();
> }
>@@ -1186,11 +1186,11 @@ BluetoothHfpManager::SendCommand(const char* aCommand, uint8_t aValue)
> }
> }
> } else if (!strcmp(aCommand, "+CLCC: ")) {
> bool rv = true;
>- uint32_t callNumbers = mCurrentCallArray.Length();
>+ uint32_t callNumbers = mCallArray.Length();
> for (uint32_t i = 1; i < callNumbers; i++) {
>- Call& call = mCurrentCallArray[i];
>+ Call& call = mCallArray[i];
> if (call.mState == nsITelephonyProvider::CALL_STATE_DISCONNECTED) {
> continue;
> }
>
>@@ -1213,9 +1213,9 @@ BluetoothHfpManager::SendCommand(const char* aCommand, uint8_t aValue)
> case nsITelephonyProvider::CALL_STATE_ALERTING:
> message.AppendInt(3);
> break;
> case nsITelephonyProvider::CALL_STATE_INCOMING:
>- message.AppendInt((i == mCurrentCallIndex) ? 4 : 5);
>+ message.AppendInt((i == mActiveCallIndex) ? 4 : 5);
> break;
> default:
> NS_WARNING("Not handling call status for CLCC");
> break;
>@@ -1259,26 +1259,26 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
> // Normal case. No need to print out warnings.
> return;
> }
>
>- while (aCallIndex >= mCurrentCallArray.Length()) {
>+ while (aCallIndex >= mCallArray.Length()) {
> Call call;
>- mCurrentCallArray.AppendElement(call);
>+ mCallArray.AppendElement(call);
> }
>
>- uint16_t prevCallState = mCurrentCallArray[aCallIndex].mState;
>- mCurrentCallArray[aCallIndex].mState = aCallState;
>- mCurrentCallArray[aCallIndex].mDirection = !aIsOutgoing;
>+ uint16_t prevCallState = mCallArray[aCallIndex].mState;
>+ mCallArray[aCallIndex].mState = aCallState;
>+ mCallArray[aCallIndex].mDirection = !aIsOutgoing;
>
> // Same logic as implementation in ril_worker.js
> if (aNumber.Length() && aNumber[0] == '+') {
>- mCurrentCallArray[aCallIndex].mType = TOA_INTERNATIONAL;
>+ mCallArray[aCallIndex].mType = TOA_INTERNATIONAL;
> }
>- mCurrentCallArray[aCallIndex].mNumber = aNumber;
>+ mCallArray[aCallIndex].mNumber = aNumber;
>
> nsRefPtr<nsRunnable> sendRingTask;
> nsString address;
>- uint32_t callArrayLength = mCurrentCallArray.Length();
>+ uint32_t callArrayLength = mCallArray.Length();
> uint32_t index = 1;
>
> switch (aCallState) {
> case nsITelephonyProvider::CALL_STATE_HELD:
>@@ -1286,14 +1286,14 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
> SendCommand("+CIEV: ", CINDType::CALLHELD);
> break;
> case nsITelephonyProvider::CALL_STATE_INCOMING:
>
>- if (mCurrentCallIndex) {
>+ if (mActiveCallIndex) {
> if (mCCWA) {
> nsAutoCString ccwaMsg("+CCWA: \"");
> ccwaMsg.Append(NS_ConvertUTF16toUTF8(aNumber));
> ccwaMsg.AppendLiteral("\",");
>- ccwaMsg.AppendInt(mCurrentCallArray[aCallIndex].mType);
>+ ccwaMsg.AppendInt(mCallArray[aCallIndex].mType);
> SendLine(ccwaMsg.get());
> }
> UpdateCIND(CINDType::CALLSETUP, CallSetupState::INCOMING, aSend);
> } else {
>@@ -1308,9 +1308,9 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
>
> MessageLoop::current()->PostDelayedTask(
> FROM_HERE,
> new SendRingIndicatorTask(number,
>- mCurrentCallArray[aCallIndex].mType),
>+ mCallArray[aCallIndex].mType),
> sRingInterval);
> }
> break;
> case nsITelephonyProvider::CALL_STATE_DIALING:
>@@ -1319,39 +1319,44 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
> mBLDNProcessed = true;
> }
>
> UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING, aSend);
>- ConnectSco();
>+ if (ConnectSco()) {
>+ mActiveCallIndex = aCallIndex;
>+ }
> break;
> case nsITelephonyProvider::CALL_STATE_ALERTING:
> UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING_ALERTING, aSend);
>
> // If there's an ongoing call when the headset is just connected, we have
> // to open a sco socket here.
>- ConnectSco();
>+ if (ConnectSco()) {
>+ mActiveCallIndex = aCallIndex;
>+ }
> break;
> case nsITelephonyProvider::CALL_STATE_CONNECTED:
>- mCurrentCallIndex = aCallIndex;
> switch (prevCallState) {
> case nsITelephonyProvider::CALL_STATE_INCOMING:
> case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
> // Incoming call, no break
> sStopSendingRingFlag = true;
>- ConnectSco();
>+ if (ConnectSco()) {
>+ mActiveCallIndex = aCallIndex;
>+ }
> case nsITelephonyProvider::CALL_STATE_ALERTING:
> // Outgoing call
> UpdateCIND(CINDType::CALL, CallState::IN_PROGRESS, aSend);
> UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, aSend);
> break;
> case nsITelephonyProvider::CALL_STATE_HELD:
> // Check whether to update CINDType::CALLHELD or not
> while (index < callArrayLength) {
>- if (index == mCurrentCallIndex) {
>+ if (index == mActiveCallIndex) {
> index++;
> continue;
> }
>
>- uint16_t state = mCurrentCallArray[index].mState;
>+ uint16_t state = mCallArray[index].mState;
> // If there's another call on hold or other calls exist, no need to
> // update CINDType::CALLHELD
> if (state != nsITelephonyProvider::CALL_STATE_DISCONNECTED) {
> break;
>@@ -1391,21 +1396,19 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
> default:
> NS_WARNING("Not handling state changed");
> }
>
>- if (aCallIndex == mCurrentCallIndex) {
>+ if (aCallIndex == mActiveCallIndex) {
> // Find the first non-disconnected call (like connected, held),
>- // and update mCurrentCallIndex
> while (index < callArrayLength) {
>- if (mCurrentCallArray[index].mState !=
>+ if (mCallArray[index].mState !=
> nsITelephonyProvider::CALL_STATE_DISCONNECTED) {
>- mCurrentCallIndex = index;
> break;
> }
> index++;
> }
>
>- // There is no call, close Sco and clear mCurrentCallArray
>+ // There is no call, close Sco and clear mCallArray
> if (index == callArrayLength) {
> DisconnectSco();
> ResetCallArray();
> }
>diff --git a/dom/bluetooth/BluetoothHfpManager.h b/dom/bluetooth/BluetoothHfpManager.h
>index 31e22e9..f544e6d 100644
>--- a/dom/bluetooth/BluetoothHfpManager.h
>+++ b/dom/bluetooth/BluetoothHfpManager.h
>@@ -122,24 +122,27 @@ private:
> void OnScoDisconnect();
>
> int mCurrentVgs;
> int mCurrentVgm;
>- uint32_t mCurrentCallIndex;
>+ int mNetworkSelectionMode;
>+
>+ bool mBLDNProcessed;
> bool mCCWA;
> bool mCLIP;
> bool mCMEE;
> bool mCMER;
> bool mFirstCKPD;
>- int mNetworkSelectionMode;
>- bool mReceiveVgsFlag;
>- bool mBLDNProcessed;
> bool mIsHandsfree;
> bool mNeedsUpdatingSdpRecords;
>+ bool mReceiveVgsFlag;
>+
> nsString mDeviceAddress;
> nsString mMsisdn;
> nsString mOperatorName;
>
>- nsTArray<Call> mCurrentCallArray;
>+ uint32_t mActiveCallIndex;
>+ nsTArray<Call> mCallArray;
>+
> nsAutoPtr<BluetoothTelephonyListener> mListener;
> nsRefPtr<BluetoothReplyRunnable> mRunnable;
> nsRefPtr<BluetoothReplyRunnable> mScoRunnable;
>
>--
>1.7.9.5
>
Attachment #754314 -
Attachment is obsolete: true
Attachment #754314 -
Flags: review?(echou)
Attachment #754314 -
Flags: feedback?(shuang)
Assignee | ||
Comment 14•11 years ago
|
||
* Remove variable mCurrentCallIndex and replace with using function FindFirstCall(aState).
* Remove unused variable index and callArrayLength
Attachment #754374 -
Flags: review?(gyeh)
Assignee | ||
Comment 15•11 years ago
|
||
* Update since we would fail when running TWC_BV_03. Please see comments inline.
Attachment #754374 -
Attachment is obsolete: true
Attachment #754374 -
Flags: review?(gyeh)
Attachment #754398 -
Flags: review?(gyeh)
Comment 16•11 years ago
|
||
Comment on attachment 754374 [details] [diff] [review]
patch 1: v1: simplify and correct the mechanism of handling call state change event
Review of attachment 754374 [details] [diff] [review]:
-----------------------------------------------------------------
After discussion, cancel this review request and let me check new patch.
::: dom/bluetooth/BluetoothHfpManager.cpp
@@ +1334,5 @@
> UpdateCIND(CINDType::CALL, CallState::IN_PROGRESS, aSend);
> UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, aSend);
> break;
> case nsIRadioInterfaceLayer::CALL_STATE_HELD:
> + if (!FindFirstCall(nsIRadioInterfaceLayer::CALL_STATE_HELD)) {
The logic here is different from original.
Original: UpdateCIND if all calls are disconnected
New: UpdateCIND if all calls are not on held
Attachment #754374 -
Attachment is obsolete: false
Comment 17•11 years ago
|
||
Comment on attachment 754398 [details] [diff] [review]
patch 1: v1: simplify and correct the mechanism of handling call state change event
Review of attachment 754398 [details] [diff] [review]:
-----------------------------------------------------------------
Looks great! r+ with question answered. We finally get rid of |mCurrentCallIndex|. :)
::: dom/bluetooth/BluetoothHfpManager.cpp
@@ +1213,5 @@
> }
> }
> }
>
> +int
Can we use uint32_t for compatibility with call index?
Attachment #754398 -
Flags: review?(gyeh) → review+
Assignee | ||
Updated•11 years ago
|
Attachment #754374 -
Attachment is obsolete: true
Assignee | ||
Comment 19•11 years ago
|
||
Whiteboard: [fixed-in-birch]
Assignee | ||
Comment 20•11 years ago
|
||
The patch not only fix this issue but also bug 869902. Since bug 869902 has already been set as leo+, we should at least make this leo+ as well. Furthermore, since this is a certification-blocking issue, I would like to nominate as a tef+.
Assignee | ||
Comment 21•11 years ago
|
||
Reporter | ||
Updated•11 years ago
|
Whiteboard: [fixed-in-birch] → [status:needs land][fixed-in-birch]
Comment 22•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Reporter | ||
Updated•11 years ago
|
Whiteboard: [status:needs land][fixed-in-birch] → [status:needs uplift][fixed-in-birch]
Updated•11 years ago
|
Comment 23•11 years ago
|
||
ni?jhford - can you help to uplift this as the blocking status has changed?
Thanks.
Flags: needinfo?(jhford)
Comment 24•11 years ago
|
||
Ryan, looks like a Gecko patch, mind taking a look at this?
Flags: needinfo?(jhford) → needinfo?(ryanvm)
Comment 25•11 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g18/rev/4a8e06236ea9
https://hg.mozilla.org/releases/mozilla-b2g18_v1_0_1/rev/be5c2ee11d02
status-b2g18-v1.0.0:
--- → wontfix
status-firefox22:
--- → wontfix
status-firefox23:
--- → wontfix
status-firefox24:
--- → fixed
Flags: needinfo?(ryanvm)
Whiteboard: [status:needs uplift][fixed-in-birch] → [fixed-in-birch]
You need to log in
before you can comment on or make changes to this bug.
Description
•