NREC status change not handled in HFP manager

RESOLVED FIXED in Firefox 43, Firefox OS v2.2r

Status

Firefox OS
Bluetooth
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: tzimmermann, Assigned: WillWang)

Tracking

unspecified
FxOS-S7 (18Sep)
ARM
Gonk (Firefox OS)

Firefox Tracking Flags

(blocking-b2g:2.2r+, firefox43 fixed, b2g-v2.2r fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

In debug builds, Gecko crashes when I try to pair it with a HFP device. This seems related to the recent NREC changes.

STR:

 - pair with HFP device

Result:

 - observe crash in |BluetoothHfpManager::NotifyConnectionStateChanged|, near line 575 (the assertion)

(gdb) print aType
$1 = (const nsAString_internal &) @0xbee2c754: {mData = 0xb5674612 u"bluetooth-hfp-nrec-status-changed", mLength = 33, mFlags = 33}
(gdb) 

Full BT:

#0  0xb39ecda6 in mozilla::dom::bluetooth::BluetoothHfpManager::NotifyConnectionStateChanged (this=this@entry=0xaf0d6aa0, aType=...)
    at ../../../../hg.mozilla.org/mozilla-central/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp:575
#1  0xb39ecfba in mozilla::dom::bluetooth::BluetoothHfpManager::ConnectionStateNotification (this=0xaf0d6aa0, aState=mozilla::dom::bluetooth::HFP_CONNECTION_STATE_CONNECTED, 
    aBdAddress=...) at ../../../../hg.mozilla.org/mozilla-central/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp:1404
#2  0xb39d018a in mozilla::ipc::DaemonNotificationRunnable2<mozilla::dom::bluetooth::BluetoothDaemonHandsfreeModule::NotificationHandlerWrapper, void, mozilla::dom::bluetooth::BluetoothHandsfreeConnectionState, nsString, mozilla::dom::bluetooth::BluetoothHandsfreeConnectionState, nsAString_internal const&>::Run (this=0xa508bcd0)
    at ../../dist/include/mozilla/ipc/DaemonRunnables.h:392
#3  0xb327f39c in ProcessNextEvent (aResult=0xbee2c7ff, aMayWait=true, this=0xb6a20860)
    at /home/mozilla/Projects/mozilla/src/hg.mozilla.org/mozilla-central/xpcom/threads/nsThread.cpp:874
#4  nsThread::ProcessNextEvent (this=0xb6a20860, aMayWait=<optimized out>, aResult=0xbee2c7ff)
    at /home/mozilla/Projects/mozilla/src/hg.mozilla.org/mozilla-central/xpcom/threads/nsThread.cpp:762
#5  0xb32998e2 in NS_ProcessNextEvent (aThread=0xb6a20860, aMayWait=aMayWait@entry=true)
    at /home/mozilla/Projects/mozilla/src/hg.mozilla.org/mozilla-central/xpcom/glue/nsThreadUtils.cpp:277
#6  0xb3460b0e in mozilla::ipc::MessagePump::Run (this=0xb6a07730, aDelegate=0xb6a321c0)
    at /home/mozilla/Projects/mozilla/src/hg.mozilla.org/mozilla-central/ipc/glue/MessagePump.cpp:127
#7  0xb3447468 in MessageLoop::RunInternal (this=this@entry=0xb6a321c0)
    at /home/mozilla/Projects/mozilla/src/hg.mozilla.org/mozilla-central/ipc/chromium/src/base/message_loop.cc:234
#8  0xb3447482 in RunHandler (this=0xb6a321c0) at /home/mozilla/Projects/mozilla/src/hg.mozilla.org/mozilla-central/ipc/chromium/src/base/message_loop.cc:227
#9  MessageLoop::Run (this=0xb6a321c0) at /home/mozilla/Projects/mozilla/src/hg.mozilla.org/mozilla-central/ipc/chromium/src/base/message_loop.cc:201
#10 0xb42f03de in nsBaseAppShell::Run (this=0xb6a484c0) at /home/mozilla/Projects/mozilla/src/hg.mozilla.org/mozilla-central/widget/nsBaseAppShell.cpp:156
#11 0xb478d24e in nsAppStartup::Run (this=0xb03802a0) at /home/mozilla/Projects/mozilla/src/hg.mozilla.org/mozilla-central/toolkit/components/startup/nsAppStartup.cpp:281
#12 0xb47c8512 in XREMain::XRE_mainRun (this=this@entry=0xbee2c9a4) at ../../../../hg.mozilla.org/mozilla-central/toolkit/xre/nsAppRunner.cpp:4292
#13 0xb47c87ee in XREMain::XRE_main (this=this@entry=0xbee2c9a4, argc=argc@entry=1, argv=argv@entry=0xb6a27298, aAppData=aAppData@entry=0xb6ff6c70 <_ZL8sAppData>)
    at ../../../../hg.mozilla.org/mozilla-central/toolkit/xre/nsAppRunner.cpp:4389
#14 0xb47c8986 in XRE_main (argc=1, argv=0xb6a27298, aAppData=0xb6ff6c70 <_ZL8sAppData>, aFlags=<optimized out>)
    at ../../../../hg.mozilla.org/mozilla-central/toolkit/xre/nsAppRunner.cpp:4478
