Bug 938809 - Support calling seeking/tuning functions off main thread in HAL, r=dhylands

This commit is contained in:
Michael Wu 2014-07-29 20:28:12 -04:00
parent f472e9759e
commit 2f673e6e18
2 changed files with 15 additions and 13 deletions

View File

@ -526,6 +526,8 @@ void DisableFMRadio();
/**
* Seek to an available FM radio station.
*
* This can be called off main thread, but all calls must be completed
* before calling DisableFMRadio.
*/
void FMRadioSeek(const hal::FMRadioSeekDirection& aDirection);
@ -536,6 +538,9 @@ void GetFMRadioSettings(hal::FMRadioSettings* aInfo);
/**
* Set the FM radio's frequency.
*
* This can be called off main thread, but all calls must be completed
* before calling DisableFMRadio.
*/
void SetFMRadioFrequency(const uint32_t frequency);

View File

@ -402,20 +402,18 @@ FMRadioSeek(const hal::FMRadioSeekDirection& aDirection)
if (sMsmFMMode && rc >= 0)
return;
hal::FMRadioOperationInformation info;
info.operation() = hal::FM_RADIO_OPERATION_SEEK;
info.status() = rc < 0 ? hal::FM_RADIO_OPERATION_STATUS_FAIL :
hal::FM_RADIO_OPERATION_STATUS_SUCCESS;
hal::NotifyFMRadioStatus(info);
NS_DispatchToMainThread(new RadioUpdate(FM_RADIO_OPERATION_SEEK,
rc < 0 ?
FM_RADIO_OPERATION_STATUS_FAIL :
FM_RADIO_OPERATION_STATUS_SUCCESS));
if (rc < 0) {
HAL_LOG(("Could not initiate hardware seek"));
return;
}
info.operation() = hal::FM_RADIO_OPERATION_TUNE;
info.status() = hal::FM_RADIO_OPERATION_STATUS_SUCCESS;
hal::NotifyFMRadioStatus(info);
NS_DispatchToMainThread(new RadioUpdate(FM_RADIO_OPERATION_TUNE,
FM_RADIO_OPERATION_STATUS_SUCCESS));
}
void
@ -450,11 +448,10 @@ SetFMRadioFrequency(const uint32_t frequency)
if (sMsmFMMode && rc >= 0)
return;
hal::FMRadioOperationInformation info;
info.operation() = hal::FM_RADIO_OPERATION_TUNE;
info.status() = rc < 0 ? hal::FM_RADIO_OPERATION_STATUS_FAIL :
hal::FM_RADIO_OPERATION_STATUS_SUCCESS;
hal::NotifyFMRadioStatus(info);
NS_DispatchToMainThread(new RadioUpdate(FM_RADIO_OPERATION_TUNE,
rc < 0 ?
FM_RADIO_OPERATION_STATUS_FAIL :
FM_RADIO_OPERATION_STATUS_SUCCESS));
}
uint32_t