Closed Bug 1202060 Opened 9 years ago Closed 9 years ago

[Bluetooth] User is unable to connect the same BT headset/headphones twice

Categories

(Firefox OS Graveyard :: Bluetooth, defect, P2)

ARM
Gonk (Firefox OS)
defect

Tracking

(blocking-b2g:2.5+, firefox43 fixed, b2g-v2.2 unaffected, b2g-master verified)

VERIFIED FIXED
FxOS-S7 (18Sep)
blocking-b2g 2.5+
Tracking Status
firefox43 --- fixed
b2g-v2.2 --- unaffected
b2g-master --- verified

People

(Reporter: AdamA, Assigned: tzimmermann)

References

Details

(Keywords: regression, Whiteboard: [2.5-Daily-Testing][Spark])

Attachments

(3 files, 3 obsolete files)

Attached file logcat
Description:
If the user has a bluetooth headset or headphone connected and disconnects it they will be unable to properly reconnect it without restarting the phone.


Repro Steps:
1) Update a Aries to 20150904150548
2) Open Settings > Bluetooth
3) Pair with a bluetooth headphone or headset
4) Unpair the device that was connected
5) Re--pair that device
6) Ubserve status

Actual:
The camera app does not show what the camera is viewing

Expected:
It is expected that you can see what the camera is showing

Environmental Variables:
Device: Aries 2.5 [Full Flash]
Build ID: 20150904150548
Gaia: 85ae6808d298a4010aaab341c66699f1b87eec9c
Gecko: 691b1524602d
Gonk: 2916e2368074b5383c80bf5a0fba3fc83ba310bd
Version: 43.0a1 (2.5)
Firmware Version: D5803_23.1.A.1.28_NCB.ftf
User Agent: Mozilla/5.0 (Mobile; rv:43.0) Gecko/43.0 Firefox/43.0

Repro frequency: 10/10
See attached: video clip, logcat
This issue DOES occur on Flame 2.5.

Environmental Variables:
Device: Flame 2.5 [Full Flash]
BuildID: 20150903150222
Gaia: d7385b79e68d4ad662cacf810506e9ee53345d23
Gecko: 7f987c38bd3e5ac9a834981e85378bdb02338e9d
Gonk: c4779d6da0f85894b1f78f0351b43f2949e8decd
Version: 43.0a1 (2.5) 
Firmware Version: v18D
User Agent: Mozilla/5.0 (Mobile; rv:43.0) Gecko/43.0 Firefox/43.0

Result:
The camera app does not show what the camera is viewing
------------------------------------
This issue DOES NOT occur on Flame 2.2.

Environmental Variables:
Device: Flame 2.2 [Full Flash]
BuildID: 20150903183008
Gaia: 335cd8e79c20f8d8e93a6efc9b97cc0ec17b5a46
Gecko: d3cb4f28c735
Gonk: bd9cb3af2a0354577a6903917bc826489050b40d
Version: 37.0 (2.2) 
Firmware Version: v18D
User Agent: Mozilla/5.0 (Mobile; rv:37.0) Gecko/37.0 Firefox/37.0

Result:
The bluetooth device can be connected multiple times.
QA Whiteboard: [QAnalyst-Triage?]
Flags: needinfo?(ktucker)
Whiteboard: [2.5-Daily-Testing][Spark]
Keywords: regression
[Blocking Requested - why for this release]:

Regression which will lead to end user frustration. Let's get a window here.
blocking-b2g: --- → 2.5?
Flags: needinfo?(ktucker)
QA Whiteboard: [QAnalyst-Triage?]
QA Contact: mshuman
This issue appears to be caused by:
Bug 1199110 - Separate AVRCP and A2DP managers

B2g-inbound Regression Window

Last Working 
Environmental Variables:
Device: Flame 2.5
BuildID: 20150831081747
Gaia: 7d37d7df5f8f16cec53606d3a5ee2cad8f567930
Gecko: c21e5f74c42a5a1a8516580b9c20cf51a0478728
Version: 43.0a1 (2.5)
Firmware Version: v18D
User Agent: Mozilla/5.0 (Mobile; rv:43.0) Gecko/43.0 Firefox/43.0

