Bug 1075727 - Return success/failure in hal::EnableRDS, r=dhylands
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -1107,20 +1107,20 @@ GetFMRadioSignalStrength() {
}
void
CancelFMRadioSeek() {
AssertMainThread();
PROXY_IF_SANDBOXED(CancelFMRadioSeek());
}
-void
+bool
EnableRDS(uint32_t aMask) {
AssertMainThread();
- PROXY_IF_SANDBOXED(EnableRDS(aMask));
+ RETURN_PROXY_IF_SANDBOXED(EnableRDS(aMask), false);
}
void
DisableRDS() {
AssertMainThread();
PROXY_IF_SANDBOXED(DisableRDS());
}
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -579,17 +579,17 @@ void CancelFMRadioSeek();
/**
* Get FM radio band settings by country.
*/
hal::FMRadioSettings GetFMBandSettings(hal::FMRadioCountry aCountry);
/**
* Enable RDS data reception
*/
-void EnableRDS(uint32_t aMask);
+bool EnableRDS(uint32_t aMask);
/**
* Disable RDS data reception
*/
void DisableRDS();
/**
* Start a watchdog to compulsively shutdown the system if it hangs.
--- a/hal/fallback/FallbackFMRadio.cpp
+++ b/hal/fallback/FallbackFMRadio.cpp
@@ -52,18 +52,20 @@ GetFMRadioSignalStrength()
{
return 0;
}
void
CancelFMRadioSeek()
{}
-void
+bool
EnableRDS(uint32_t aMask)
-{}
+{
+ return false;
+}
void
DisableRDS()
{}
} // hal_impl
} // namespace mozilla
--- a/hal/gonk/GonkFMRadio.cpp
+++ b/hal/gonk/GonkFMRadio.cpp
@@ -631,59 +631,60 @@ readRDSDataThread(void* data)
}
}
return nullptr;
}
static int sRDSPipeFD;
-void
+bool
EnableRDS(uint32_t aMask)
{
if (!sRadioEnabled || !sRDSSupported)
- return;
+ return false;
if (sMsmFMMode)
setControl(V4L2_CID_PRIVATE_TAVARUA_RDSGROUP_MASK, aMask);
if (sRDSEnabled)
- return;
+ return true;
int pipefd[2];
int rc = pipe2(pipefd, O_NONBLOCK);
if (rc < 0) {
HAL_LOG("Could not create RDS thread signaling pipes (%d)", rc);
- return;
+ return false;
}
ScopedClose writefd(pipefd[1]);
ScopedClose readfd(pipefd[0]);
rc = setControl(V4L2_CID_RDS_RECEPTION, true);
if (rc < 0) {
HAL_LOG("Could not enable RDS reception (%d)", rc);
- return;
+ return false;
}
sRDSPipeFD = writefd;
sRDSEnabled = true;
rc = pthread_create(&sRDSThread, nullptr,
readRDSDataThread, (void*)pipefd[0]);
if (rc) {
HAL_LOG("Could not start RDS reception thread (%d)", rc);
setControl(V4L2_CID_RDS_RECEPTION, false);
sRDSEnabled = false;
- return;
+ return false;
}
readfd.forget();
writefd.forget();
+ return true;
}
void
DisableRDS()
{
if (!sRadioEnabled || !sRDSEnabled)
return;
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -421,20 +421,21 @@ GetFMRadioSignalStrength()
}
void
CancelFMRadioSeek()
{
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
}
-void
+bool
EnableRDS(uint32_t aMask)
{
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
+ return false;
}
void
DisableRDS()
{
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
}