Bug 1075727 - Return success/failure in hal::EnableRDS, r=dhylands

This commit is contained in:
Michael Wu 2014-10-14 15:16:22 -04:00
parent ca3efe3c25
commit 2543c4e388
5 changed files with 16 additions and 12 deletions

View File

@ -1112,10 +1112,10 @@ CancelFMRadioSeek() {
PROXY_IF_SANDBOXED(CancelFMRadioSeek()); PROXY_IF_SANDBOXED(CancelFMRadioSeek());
} }
void bool
EnableRDS(uint32_t aMask) { EnableRDS(uint32_t aMask) {
AssertMainThread(); AssertMainThread();
PROXY_IF_SANDBOXED(EnableRDS(aMask)); RETURN_PROXY_IF_SANDBOXED(EnableRDS(aMask), false);
} }
void void

View File

@ -584,7 +584,7 @@ hal::FMRadioSettings GetFMBandSettings(hal::FMRadioCountry aCountry);
/** /**
* Enable RDS data reception * Enable RDS data reception
*/ */
void EnableRDS(uint32_t aMask); bool EnableRDS(uint32_t aMask);
/** /**
* Disable RDS data reception * Disable RDS data reception

View File

@ -57,9 +57,11 @@ void
CancelFMRadioSeek() CancelFMRadioSeek()
{} {}
void bool
EnableRDS(uint32_t aMask) EnableRDS(uint32_t aMask)
{} {
return false;
}
void void
DisableRDS() DisableRDS()

View File

@ -636,23 +636,23 @@ readRDSDataThread(void* data)
static int sRDSPipeFD; static int sRDSPipeFD;
void bool
EnableRDS(uint32_t aMask) EnableRDS(uint32_t aMask)
{ {
if (!sRadioEnabled || !sRDSSupported) if (!sRadioEnabled || !sRDSSupported)
return; return false;
if (sMsmFMMode) if (sMsmFMMode)
setControl(V4L2_CID_PRIVATE_TAVARUA_RDSGROUP_MASK, aMask); setControl(V4L2_CID_PRIVATE_TAVARUA_RDSGROUP_MASK, aMask);
if (sRDSEnabled) if (sRDSEnabled)
return; return true;
int pipefd[2]; int pipefd[2];
int rc = pipe2(pipefd, O_NONBLOCK); int rc = pipe2(pipefd, O_NONBLOCK);
if (rc < 0) { if (rc < 0) {
HAL_LOG("Could not create RDS thread signaling pipes (%d)", rc); HAL_LOG("Could not create RDS thread signaling pipes (%d)", rc);
return; return false;
} }
ScopedClose writefd(pipefd[1]); ScopedClose writefd(pipefd[1]);
@ -661,7 +661,7 @@ EnableRDS(uint32_t aMask)
rc = setControl(V4L2_CID_RDS_RECEPTION, true); rc = setControl(V4L2_CID_RDS_RECEPTION, true);
if (rc < 0) { if (rc < 0) {
HAL_LOG("Could not enable RDS reception (%d)", rc); HAL_LOG("Could not enable RDS reception (%d)", rc);
return; return false;
} }
sRDSPipeFD = writefd; sRDSPipeFD = writefd;
@ -674,11 +674,12 @@ EnableRDS(uint32_t aMask)
HAL_LOG("Could not start RDS reception thread (%d)", rc); HAL_LOG("Could not start RDS reception thread (%d)", rc);
setControl(V4L2_CID_RDS_RECEPTION, false); setControl(V4L2_CID_RDS_RECEPTION, false);
sRDSEnabled = false; sRDSEnabled = false;
return; return false;
} }
readfd.forget(); readfd.forget();
writefd.forget(); writefd.forget();
return true;
} }
void void

View File

@ -426,10 +426,11 @@ CancelFMRadioSeek()
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts."); NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
} }
void bool
EnableRDS(uint32_t aMask) EnableRDS(uint32_t aMask)
{ {
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts."); NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
return false;
} }
void void