#15 0xb6fd7f62 in do_main (argc=argc@entry=1, argv=argv@entry=0xb6a27298) at ../../../../hg.mozilla.org/mozilla-central/b2g/app/nsBrowserApp.cpp:167
#16 0xb6fd809e in b2g_main (argc=argc@entry=1, argv=argv@entry=0xbee2dc84) at ../../../../hg.mozilla.org/mozilla-central/b2g/app/nsBrowserApp.cpp:299
#17 0xb6fd7dca in RunProcesses (aReservedFds=..., argv=0xbee2dc84, argc=1) at ../../../../hg.mozilla.org/mozilla-central/b2g/app/B2GLoader.cpp:232
#18 main (argc=1, argv=0xbee2dc84) at ../../../../hg.mozilla.org/mozilla-central/b2g/app/B2GLoader.cpp:297
(Assignee)

Updated

3 years ago
Assignee: nobody → wiwang
(Assignee)

Comment 1

3 years ago
Thank you, Thomas, I will fix this.
(Assignee)

Comment 2

3 years ago
I am going to replace the way NREC notify audio manager once RFCOMM is connected,
that is, not using the function |NotifyConnectionStateChanged| which is not suitable for NREC.
Assignee: wiwang → shuang
(Assignee)

Updated

3 years ago
Assignee: shuang → wiwang
Blocks: 825149
(Assignee)

Comment 3

3 years ago
Created attachment 8661142 [details] [diff] [review]
Patch(for m-c): Stop using the function |NotifyConnectionStateChanged|

Hi Shawn,

Attached patch fix this debug build issue,
could you help to review?
Thanks!
Attachment #8661142 - Flags: review?(shuang)
Attachment #8661142 - Flags: review?(shuang) → review+
Comment on attachment 8661142 [details] [diff] [review]
Patch(for m-c): Stop using the function |NotifyConnectionStateChanged|

Review of attachment 8661142 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
@@ +1476,5 @@
>    NotifyDialer(NS_ConvertUTF8toUTF16(message));
>  }
>  
> +/**
> + * Two situations the NREC status will be set:

nit: NREC status will be set when:
(Assignee)

Comment 5

3 years ago
Created attachment 8661151 [details] [diff] [review]
Patch(for both m-c and branch 2.2r): Bug 1203046 - Call |NRECNotification| once RFCOMM is connected.

Revised patch.
Carry r+ from previous patch.
Attachment #8661142 - Attachment is obsolete: true
Attachment #8661151 - Flags: review+
(Assignee)

Comment 6

3 years ago
Comment on attachment 8661151 [details] [diff] [review]
Patch(for both m-c and branch 2.2r): Bug 1203046 - Call |NRECNotification| once RFCOMM is connected.

This patch can also be applied to branch 2.2r.
Attachment #8661151 - Attachment description: Patch(for m-c): Bug 1203046 - Call |NRECNotification| once RFCOMM is connected. → Patch(for both m-c and branch 2.2r): Bug 1203046 - Call |NRECNotification| once RFCOMM is connected.
(Assignee)

Updated

3 years ago
blocking-b2g: --- → 2.2r?
status-b2g-v2.2r: --- → affected
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/d20763c242e8
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox43: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S7 (18Sep)
(Assignee)

Comment 9

3 years ago
set checkin-needed for 2.2r

====

Hi Wesley,

could you help to set blocking-b2g 2.2r+,
thanks!
Flags: needinfo?(whuang)
Keywords: checkin-needed

Comment 10

3 years ago
Set 2.2r+ blocker since the bug causes crash on debug build.
blocking-b2g: 2.2r? → 2.2r+
Flags: needinfo?(whuang)
this patch does not apply cleanly:

patching file dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
Hunk #1 FAILED at 1393
Hunk #2 FAILED at 1472
2 out of 2 hunks FAILED -- saving rejects to file dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working directory
errors during apply, please fix and refresh bug1203046.patch
Tomcats-MacBook-Pro-2:mozilla-b2g37_v2_2r Tomcat$ 

Will, could you take a look? Thanks!
Flags: needinfo?(wiwang)
https://hg.mozilla.org/releases/mozilla-b2g37_v2_2r/rev/a36a90399990
status-b2g-v2.2r: affected → fixed
Keywords: checkin-needed
(In reply to Carsten Book [:Tomcat] from comment #11)
> this patch does not apply cleanly:
> 
> patching file dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp
> Hunk #1 FAILED at 1393
> Hunk #2 FAILED at 1472
> 2 out of 2 hunks FAILED -- saving rejects to file
> dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp.rej
> patch failed, unable to continue (try -v)
> patch failed, rejects left in working directory
> errors during apply, please fix and refresh bug1203046.patch
> Tomcats-MacBook-Pro-2:mozilla-b2g37_v2_2r Tomcat$ 
> 
> Will, could you take a look? Thanks!

oh ignore that, patch worked :)
Flags: needinfo?(wiwang)
(Assignee)

Comment 14

3 years ago
Thank you, Tomcat :)
You need to log in before you can comment on or make changes to this bug.