From 2852502e2828c8b9f97353473a9a2fff3491321b Mon Sep 17 00:00:00 2001 From: Steven Lee Date: Tue, 11 Jun 2013 08:21:25 -0400 Subject: [PATCH] Bug 880162 - Do not callback FM_RADIO_OPERATION_ENABLE when disabling FM radio. r=jlebar --- hal/gonk/GonkFMRadio.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hal/gonk/GonkFMRadio.cpp b/hal/gonk/GonkFMRadio.cpp index f261baf41a9..48b8dede5ed 100644 --- a/hal/gonk/GonkFMRadio.cpp +++ b/hal/gonk/GonkFMRadio.cpp @@ -223,8 +223,12 @@ runTavaruaRadio(void *) for (unsigned int i = 0; i < buffer.bytesused; i++) { switch (buf[i]) { case TAVARUA_EVT_RADIO_READY: - NS_DispatchToMainThread(new RadioUpdate(hal::FM_RADIO_OPERATION_ENABLE, - hal::FM_RADIO_OPERATION_STATUS_SUCCESS)); + // The driver sends RADIO_READY both when we turn the radio on and when we turn + // the radio off. + if (sRadioEnabled) { + NS_DispatchToMainThread(new RadioUpdate(hal::FM_RADIO_OPERATION_ENABLE, + hal::FM_RADIO_OPERATION_STATUS_SUCCESS)); + } break; case TAVARUA_EVT_SEEK_COMPLETE: NS_DispatchToMainThread(new RadioUpdate(hal::FM_RADIO_OPERATION_SEEK,