Closed Bug 983539 Opened 6 years ago Closed 6 years ago

[tarako] When getting an incoming call, music comes out from headset for several seconds before ringtone when user is using BT headset to listen to music

Categories

(Firefox OS Graveyard :: AudioChannel, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

(b2g-v1.3T fixed)

RESOLVED FIXED
1.4 S4 (28mar)
Tracking Status
b2g-v1.3T --- fixed

People

(Reporter: angelc04, Assigned: xinhe.yan)

References

Details

(Keywords: perf, Whiteboard: [c=progress p= s=2014.03.28 u=tarako] [SI-testing-blocker][tarako_only][priority][POVB])

Attachments

(4 files)

Attached file adb logcat
Tarako v1.3t build
----------------------------------------------------------------------
Build ID: 20140313135844
Gecko: d400d3a715c7c90291596b32412be56f46f2293e
Gaia: 7329446974f0ea3b14d61bd38f205eb17a5ce62d


Reproduce steps
-----------------------------------------------------------------------
1. Pair a BT headset to tarako device
2. Launch Music and choose a song to play
   music can come out through the BT headset
3. Make a MT call to the test device
   --> Music comes out through device before ringtone rings.


ADB logcat
-----------------------------------------------------------------------
Attached is the adb log.
Test time starts at: 01-01 10:01:12.610
blocking-b2g: --- → 1.3T+
Whiteboard: [SI-testing-blocker]
eric, mind taking a first look? Thanks
Flags: needinfo?(echou)
Music did not pause after the MT call was received. Even A2DP stream stopped, i still see AudioChannel writes audio data into Audio HAL until Music gotta killed by ProcessPriorityManager (KillBackgroundApps). This last for 8 seconds. Sometimes, Music UI will be frozen a few seconds and we can see progress bar moved a few seconds. Then Music will be killed, Dial call screen launch later.

It looks like we need to check AudioChannel first and examine why AudioChannel did not pause.
Flags: needinfo?(scheng)
This is probably related to bug 983476.  The response time is slow.
Flags: needinfo?(mlee)
Keywords: perf
Summary: [tarako] When getting an incoming call, music comes out from Phone Mic for several seconds before ringtone when user is using BT headset to listen to music → [tarako] When getting an incoming call, music comes out from headset for several seconds before ringtone when user is using BT headset to listen to music
Is this a duplicate of bug 973596?  I am not sure if a headset is needed to reproduce this issue.  We should verify once the patch lands for that bug.
(In reply to Naoki Hirata :nhirata (please use needinfo instead of cc) from comment #4)
> Is this a duplicate of bug 973596?  I am not sure if a headset is needed to
> reproduce this issue.  We should verify once the patch lands for that bug.
Need scheng to feedback first to clarify the problem is related to AudioChannel or not.
Assignee: nobody → scheng
Flags: needinfo?(scheng)
I will investigate audio channel.
Music and Ringer are mixed about 1 second. In another device (Nexus4), as well as we encounter this phenomenon despite without connection of BT device.

Reproduce steps:
1.launch music app and play music file in foreground
2.There is in-comming call
3.And then receive the call
4.end call

The log is followings below: 

03-19 11:16:45.693 I/AudioChannel(  979): [star] AudioChannelAgent::StartPlaying AudioChannelType 1 -> Content
03-19 11:16:58.307 I/AudioChannel(  179): [star] AudioChannelAgent::StartPlaying AudioChannelType 5 -> Ringer
03-19 11:16:58.907 I/AudioChannel( 1051): [star] AudioChannelAgent::StartPlaying AudioChannelType 5 -> Ringer
03-19 11:16:58.917 I/AudioChannel( 1051): [star] AudioChannelAgent::StopPlaying AudioChannelType 5 -> Ringer
03-19 11:16:58.917 I/AudioChannel( 1051): [star] AudioChannelAgent::StartPlaying AudioChannelType 5 -> Ringer
03-19 11:16:58.997 I/AudioChannel( 1051): [star] AudioChannelAgent::StartPlaying AudioChannelType 0 -> normal
03-19 11:16:58.997 I/AudioChannel( 1051): [star] AudioChannelAgent::StopPlaying AudioChannelType 0 -> normal
03-19 11:16:58.997 I/AudioChannel( 1051): [star] AudioChannelAgent::StartPlaying AudioChannelType 4 -> telephony
03-19 11:17:05.044 I/AudioChannel( 1051): [star] AudioChannelAgent::StopPlaying AudioChannelType 5 -> ringer
03-19 11:17:05.324 I/AudioChannel(  179): [star] AudioChannelAgent::StopPlaying AudioChannelType 5 -> ringer
03-19 11:17:05.344 I/AudioChannel(  179): [star] AudioChannelAgent::StartPlaying AudioChannelType 4 -> telephony


It is very strange : there is no StopPlaying for audio channel of Content and the timing of StopPlaying for audio channel of ringer. I will investigate it.
Flags: needinfo?(mlee)
Flags: needinfo?(echou)
Status: NEW → ASSIGNED
OS: Other → Gonk (Firefox OS)
Priority: -- → P1
Hardware: Other → ARM
Whiteboard: [SI-testing-blocker] → [c=progress p= s= u=tarako] [SI-testing-blocker]
03-20 10:47:12.213 I/AudioChannel( 1961): [star] AudioChannelAgent::StartPlaying AudioChannelType 1 -> Content
03-20 10:47:28.791 I/AudioManager( 1641): [star] SetPhoneState aState 1
03-20 10:47:28.801 I/AudioChannel( 1641): [star] AudioChannelAgent::StartPlaying AudioChannelType 5 -> Ringer
03-20 10:47:29.241 I/HTMLMedia( 2058): [star] NotifyOwnerDocumentActivityChanged
03-20 10:47:29.582 I/AudioChannel( 2058): [star] AudioChannelAgent::SetVisibilityState oldVisibility 1 visible 1
03-20 10:47:29.652 I/HTMLMedia( 2058): [star] NotifyOwnerDocumentActivityChanged
03-20 10:47:29.652 I/AudioChannel( 2058): [star] AudioChannelAgent::SetVisibilityState oldVisibility 1 visible 1
03-20 10:47:29.952 I/HTMLMedia( 2058): [star] NotifyOwnerDocumentActivityChanged
03-20 10:47:29.952 I/AudioChannel( 2058): [star] AudioChannelAgent::SetVisibilityState oldVisibility 1 visible 1
03-20 10:47:31.994 I/HTMLMedia( 1961): [star] NotifyOwnerDocumentActivityChanged
03-20 10:47:31.994 I/AudioChannel( 1961): [star] AudioChannelAgent::SetVisibilityState oldVisibility 1 visible 0  -> visibility state changed
03-20 10:47:31.994 I/AudioChannel( 1961): [star] CanPlayChanged
03-20 10:47:32.004 I/HTMLMedia( 1961): [star] CanPlayChanged canPlay 1
03-20 10:47:32.004 I/HTMLMedia( 1961): [star] HTMLMediaElement Pause & Suspend -> Stop audio element


It takes 3 seconds (10:47:28 ~ 10:47:31) to change visibility. I need more information.
Flags: needinfo?(alive)
It's a bug we cannot resolve for v1.3T time frame.
See http://bugzil.la/attention-window and its dupes.
Flags: needinfo?(alive)
Duplicate of this bug: 983617
Assignee: scheng → nobody
Depends on: attention-window
Is there any workaround solution or suggestion about this bug.
(In reply to Star Cheng [:scheng] from comment #11)
> Is there any workaround solution or suggestion about this bug.

Is this still an AudioChannel bug? Do you wish Gaia to workaround it on window management side?
Flags: needinfo?(scheng)
I don't think we have a good workground here, for instance, if we send the active app to background early than the call screen transition is done you will notice white screen.
if we get screenshot from the active app and cover the app with the screenshot the performance will get even worse.
(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TPE) (please ni?) from comment #12)
> (In reply to Star Cheng [:scheng] from comment #11)
> > Is there any workaround solution or suggestion about this bug.
> 
> Is this still an AudioChannel bug? Do you wish Gaia to workaround it on
> window management side?

It's not a gecko issue and gaia still needs attention-window to be done to fix this. This is a general bug not only for tarako. I suggest not block on this bug.
(In reply to Alive Kuo [:alive][NEEDINFO!][:艾莉芙] from comment #14)
> (In reply to Tim Guan-tin Chien [:timdream] (MoCo-TPE) (please ni?) from
> comment #12)
> > (In reply to Star Cheng [:scheng] from comment #11)
> > > Is there any workaround solution or suggestion about this bug.
> > 
> > Is this still an AudioChannel bug? Do you wish Gaia to workaround it on
> > window management side?
> 
> It's not a gecko issue and gaia still needs attention-window to be done to
> fix this. This is a general bug not only for tarako. I suggest not block on
> this bug.

As Alive said that's not gecko issue. And I can not provide any help for this issue in audio channel, so I assignment to nobody instead of me.
Flags: needinfo?(scheng)
Attachment 8394023 [details] [diff] is a workaround which can temporary solve this issue. It's simply mute all stream type excluded ring type when ring is coming out. After exit ringtone mode, resume all stream type.
base on all the current discussions, it looks like we need a tarako specific workaround here, therefore adding [tarako_only]
the proper solution will be coming from http://bugzil.la/attention-window

(In reply to Wayne Chen [:xwaynec] from comment #15)
> Created attachment 8394023 [details] [diff] [review]
> 0001-Bug-983539-AudioPolicyManagerBase.patch

is it something we can accept for tarako only? thanks
Whiteboard: [c=progress p= s= u=tarako] [SI-testing-blocker] → [c=progress p= s= u=tarako] [SI-testing-blocker][tarako_only]
(In reply to Joe Cheng [:jcheng] from comment #18)
> base on all the current discussions, it looks like we need a tarako specific
> workaround here, therefore adding [tarako_only]
> the proper solution will be coming from http://bugzil.la/attention-window
> 
> (In reply to Wayne Chen [:xwaynec] from comment #15)
> > Created attachment 8394023 [details] [diff] [review]
> > 0001-Bug-983539-AudioPolicyManagerBase.patch
> 
> is it something we can accept for tarako only? thanks

The patch is modified in android audio policy, I think there is a trade-off scenario. When ring is coming, user choose to ignore ring and relaunch music app (or video app). The music will disappear until the phone exit ring mode. I'm not sure is it ok for tarako?

Thanks
i feel this is the last resort if we don't get much further with this bug
ni? Steven/Marvin on where this bug can go down to
Flags: needinfo?(styang)
Flags: needinfo?(mkhoo)
to Wayne for now since you have been working on it. if its not the case, please reassign. thanks
Assignee: nobody → waychen
Whiteboard: [c=progress p= s= u=tarako] [SI-testing-blocker][tarako_only] → [c=progress p= s= u=tarako] [SI-testing-blocker][tarako_only][POVB]
Add Dafeng here to discuss.
Whiteboard: [c=progress p= s= u=tarako] [SI-testing-blocker][tarako_only][POVB] → [c=progress p= s= u=tarako] [SI-testing-blocker][tarako_only][priority]
Let's wait for dkuo's solution for it.
Flags: needinfo?(styang)
Hi James,

Please Help to find someone to review this patch. It's only for tarako 1.3t.
Thanks

Sincerely,
Wayne
Flags: needinfo?(james.zhang)
Assignee: waychen → james.zhang
Flags: needinfo?(james.zhang)
remove ni from me as solution is on-going
Flags: needinfo?(mkhoo)
Hi James,

Please use attachment 8396288 [details] [diff] [review].

Sincerely,
Wayne
We have merge this workaround patch.
If gaia fix this issue, we'll revert this patch, thanks.


commit 075868b88945ab0c22cc298e47bafe4ae6314603
Author: james.zhang <james.zhang@spreadtrum.com>
Date:   Wed Mar 26 10:29:50 2014 +0800

    Bug#285983 mozilla Bug 983539 - [tarako] When getting an incoming call, music comes out from headset for several seconds before ringtone when user is using BT headset to list
    
    [bug number  ]
    [root cause  ]performance is not well
    [changes     ]disalbe other audio when ringtone, workaround
    [side effects]other audio can't play when ringtone
    [self test   ]mozilla test
    [reviewers   ]
    
    Change-Id: I9874c611dd09cd1fc3b476b0dd7858d0886ffbc0
fixed on my side.
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Whiteboard: [c=progress p= s= u=tarako] [SI-testing-blocker][tarako_only][priority] → [c=progress p= s=2014.03.28 u=tarako] [SI-testing-blocker][tarako_only][priority]
Target Milestone: --- → 1.4 S4 (28mar)
Duplicate of this bug: 1020907
Duplicate of this bug: 1019433
Duplicate of this bug: 1023731
blocking-b2g: 1.3T+ → 1.4?
(In reply to Wayne Chen [:xwaynec] from comment #28)
> Hi James,
> 
> Please use attachment 8396288 [details] [diff] [review].
> 
> Sincerely,
> Wayne

hi Wayne,

  the same issue occur in 1.4.

  could this patch be used in 1.4?

  I add the code you provided in comment27 to 1.4,it seems to work well in 1.4.
Flags: needinfo?(waychen)
(In reply to jingmei.zhang from comment #34)
> (In reply to Wayne Chen [:xwaynec] from comment #28)
> > Hi James,
> > 
> > Please use attachment 8396288 [details] [diff] [review].
> > 
> > Sincerely,
> > Wayne
> 
> hi Wayne,
> 
>   the same issue occur in 1.4.
> 
>   could this patch be used in 1.4?
> 
>   I add the code you provided in comment27 to 1.4,it seems to work well in
> 1.4.

Hi James,

Yes, it also could be used in 1.4.
Flags: needinfo?(waychen)
hi James:

  As wayne said in the comment35,the patch could also be used in 1.4.

  I find that you merged the patch in 1.3.

  As for the issue in 1.4,could you help to merge the patch?
Flags: needinfo?(james.zhang)
This is POVB because this is AOSP code and needs partner to land it in their side.
blocking-b2g: 1.4? → ---
Whiteboard: [c=progress p= s=2014.03.28 u=tarako] [SI-testing-blocker][tarako_only][priority] → [c=progress p= s=2014.03.28 u=tarako] [SI-testing-blocker][tarako_only][priority][POVB]
Assignee: james.zhang → xinhe.yan
Flags: needinfo?(james.zhang)
You need to log in before you can comment on or make changes to this bug.