Closed Bug 749794 Opened 13 years ago Closed 13 years ago

B2G telephony: need to reset audio state when phone call ends

Categories

(Core :: DOM: Device Interfaces, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla15

People

(Reporter: philikon, Assigned: hsinyi)

References

Details

Attachments

(1 file)

Apparently enabling/disabling the loud speaker or muting a call continues to have an effect on the audio system after the phone call ends. See https://github.com/andreasgal/gaia/issues/1281#issuecomment-5371389 for the original report. I suspect we need to reset gAudioManager.microphoneMuted as well as gAudioManager.setForceForUse(...) when the last call ends.
Hey Hsinyi, would you mind taking a look at this? Thanks!
Assignee: nobody → htsai
Sure, I would investigate this.
Attached patch Patch (deleted) — Splinter Review
When there's no activeCall, we set 'gAudioManager.phoneState = nsIAudioManger.PHONE_STATE_NORMAL'. And no problem with the current setting when a call ends. However, when 'dialer' receives 'disconnected', the dialer will 'toggleMute()' to unmute or disable speaker if user has muted or enabled during the call. In |RadioInterfaceLayer.js| the setter of 'microphoneMuted' and 'speakerEnabled' set gAudioManager.phoneState as IN_CALL or IN_COMMUNICATION first to successfully mute or enable speaker. I.e, 'gAudioManager.phoneState = nsIAudioManger.PHONE_STATE_NORMAL' is overriden. So, this patch resets gAudioManager.phoneState before the setters end. Then video player works fine!
Attachment #620218 - Flags: review?(philipp)
(In reply to Hsin-Yi Tsai [:hsinyi] from comment #3) > Created attachment 620218 [details] [diff] [review] > Patch > > When there's no activeCall, we set 'gAudioManager.phoneState = > nsIAudioManger.PHONE_STATE_NORMAL'. And no problem with the current setting > when a call ends. > > However, when 'dialer' receives 'disconnected', the dialer will > 'toggleMute()' to unmute or disable speaker if user has muted or enabled > during the call. In |RadioInterfaceLayer.js| the setter of 'microphoneMuted' > and 'speakerEnabled' set gAudioManager.phoneState as IN_CALL or > IN_COMMUNICATION first to successfully mute or enable speaker. I.e, > 'gAudioManager.phoneState = nsIAudioManger.PHONE_STATE_NORMAL' is overriden. > So, this patch resets gAudioManager.phoneState before the setters end. Then > video player works fine! B.t.w. I still don't know why XXX in the setters is needed. But without XXX, the setters don't work correctly. That's why I repeat the assignment for 'gAudioManager.phoneState' at the end of the setters.
Kan-Ru, thanks for sharing. Yes, audio system should be synced with phone/call state. And our design considers this as well.
Comment on attachment 620218 [details] [diff] [review] Patch Review of attachment 620218 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/system/gonk/RadioInterfaceLayer.js @@ +740,5 @@ > gAudioManager.microphoneMuted = value; > + > + if (!this._activeCall) { > + gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_NORMAL; > + } Why set `phoneState` twice? Wouldn't an if/else clause make more sense. Also, this seems to be missing the actual fixes to `updateCallAudioState`. That said, https://github.com/andreasgal/gaia/issues/1281#issuecomment-5425901 reports the issue to be gone. Can you still reproduce it?
Attachment #620218 - Flags: review?(philipp)
(In reply to Philipp von Weitershausen [:philikon] from comment #7) > Comment on attachment 620218 [details] [diff] [review] > Patch > > Review of attachment 620218 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: dom/system/gonk/RadioInterfaceLayer.js > @@ +740,5 @@ > > gAudioManager.microphoneMuted = value; > > + > > + if (!this._activeCall) { > > + gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_NORMAL; > > + } > > Why set `phoneState` twice? Wouldn't an if/else clause make more sense. > We need to set 'phoneState' IN_CALL or IN_COMMUNICATION right before setting 'microphoneMuted', not matter which phoneState and call state we are in. Otherwise, we cannot set 'microphoneMuted' as expected. So, after we mute the microphone and when there's no active call, we need to reset the phoneState to release the audio system for other functionalities, like video. That's why I need to set 'phoneState' twice. > Also, this seems to be missing the actual fixes to `updateCallAudioState`. > That said, > https://github.com/andreasgal/gaia/issues/1281#issuecomment-5425901 reports > the issue to be gone. Can you still reproduce it? Yes, I can. I added a comment there, https://github.com/andreasgal/gaia/issues/1281#issuecomment-5425901
(In reply to Hsin-Yi Tsai [:hsinyi] from comment #8) > So, after we mute the microphone and when there's no active call, we need to Sorry, should be 'after we *unmute* the microphone and .... > reset the phoneState to release the audio system for other functionalities, > like video. That's why I need to set 'phoneState' twice.
(In reply to Hsin-Yi Tsai [:hsinyi] from comment #8) > > ::: dom/system/gonk/RadioInterfaceLayer.js > > @@ +740,5 @@ > > > gAudioManager.microphoneMuted = value; > > > + > > > + if (!this._activeCall) { > > > + gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_NORMAL; > > > + } > > > > Why set `phoneState` twice? Wouldn't an if/else clause make more sense. > > > We need to set 'phoneState' IN_CALL or IN_COMMUNICATION right before setting > 'microphoneMuted', not matter which phoneState and call state we are in. > Otherwise, we cannot set 'microphoneMuted' as expected. > > So, after we mute the microphone and when there's no active call, we need to > reset the phoneState to release the audio system for other functionalities, > like video. That's why I need to set 'phoneState' twice. Oh, good point!
Attachment #620218 - Flags: review+
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
https://github.com/mozilla-b2g/gaia/issues/1281 - tested on Otoro build from tip from 7/18/2012 and it works.
Resolution: FIXED → WORKSFORME
John, please don't change the resolution to WORKSFORME when there was a patch that landed. Resolutions have a *very specific* meaning (INVALID = not a valid bug, WORKSFORME = can't reproduce it, FIXED = there was a bug and we fixed it, WONTFIX = there is a bug but we won't fix it). I think you mean VERIFIED FIXED, so I'm changing it to that.
Status: RESOLVED → VERIFIED
Resolution: WORKSFORME → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: