Closed Bug 953159 Opened 6 years ago Closed 6 years ago

FM radio tries to play even when there is no antenna

Categories

(Core :: DOM: Device Interfaces, defect)

x86_64
Gonk (Firefox OS)
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla29
blocking-b2g 1.3+
Tracking Status
firefox27 --- wontfix
firefox28 --- fixed
firefox29 --- fixed
b2g-v1.2 --- ?
b2g-v1.3 --- fixed
b2g-v1.3T --- fixed
b2g-v1.4 --- fixed

People

(Reporter: vasanth, Assigned: vasanth)

References

Details

(Whiteboard: [CR 593148])

Attachments

(1 file, 1 obsolete file)

Sometimes FM tries to play even when headset is not connected.

To find whether antenna is available it checks (mHeadphoneState != SWITCH_STATE_OFF) [1]. When headset is not connected, sometimes mHeadphoneState is SWITCH_STATE_UNKNWON. So above check becomes true which is wrong

[1] http://mxr.mozilla.org/mozilla-central/source/dom/fmradio/FMRadio.cpp#237
Attached patch fixes this issue.

Hi Pin Zhang, 

I see you as the author of FMRadio.cpp. 
Can you please review this?
Attachment #8351481 - Flags: review?(pzhang)
Assignee: nobody → vasanth
Whiteboard: [CR 593148]
Blocks: 953150
Status: NEW → ASSIGNED
blocking-b2g: --- → 1.3+
Blocks: 942267
No longer blocks: 953150
Attachment #8351481 - Flags: review?(pzhang) → review+
Comment on attachment 8351481 [details] [diff] [review]
handle-antenna-switch-state-unknown-error-in-fm.patch

Review of attachment 8351481 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/fmradio/FMRadio.cpp
@@ +234,5 @@
>  bool
>  FMRadio::AntennaAvailable() const
>  {
> +  return mHasInternalAntenna ? true : (mHeadphoneState != SWITCH_STATE_OFF) &&
> +      (mHeadphoneState != SWITCH_STATE_UNKNOWN);

Nits, we usually keep two spaces indention.
Addressed Nit
Attachment #8351481 - Attachment is obsolete: true
Attachment #8351541 - Flags: review+
Keywords: checkin-needed
Comment on attachment 8351541 [details] [diff] [review]
handle-antenna-switch-state-unknown-error-in-fm.patch

Review of attachment 8351541 [details] [diff] [review]:
-----------------------------------------------------------------

r+, thanks!
Component: General → DOM: Device Interfaces
Product: Firefox OS → Core
https://hg.mozilla.org/mozilla-central/rev/564ec4c03762
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Flags: in-testsuite? → in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Flags: in-testsuite+ → in-testsuite?
Flags: in-moztrap-
Test case has been added to Moztrap: https://moztrap.mozilla.org/manage/case/13743/
Flags: in-moztrap- → in-moztrap+
You need to log in before you can comment on or make changes to this bug.