First Broken 
Environmental Variables:
Device: Flame 2.5
BuildID: 20150831082900
Gaia: 7d37d7df5f8f16cec53606d3a5ee2cad8f567930
Gecko: 67b479211f65cbc2e2f69fd8b20fda9b93102ea7
Version: 43.0a1 (2.5)
Firmware Version: v18D
User Agent: Mozilla/5.0 (Mobile; rv:43.0) Gecko/43.0 Firefox/43.0

Last Working gaia / First Broken gecko - Issue DOES reproduce
Gaia: 7d37d7df5f8f16cec53606d3a5ee2cad8f567930
Gecko: 67b479211f65cbc2e2f69fd8b20fda9b93102ea7

First Broken gaia / Last Working gecko - Issue does NOT reproduce
Gaia: 7d37d7df5f8f16cec53606d3a5ee2cad8f567930
Gecko: c21e5f74c42a5a1a8516580b9c20cf51a0478728

Gecko Pushlog:
http://hg.mozilla.org/integration/b2g-inbound/pushloghtml?fromchange=c21e5f74c42a5a1a8516580b9c20cf51a0478728&tochange=67b479211f65cbc2e2f69fd8b20fda9b93102ea7
Blocks: 1199110
QA Whiteboard: [QAnalyst-Triage?]
Flags: needinfo?(jmercado)
Thomas this issue seems to have been caused by the changes for bug 1199110, can you please take a look?
QA Whiteboard: [QAnalyst-Triage?] → [QAnalyst-Triage+]
Flags: needinfo?(jmercado) → needinfo?(tzimmermann)
Sure.
Assignee: nobody → tzimmermann
Status: NEW → ASSIGNED
Flags: needinfo?(tzimmermann)
Component: Gaia::Bluetooth → Bluetooth
Hi Adam,

I did a quick test, but I'd need more information.

