Bug 1075727 - Return success/failure in hal::EnableRDS, r=dhylands
authorMichael Wu <mwu@mozilla.com>
Tue, 14 Oct 2014 15:16:22 -0400
changeset 236796 5f053be160fb41543c72b7074b48381393a30f85
parent 236795 de6a6426c5940e3fa8bae70705b7762823c550cd
child 236797 28f02b49b5e6661398c51cb31b781060bc94c008
push id660
push userraliiev@mozilla.com
push dateWed, 18 Feb 2015 20:30:48 +0000
treeherdermozilla-release@49e493494178 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdhylands
bugs1075727
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1075727 - Return success/failure in hal::EnableRDS, r=dhylands
hal/Hal.cpp
hal/Hal.h
hal/fallback/FallbackFMRadio.cpp
hal/gonk/GonkFMRadio.cpp
hal/sandbox/SandboxHal.cpp
--- 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.");
 }