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)
Tracking
()
VERIFIED
FIXED
mozilla15
People
(Reporter: philikon, Assigned: hsinyi)
References
Details
Attachments
(1 file)
(deleted),
patch
|
philikon
:
review+
|
Details | Diff | Splinter Review |
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.
Reporter | ||
Comment 1•13 years ago
|
||
Hey Hsinyi, would you mind taking a look at this? Thanks!
Assignee: nobody → htsai
Assignee | ||
Comment 2•13 years ago
|
||
Sure, I would investigate this.
Assignee | ||
Comment 3•13 years ago
|
||
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)
Assignee | ||
Comment 4•13 years ago
|
||
(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.
Comment 5•13 years ago
|
||
Android implementation:
http://androidxref.com/source/xref/frameworks/base/telephony/java/com/android/internal/telephony/CallManager.java#370
It seems audio mode needs to be synced with the phone state.
And how they do mute:
http://androidxref.com/source/xref/frameworks/base/telephony/java/com/android/internal/telephony/CallManager.java#871
Assignee | ||
Comment 6•13 years ago
|
||
Kan-Ru, thanks for sharing. Yes, audio system should be synced with phone/call state. And our design considers this as well.
Reporter | ||
Comment 7•13 years ago
|
||
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)
Assignee | ||
Comment 8•13 years ago
|
||
(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
Assignee | ||
Comment 9•13 years ago
|
||
(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.
Reporter | ||
Comment 10•13 years ago
|
||
(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!
Reporter | ||
Updated•13 years ago
|
Attachment #620218 -
Flags: review+
Reporter | ||
Comment 11•13 years ago
|
||
Target Milestone: --- → mozilla15
Comment 12•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Comment 13•12 years ago
|
||
https://github.com/mozilla-b2g/gaia/issues/1281 - tested on Otoro build from tip from 7/18/2012 and it works.
Resolution: FIXED → WORKSFORME
Reporter | ||
Comment 14•12 years ago
|
||
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.
Description
•