(In reply to Adam Alldredge [:AdamA] from comment #0)
> 
> Actual:
> The camera app does not show what the camera is viewing
> 
> Expected:
> It is expected that you can see what the camera is showing

I'm confused. Do you mean 'Settings app' here?

I can see that the Camera app is sort-of broken ATM, but that happens without Bluetooth pairings.

Does your headset support Bluetooth's A2DP or AVRCP profiles? Usually, headsets use HFP for communication and that code was not touched by the bisected change set. (If you don't know, can you point to the device's manual/webpage?)
Flags: needinfo?(aalldredge)
Or maybe Martin, the QA contact.
Flags: needinfo?(mshuman)
I'm sorry I was writing a different bug at the time and those steps are supposed to be.

Actual:
In settings it never says that the bluetooth is connected

Expected:
It is expected that you are able to pair the same headset again after unpairing.

Both of the headsets I have reproduced this issue with are A2DP.
Flags: needinfo?(mshuman)
Flags: needinfo?(aalldredge)
Blocks 2.5 with P2 priority
blocking-b2g: 2.5? → 2.5+
Priority: -- → P2
For clarification, when this issue occurs, the second time the user attempts to pair with the headset, the device will appear under the 'paired' list, but will be greyed out and display 'connecting' indefinitely, without the connection ever being properly established. This issue appears to resolve after restarting the DUT.
I saw this in the logcat:

> I/Gecko   (  228): [Parent 228] WARNING: 'aIn >= MOZ_ARRAY_LENGTH(sAvrcpRemoteFeature)', file ../../../../hg.mozilla.org/mozilla-central/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp, line 192
> I/Gecko   (  228): [Parent 228] WARNING: NS_ENSURE_TRUE(mController) failed: file ../../../../hg.mozilla.org/mozilla-central/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp, line 437
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #11)
> I saw this in the logcat:
> 
> > I/Gecko   (  228): [Parent 228] WARNING: 'aIn >= MOZ_ARRAY_LENGTH(sAvrcpRemoteFeature)', file ../../../../hg.mozilla.org/mozilla-central/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp, line 192
> > I/Gecko   (  228): [Parent 228] WARNING: NS_ENSURE_TRUE(mController) failed: file ../../../../hg.mozilla.org/mozilla-central/dom/bluetooth/bluedroid/BluetoothA2dpManager.cpp, line 437

BluetoothDaemonHelpers.cpp, line 189 should contain 0x04.
Shawn,

I made patches for AVRCP problems I found. I think patch [02] might fix the problem. Unfortunately I don't have an A2DP/AVRCP device for testing. Can someone in Taipei help with debugging?
Flags: needinfo?(shuang)
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #16)
> Shawn,
> 
> I made patches for AVRCP problems I found. I think patch [02] might fix the
> problem. Unfortunately I don't have an A2DP/AVRCP device for testing. Can
> someone in Taipei help with debugging?

I can handle it. I will update tomorrow. Keep ni flag.
What I saw is the connection can be established and then I disconnects connection, but I don't see connection state get update.

09-13 10:35:50.190 I/Gecko   ( 5897): [Parent 5897] WARNING: The profile is not connected.: file ../../../../../b2g-inbound/b2g-inbound/dom/bluetooth/common/BluetoothProfileController.cpp, line 141
09-13 10:35:50.190 I/Gecko   ( 7396): [Child 7396] WARNING: There is no observer for "invalidformsubmit". One should be implemented!: file /code/b2g-inbound/b2g-inbound/dom/html/HTMLFormElement.cpp, line 2038
09-13 10:35:50.250 I/Gecko   ( 7396): [Child 7396] WARNING: Transparent content with displayports can be expensive.: file /code/b2g-inbound/b2g-inbound/layout/base/nsDisplayList.cpp, line 1634
Flags: needinfo?(shuang)
Hi!

I looked why the profile might not have been connected and found that it might not have be set up from within Gaia. So I added full AVRCP support to Gaia. The tree is at

  https://github.com/tdz/gaia/tree/bug-1202060
Hi,
I'm sorry for late reply. I have not yet try the gaia patch. But I check the code again, I suspect it's related to AvrcpManager does not call NotifyConnectionState and it might lead to avrcp manager never reports connection state (and Android HAL won't report connection, because bluedroid self managed the state). Since AVRCP registered after A2DP in BluetoothProfileController::SetupProfile, the profile controller expects to see as the following sequence:
HFP connect request->HFP connected -> Next profile -> A2DP connect request-> A2DP connected->Next profile->AVRCP connect request (which is fake)-> avrcp state never reports back -> Reach profile controller timeout for AVRCP -> GiveupAndContinue.

See the log:

09-14 08:53:35.360 I/GeckoBluetooth(22069): NotifyCompletion: [A2DP] <>         
09-14 08:53:35.360 I/GeckoBluetooth(22069): Next: [AVRCP]                       
09-14 08:53:35.360 I/Gecko   (22069): [Parent 22069] WARNING: NS_ENSURE_TRUE(mController) failed: file ../../../../../b2g-inbound/b2g-inbound/dom/bluetooth/bluedroid/BluetoothAvrcpManager.cpp, line 376


My apologies I did not catch it during review process.
Attachment #8660672 - Attachment description: bug1202060-mc.patch → Bug 1202060 - Set ProfileController for BluetoothAvrcpManager
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #19)
> Hi!
> 
> I looked why the profile might not have been connected and found that it
> might not have be set up from within Gaia. So I added full AVRCP support to
> Gaia. The tree is at
> 
>   https://github.com/tdz/gaia/tree/bug-1202060

The gaia nows call 'this._defaultAdapter.connect(device)' in bluetooth_connection_manager.js. That depends on BluetoothProfileController to decide which profiles by default should be get connected, gaia application does not know too much detail regarding connection logic. So the profile array is to maintain UI connection status as we see /media audio status in Settings.
Attachment #8660672 - Attachment is obsolete: true
Attachment #8660672 - Flags: review?(tzimmermann)
Comment on attachment 8659274 [details] [diff] [review]
[02] Bug 1202060: Store Bluetooth profile controller while (dis-)connecting AVRCP

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

r=me. This should fix the current problem.
Attachment #8659274 - Flags: review+
Comment on attachment 8660672 [details] [diff] [review]
Bug 1202060 - Set ProfileController for BluetoothAvrcpManager

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

Hi Shawn,

Thanks for your help! Did you already test with patch  [02] applied? The fix in patch [02] is the same as this one, plus for disconnects.
Oh, overlapping comments!
Thanks a lot. I'll land [02] and upload patches [01] and [03] in a separate bug for review. OK?

I don't think we have to take the Gaia changes then. Who's working on Gaia? Maybe they are interested.
(In reply to Thomas Zimmermann [:tzimmermann] [:tdz] from comment #26)
> Thanks a lot. I'll land [02] and upload patches [01] and [03] in a separate
> bug for review. OK?
Yes, please.
> 
> I don't think we have to take the Gaia changes then. Who's working on Gaia?
> Maybe they are interested.
I set ni flag to Fred.

Hi Fred,
I'm not sure if gaia is interesting in displaying AVRCP connection status in Settings. Could you take a look?
Flags: needinfo?(gasolin)
(In reply to Shawn Huang [:shawnjohnjr] from comment #27)
> Hi Fred,
> I'm not sure if gaia is interesting in displaying AVRCP connection status in
> Settings. Could you take a look?

In case this is relevant: Our AVRCP code in Gecko is now independent from A2DP. According to [1] AVRCP can be used with other profiles, such as VDP. With an 'AVRCP App' we could control any AVRCP device, even if we don't know what the device actually does.

[1] https://developer.bluetooth.org/TechnologyOverview/Pages/AVRCP.aspx
See Also: → 1204497
Comment on attachment 8659273 [details] [diff] [review]
[01] Bug 1202060: Interpret AVRCP remote features as bitmask

Will be reviewed in bug 1204497.
Attachment #8659273 - Attachment is obsolete: true
Comment on attachment 8659276 [details] [diff] [review]
[03] Bug 1202060: Complete AVRCP connect/disconnect from separate runnables

Will be reviewed in bug 1204497.
Attachment #8659276 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/e2571657336c
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S7 (18Sep)
(Add tori(UX) in loop)

After discussion with Shawn I know gecko separate the AVRCP and A2DP profile events,

Since AVRCP is usually used with another Audio or Video profile, gaia could wait until we do need some UI presentation to user (ex when video profile is implemented), and the event trigger might comes with related video profile instead of AVRCP.
Flags: needinfo?(gasolin)
Current implementation it seems we don't send event to gaia.
This bug has been verified as pass on latest Flame v2.5 and Aries v2.5.
STR: Same STR as Comment 0
Repro rate: 0/10
See video:"Aries_v2.5.3GP"

Actual result:
The Bluetooth earphone can be disconnected.

Flame v2.5(pass):
Build ID               20150920150205
Gaia Revision          e67d319d0854e32e23210784eb9c4e1b8a025adb
Gaia Date              2015-09-19 07:42:05
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/ccd6b5f5e544c1d708849144943a776941bd3794
Gecko Version          43.0a1
Device Name            flame
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.cltbld.20150920.182952
Firmware Date          Sun Sep 20 18:30:04 EDT 2015
Firmware Version       v18D v4
Bootloader             L1TC000118D0

Aries KK v2.5(pass):
Build ID               20150920050928
Gaia Revision          e67d319d0854e32e23210784eb9c4e1b8a025adb
Gaia Date              2015-09-19 07:42:05
Gecko Revision         https://hg.mozilla.org/mozilla-central/rev/ccd6b5f5e544c1d708849144943a776941bd3794
Gecko Version          43.0a1
Device Name            aries
Firmware(Release)      4.4.2
Firmware(Incremental)  eng.worker.20150920.042926
Firmware Date          Sun Sep 20 04:29:33 UTC 2015
Bootloader             s1
Status: RESOLVED → VERIFIED
QA Whiteboard: [QAnalyst-Triage+] → [QAnalyst-Triage+][MGSEI-Triage+]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: