Closed Bug 1166593 Opened 10 years ago Closed 8 years ago

[Bluetooth] Support HFP in-band ringtone feature

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: shawnjohnjr, Assigned: wiwang)

References

Details

Attachments

(3 files)

[Bluetooth] Support HFP in-band ringtone feature
Assignee: nobody → shuang
Assignee: shuang → wiwang
Blocks: 1181901
I had a test which connect SCO once the call state was changed to INCOMING, and this can successfully pass the PTS case TC_AG_ICA_BV_01_I. Of course, feature configuration of bluedroid need to be correctly set for BRSF as well. I am going to examine/improve the code logic, and many other related PTS cases will also be performed. ==== Log for reference: 233 10-05 08:30:26.950 I/GeckoBluetooth( 333): UpdatePhoneCIND: [1] state 10 => BTHF: active[0] held[0] setupstate[4] ... 238 10-05 08:30:26.953 I/GeckoBluetooth( 333): HandleCallStateChanged: === incoming call and call connectSco ... 246 10-05 08:30:27.080 I/GeckoBluetooth( 333): AudioStateNotification: state 1 247 10-05 08:30:27.154 I/GeckoBluetooth( 333): AudioStateNotification: state 2 ... 296 10-05 08:30:30.756 I/GeckoBluetooth( 333): UpdatePhoneCIND: [1] state 4 => BTHF: active[1] held[0] setupstate[6]
Testing through a bluetooth headphone with in-band ringtone support, found that in-band ringtone can not be heard. And this seems be related with the audio output device was not set to SCO. Log: # call setDeviceConnectionState for SCO in audio policy once HFP is connected 131 10-07 14:48:42.395 I/AudioManager( 9653): === enter case BLUETOOTH_HFP_STATUS_CHANGED_ID for setDeviceConnectionState # call is incoming and call ConnectSco() 223 10-07 14:49:00.476 I/GeckoBluetooth( 9653): HandleCallStateChanged: === incoming call and call connectSco # connecting SCO 229 10-07 14:49:00.622 I/GeckoBluetooth( 9653): AudioStateNotification: state 1 # SCO connected 264 10-07 14:49:01.165 I/GeckoBluetooth( 9653): AudioStateNotification: state 2 # Gecko bluetooth notify audio manager to output audio via SCO 277 10-07 14:49:01.517 I/AudioManager( 9653): === enter case BLUETOOTH_SCO_STATUS_CHANGED_ID - available, and SetForceForUse to SCO However, during the ringing (not picking the phone), in-band ringtone can not be heard. [1] (Audio dump also shows that the the audio output device is not set to SCO) # In the last, we can observe the SCO is disconnected 332 10-07 14:49:31.159 I/GeckoBluetooth( 9653): AudioStateNotification: state 0 [1] #Another case here: if we pick up the phone, the audio output device changes to SCO 123 10-07 14:34:44.910 D/audio_hw_primary( 9652): select_devices: out_snd_device(16: bt-sco-headset-wb) in_snd_device(0: none) 128 10-07 14:34:45.019 D/audio_hw_primary( 9652): enable_snd_device: snd_device(16: bt-sco-headset-wb) 129 10-07 14:34:45.020 D/audio_hw_primary( 9652): enable_audio_route: apply and update mixer path: low-latency-playback bt-sco-wb ==== Hi Alastor, Do you have any idea for the log above? Or for the detail I should ni Sotaro Ikeda instead? Thanks!
Flags: needinfo?(alwu)
Attached file rrrun-8-not-picked.log (deleted) —
Attach the full log for the comment 2 (keep ringing, not picking up the phone)
Attached file rrrun-7-picked.log (deleted) —
Attach the full log for the comment 2: another case [1] (ringing, then picking up the phone)
Hi, Will, Sorry I don't have the explicit idea about why it doesn't work. However, from of the following log, is any possible that the HW doesn't support for in-band ringtone? # Here seems that we connect the SCO, and prepare to send the PCM data 10-07 14:49:00.646 D/bt_hwcfg(10644): hw_set_SCO_codec 0x2 10-07 14:49:00.647 I/bt_hwcfg(10644): SCO I2S interface change the sample rate to 16K 10-07 14:49:00.647 I/bt_hwcfg(10644): I2SPCM config {0x0, 0x0, 0x1, 0x4} 10-07 14:49:00.651 I/bt_hwcfg(10644): SCO PCM configure {0x0, 0x4, 0x0, 0x0, 0x0} 10-07 14:49:00.652 I/bt_hwcfg(10644): SCO PCM data format {0x0, 0x0, 0x3, 0x3, 0x0} 10-07 14:49:00.652 I/bt_hwcfg(10644): sco I2S/PCM config result 0 [0-Success, 1-Fail] 10-07 14:49:00.652 I/bt_vendor(10644): sco_audiostate_cb(status: 0) 10-07 14:49:00.693 E/bt-rfcomm(10644): PORT_DataInd, p_port:0xb6e68c44, p_data_co_callback is null 10-07 14:49:00.744 D/audio_hw_primary( 9652): out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2 10-07 14:49:00.745 W/AudioFlinger( 9652): Thread AudioOut_30 cannot connect to the power manager service # But here we got the a2dp_hw, maybe it's the problem? 10-07 14:49:00.746 I/audio_a2dp_hw( 9652): out_set_parameters: state 3 10-07 14:49:00.746 I/str_params( 9652): key: 'routing' value: '128' 10-07 14:49:00.746 I/str_params( 9652): key: 'a2dp_sink_address' value: 'a0:14:3d:1e:ce:27' -- In addition, Satoro knows lots about AOSP, I think you can also ask him suggestion.
Flags: needinfo?(alwu)
(In reply to Alastor Wu [:alwu] from comment #5) > However, from of the following log, is any possible that the HW doesn't > support for in-band ringtone? FYI, we are currently checking the underlying support with partner in the bug 1214477. > # But here we got the a2dp_hw, maybe it's the problem? > 10-07 14:49:00.746 I/audio_a2dp_hw( 9652): out_set_parameters: state 3 > 10-07 14:49:00.746 I/str_params( 9652): key: 'routing' value: '128' > 10-07 14:49:00.746 I/str_params( 9652): key: 'a2dp_sink_address' value: > 'a0:14:3d:1e:ce:27' At this moment, SCO is under connecting, not connected yet. as I mentioned in above comment 2, we can identify the timing when SCO was connected: # SCO connected 264 10-07 14:49:01.165 I/GeckoBluetooth( 9653): AudioStateNotification: state 2 With this info, do you still consider it's a problem here? > In addition, > Satoro knows lots about AOSP, I think you can also ask him suggestion. Thanks :) ==== Hi Sotaro, I would like to seek your advice for this issue when implementing the bluetooth in-band ringtone feature :) Do you think there is anything we can check for the audio path? especially after the following moment mentioned in comment 2: # Gecko bluetooth notify audio manager to output audio via SCO 277 10-07 14:49:01.517 I/AudioManager( 9653): === enter case BLUETOOTH_SCO_STATUS_CHANGED_ID - available, and SetForceForUse to SCO the corresponding code is located at line 328~330 [1] in Audio Manager. [1] http://hg.mozilla.org/releases/mozilla-b2g37_v2_2r/file/9f0013666373/dom/system/gonk/AudioManager.cpp#l328 Thanks!
Flags: needinfo?(sotaro.ikeda.g)
Flags: needinfo?(alwu)
I do not have a sim card to test the phone call now :-( From the following, android seems not support " in band ringtone". https://code.google.com/p/android/issues/detail?id=38310 AudioPolicyManager::getDeviceForStrategy() actually select active devices for audio stream.
(In reply to Sotaro Ikeda [:sotaro] from comment #7) > > AudioPolicyManager::getDeviceForStrategy() actually select active devices > for audio stream. Bug 1196724 Commenbt 20 summarizes the above attribute.
Flags: needinfo?(sotaro.ikeda.g)
Modifying AudioPolicyManager::getDeviceForStrategy() might address the problem. NB: since android L, android supports platform dependent and platform independent AudioPolicyManager. By default platform independent seems to be used. Platform independent one is the following. http://androidxref.com/5.1.1_r6/xref/frameworks/av/services/audiopolicy/AudioPolicyManager.cpp
Before android L, android supported only platform dependent AudioPolicyManager.
(In reply to Sotaro Ikeda [:sotaro] from comment #9) > Modifying AudioPolicyManager::getDeviceForStrategy() might address the > problem. > > NB: since android L, android supports platform dependent and platform > independent AudioPolicyManager. By default platform independent seems to be > used. > > Platform independent one is the following. > http://androidxref.com/5.1.1_r6/xref/frameworks/av/services/audiopolicy/ > AudioPolicyManager.cpp Thanks, Sotaro. This is really important for us if we want to support in-band ringtone for L. Maybe we have chance to modify platform independent AudioPolicy.
By the way, moz build nexus-5-l uses platform independent AudioPolicyManager.
From the comment7, Maybe the AudioPolicyManager in Flame/Z3C doesn't support for in-band ringtone? I think we should need to verify this point first.
Flags: needinfo?(alwu)
(In reply to Alastor Wu [:alwu] from comment #13) > From the comment7, > Maybe the AudioPolicyManager in Flame/Z3C doesn't support for in-band > ringtone? > I think we should need to verify this point first. No. It doesn't support in-band ringtone from audio part, no doubt.
Recap the case: 1. Receive an incoming call 2. Bluetooth module setup BT_SCO link 3. When BT_SCO link established, notify gonk AudioManager.cpp 4. AudioManager.cpp did: AudioSystem::setParameters(0, cmd); SetForceForUse(nsIAudioManager::USE_COMMUNICATION, nsIAudioManager::FORCE_BT_SCO); SwitchProfileData(DEVICE_BLUETOOTH, true); Based on bug 1196724 Comment 20 only strategy "STRATEGY_PHONE" with BT_SCO option. - STRATEGY_PHONE + AUDIO_STREAM_VOICE_CALL + AUDIO_STREAM_BLUETOOTH_SCO And i guess the pre-condition are: stream_type: RING strategy: STRATEGY_SONIFICATION So we need to extend STRATEGY_SONIFICATION and check (mForceUse[AUDIO_POLICY_FORCE_FOR_COMMUNICATION]) is BT_SCO?
Hi Sotaro, Thanks for your reply :) Indeed, the current android doesn't support in-band ringtone and we need to modify, could you help to advise for following: Since you mentioned: A. AudioPolicyManager runs in framework layer (in moz build nexus-5-l) B. AudioPolicyManager::getDeviceForStrategy() actually select active devices for audio stream Does this mean, we have to modify AudioPolicyManager::getDeviceForStrategy() instead of AudioPolicyService(which is located at framework layer and can be modified in both android KK/L)? That is, AudioPolicyService is not one we need to modify, right? Thanks!
Flags: needinfo?(sotaro.ikeda.g)
(In reply to Will Wang [:WillWang] from comment #16) > Hi Sotaro, > > Thanks for your reply :) > > Indeed, the current android doesn't support in-band ringtone and we need to > modify, > could you help to advise for following: > > Since you mentioned: > A. AudioPolicyManager runs in framework layer (in moz build nexus-5-l) > B. AudioPolicyManager::getDeviceForStrategy() actually select active devices > for audio stream > > Does this mean, we have to modify AudioPolicyManager::getDeviceForStrategy() > instead of AudioPolicyService(which is located at framework layer and can be > modified in both android KK/L)? > > That is, AudioPolicyService is not one we need to modify, right? AudioPolicyService's actual audio selection logic is implemented by AudioPolicyManager. Therefore, we might not need to modify AudioPolicyService. The following diagram(kk gonk) might help to understand the relation ship between AudioPolicyService and AudioPolicyManager. https://github.com/sotaroikeda/firefox-diagrams/blob/master/dom/dom_media_FMRadioService_FirefoxOS_2_5.pdf
Flags: needinfo?(sotaro.ikeda.g)
Attached patch (WIP) bug-1166593-in-band.patch (deleted) — Splinter Review
For reference, attach the WIP patch which can pass test mentioned in comment 1.
Blocks: b2g-hfp-16
Resolve as WONTFIX since B2G is discontinued.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: