[dolphin][flame][dialer]audio source icon didn't change back to headset when BT re-connected

NEW
Unassigned

Status

Firefox OS
Gaia::Dialer
3 years ago
3 years ago

People

(Reporter: Peipei Cheng (needinfo if you need my action), Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [sprd1037369])

Steps to reproduce
------------------------------------------------------------------------------
1、Pair and connect a BT headset to device
2、Establish a call connection (MO or MT call)
  The voice will come out through BT headset. And the icon on Dialer call screen is a headset icon.
3、Pull down the notification bar and turn OFF BT
   The voice comes out through device reciever. And the icon for “audio source” switched to a disabled speaker icon. 
4、Pull down the notification bar and turn ON BT
   BT headset is connected automatically. And the voice comes out from BT headset again.
   --> But the audio source icon on call screen does not change back to headset icon.

Both flame and dolphin has this issue.

Test build
------------------------------------------------------------
Gaia      e273c1f52ed7187e4e0b2d66ed5718f0f20c6eeb
Gecko     https://hg.mozilla.org/releases/mozilla-b2g30_v1_4/rev/896fa800b72d
BuildID   20140711000202
Version   30.0
ro.build.version.incremental=130
ro.build.date=Fri May 30 14:52:38 CST 2014
Whiteboard: [sprd1037369]

Comment 1

3 years ago
The root cause might be the way of registering callback function 'onhfpstatuschanged' in dialer app is not proper.

After we restart the bluetooth on call, the callback function 'onhfpstatuschanged' in dialer app won't be called when previous BT headset connected automatically. Hence, we have no chance to update audio source icon. This is mainly due to the registering mode is one-offs[1], the adapter object on which we registered will be released once bluetooth closed and we do nothing to re-init when bluetooth restarted.

By comparison, the callback function 'onhfpstatuschanged' in system app can be executed normally. The main difference between the two app is that the init operation is bound to the callback function 'bluetooth.onadapteradded'[2] for system app. So, all init operations including registering callback functions for adapter[3] will be re-executed when bluetooth reopened.


[1] https://github.com/mozilla-b2g/gaia/blob/v1.4/apps/callscreen/js/calls_handler.js#L27 #L46
[2] https://github.com/mozilla-b2g/gaia/blob/v1.4/apps/system/js/bluetooth.js#L87-L93
[3] https://github.com/mozilla-b2g/gaia/blob/v1.4/apps/system/js/bluetooth.js#L161-L173

 will be called when hfpstatuschanged Wethe function adapter.onhfpstatuschanged(adapter is "the defaultAdapter of window.navigator.mozBluetooth")

Comment 2

3 years ago
Please ignore the redundant last paragraph in comment 1.
-------
The root cause might be the way of registering callback function 'onhfpstatuschanged' in dialer app is not proper.

After we restart the bluetooth on call, the callback function 'onhfpstatuschanged' in dialer app won't be called when previous BT headset connected automatically. Hence, we have no chance to update audio source icon. This is mainly due to the registering mode is one-offs[1], the adapter object on which we registered will be released once bluetooth closed and we do nothing to re-init when bluetooth restarted.

By comparison, the callback function 'onhfpstatuschanged' in system app can be executed normally. The main difference between the two app is that the init operation is bound to the callback function 'bluetooth.onadapteradded'[2] for system app. So, all init operations including registering callback functions for adapter[3] will be re-executed when bluetooth reopened.


[1] https://github.com/mozilla-b2g/gaia/blob/v1.4/apps/callscreen/js/calls_handler.js#L27-#L46
[2] https://github.com/mozilla-b2g/gaia/blob/v1.4/apps/system/js/bluetooth.js#L87-L93
[3] https://github.com/mozilla-b2g/gaia/blob/v1.4/apps/system/js/bluetooth.js#L161-L173
Still an issue on master, the 'hfpstatuschanged' event is only registered at startup:

https://github.com/mozilla-b2g/gaia/blob/af3bf98c64476873c4d8cb6fd18ec611f3145348/apps/callscreen/js/calls_handler.js#L56
You need to log in before you can comment on or make changes to this bug.