Bug 1315798 - Remove FMRADIO support from HAL. r=dhylands draft
authorMichelangelo De Simone <mdesimone@mozilla.com>
Mon, 07 Nov 2016 14:09:57 -0800
changeset 437151 8bd0b75cfb7db5731abe43b9d5fcb99f7b29e211
parent 437137 d2e33428e45718bbeff192e80fd3a75ad264210d
child 536585 7d837202d38201004133d9fcece8366a0a13f203
push id35354
push usermdesimone@mozilla.com
push dateThu, 10 Nov 2016 15:27:26 +0000
reviewersdhylands
bugs1315798
milestone52.0a1
Bug 1315798 - Remove FMRADIO support from HAL. r=dhylands MozReview-Commit-ID: E6KGgMd8Cfg
dom/apps/PermissionsTable.jsm
dom/system/gonk/AudioManager.cpp
dom/system/gonk/nsIAudioManager.idl
hal/Hal.cpp
hal/Hal.h
hal/HalTypes.h
hal/fallback/FallbackFMRadio.cpp
hal/gonk/GonkFMRadio.cpp
hal/moz.build
hal/sandbox/PHal.ipdl
hal/sandbox/SandboxHal.cpp
--- a/dom/apps/PermissionsTable.jsm
+++ b/dom/apps/PermissionsTable.jsm
@@ -167,21 +167,16 @@ this.PermissionsTable =  { geolocation: 
                              certified: DENY_ACTION,
                              additional: ["indexedDB-chrome-settings", "settings-api"]
                            },
                            permissions: {
                              app: DENY_ACTION,
                              privileged: DENY_ACTION,
                              certified: ALLOW_ACTION
                            },
-                           fmradio: {
-                             app: DENY_ACTION,
-                             privileged: ALLOW_ACTION,
-                             certified: ALLOW_ACTION
-                           },
                            attention: {
                              app: DENY_ACTION,
                              privileged: DENY_ACTION,
                              certified: ALLOW_ACTION
                            },
                            "global-clickthrough-overlay": {
                              app: DENY_ACTION,
                              privileged: ALLOW_ACTION,
--- a/dom/system/gonk/AudioManager.cpp
+++ b/dom/system/gonk/AudioManager.cpp
@@ -884,45 +884,16 @@ AudioManager::GetForceForUse(int32_t aUs
    return NS_OK;
 #else
   NS_NOTREACHED("Doesn't support force routing on GB version");
   return NS_ERROR_UNEXPECTED;
 #endif
 }
 
 NS_IMETHODIMP
-AudioManager::GetFmRadioAudioEnabled(bool *aFmRadioAudioEnabled)
-{
-  *aFmRadioAudioEnabled = IsFmOutConnected();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-AudioManager::SetFmRadioAudioEnabled(bool aFmRadioAudioEnabled)
-{
-  UpdateDeviceConnectionState(aFmRadioAudioEnabled,
-                              AUDIO_DEVICE_OUT_FM,
-                              NS_LITERAL_CSTRING(""));
-  // AUDIO_STREAM_FM is not used on recent gonk.
-  // AUDIO_STREAM_MUSIC is used for FM radio volume control.
-#if ANDROID_VERSION < 19
-  // sync volume with music after powering on fm radio
-  if (aFmRadioAudioEnabled) {
-    uint32_t volIndex = mStreamStates[AUDIO_STREAM_MUSIC]->GetVolumeIndex();
-    nsresult rv = mStreamStates[AUDIO_STREAM_FM]->
-      SetVolumeIndex(volIndex, AUDIO_DEVICE_OUT_FM);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return rv;
-    }
-  }
-#endif
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 AudioManager::SetAudioChannelVolume(uint32_t aChannel, uint32_t aIndex)
 {
   if (aChannel >= NUMBER_OF_AUDIO_CHANNELS) {
     return NS_ERROR_INVALID_ARG;
   }
 
   return SetStreamVolumeIndex(sChannelStreamTbl[aChannel], aIndex);
 }
--- a/dom/system/gonk/nsIAudioManager.idl
+++ b/dom/system/gonk/nsIAudioManager.idl
@@ -8,21 +8,16 @@
 interface nsIAudioManager : nsISupports
 {
   /**
    * Microphone muted?
    */
   attribute boolean microphoneMuted;
 
   /**
-   * Are we playing audio from the FM radio?
-   */
-  attribute boolean fmRadioAudioEnabled;
-
-  /**
    * Set the phone's audio mode.
    */
   const long PHONE_STATE_INVALID          = -2;
   const long PHONE_STATE_CURRENT          = -1;
   const long PHONE_STATE_NORMAL           = 0;
   const long PHONE_STATE_RINGTONE         = 1;
   const long PHONE_STATE_IN_CALL          = 2;
   const long PHONE_STATE_IN_COMMUNICATION = 3;
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -942,253 +942,16 @@ ThreadPriorityToString(ThreadPriority aP
     case THREAD_PRIORITY_COMPOSITOR:
       return "COMPOSITOR";
     default:
       MOZ_ASSERT(false);
       return "???";
   }
 }
 
-static StaticAutoPtr<ObserverList<FMRadioOperationInformation> > sFMRadioObservers;
-static StaticAutoPtr<ObserverList<FMRadioRDSGroup> > sFMRadioRDSObservers;
-
-static void
-InitializeFMRadioObserver()
-{
-  if (!sFMRadioObservers) {
-    sFMRadioObservers = new ObserverList<FMRadioOperationInformation>;
-    sFMRadioRDSObservers = new ObserverList<FMRadioRDSGroup>;
-    ClearOnShutdown(&sFMRadioRDSObservers);
-    ClearOnShutdown(&sFMRadioObservers);
-  }
-}
-
-void
-RegisterFMRadioObserver(FMRadioObserver* aFMRadioObserver) {
-  AssertMainThread();
-  InitializeFMRadioObserver();
-  sFMRadioObservers->AddObserver(aFMRadioObserver);
-}
-
-void
-UnregisterFMRadioObserver(FMRadioObserver* aFMRadioObserver) {
-  AssertMainThread();
-  InitializeFMRadioObserver();
-  sFMRadioObservers->RemoveObserver(aFMRadioObserver);
-}
-
-void
-NotifyFMRadioStatus(const FMRadioOperationInformation& aFMRadioState) {
-  InitializeFMRadioObserver();
-  sFMRadioObservers->Broadcast(aFMRadioState);
-}
-
-void
-RegisterFMRadioRDSObserver(FMRadioRDSObserver* aFMRadioRDSObserver) {
-  AssertMainThread();
-  InitializeFMRadioObserver();
-  sFMRadioRDSObservers->AddObserver(aFMRadioRDSObserver);
-}
-
-void
-UnregisterFMRadioRDSObserver(FMRadioRDSObserver* aFMRadioRDSObserver) {
-  AssertMainThread();
-  InitializeFMRadioObserver();
-  sFMRadioRDSObservers->RemoveObserver(aFMRadioRDSObserver);
-}
-
-
-void
-NotifyFMRadioRDSGroup(const FMRadioRDSGroup& aRDSGroup) {
-  InitializeFMRadioObserver();
-  sFMRadioRDSObservers->Broadcast(aRDSGroup);
-}
-
-void
-EnableFMRadio(const FMRadioSettings& aInfo) {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(EnableFMRadio(aInfo));
-}
-
-void
-DisableFMRadio() {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(DisableFMRadio());
-}
-
-void
-FMRadioSeek(const FMRadioSeekDirection& aDirection) {
-  PROXY_IF_SANDBOXED(FMRadioSeek(aDirection));
-}
-
-void
-GetFMRadioSettings(FMRadioSettings* aInfo) {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(GetFMRadioSettings(aInfo));
-}
-
-void
-SetFMRadioFrequency(const uint32_t aFrequency) {
-  PROXY_IF_SANDBOXED(SetFMRadioFrequency(aFrequency));
-}
-
-uint32_t
-GetFMRadioFrequency() {
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(GetFMRadioFrequency(), 0);
-}
-
-bool
-IsFMRadioOn() {
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(IsFMRadioOn(), false);
-}
-
-uint32_t
-GetFMRadioSignalStrength() {
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(GetFMRadioSignalStrength(), 0);
-}
-
-void
-CancelFMRadioSeek() {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(CancelFMRadioSeek());
-}
-
-bool
-EnableRDS(uint32_t aMask) {
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(EnableRDS(aMask), false);
-}
-
-void
-DisableRDS() {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(DisableRDS());
-}
-
-FMRadioSettings
-GetFMBandSettings(FMRadioCountry aCountry) {
-  FMRadioSettings settings;
-
-  switch (aCountry) {
-    case FM_RADIO_COUNTRY_US:
-    case FM_RADIO_COUNTRY_EU:
-      settings.upperLimit() = 108000;
-      settings.lowerLimit() = 87800;
-      settings.spaceType() = 200;
-      settings.preEmphasis() = 75;
-      break;
-    case FM_RADIO_COUNTRY_JP_STANDARD:
-      settings.upperLimit() = 76000;
-      settings.lowerLimit() = 90000;
-      settings.spaceType() = 100;
-      settings.preEmphasis() = 50;
-      break;
-    case FM_RADIO_COUNTRY_CY:
-    case FM_RADIO_COUNTRY_DE:
-    case FM_RADIO_COUNTRY_DK:
-    case FM_RADIO_COUNTRY_ES:
-    case FM_RADIO_COUNTRY_FI:
-    case FM_RADIO_COUNTRY_FR:
-    case FM_RADIO_COUNTRY_HU:
-    case FM_RADIO_COUNTRY_IR:
-    case FM_RADIO_COUNTRY_IT:
-    case FM_RADIO_COUNTRY_KW:
-    case FM_RADIO_COUNTRY_LT:
-    case FM_RADIO_COUNTRY_ML:
-    case FM_RADIO_COUNTRY_NO:
-    case FM_RADIO_COUNTRY_OM:
-    case FM_RADIO_COUNTRY_PG:
-    case FM_RADIO_COUNTRY_NL:
-    case FM_RADIO_COUNTRY_CZ:
-    case FM_RADIO_COUNTRY_UK:
-    case FM_RADIO_COUNTRY_RW:
-    case FM_RADIO_COUNTRY_SN:
-    case FM_RADIO_COUNTRY_SI:
-    case FM_RADIO_COUNTRY_ZA:
-    case FM_RADIO_COUNTRY_SE:
-    case FM_RADIO_COUNTRY_CH:
-    case FM_RADIO_COUNTRY_TW:
-    case FM_RADIO_COUNTRY_UA:
-      settings.upperLimit() = 108000;
-      settings.lowerLimit() = 87500;
-      settings.spaceType() = 100;
-      settings.preEmphasis() = 50;
-      break;
-    case FM_RADIO_COUNTRY_VA:
-    case FM_RADIO_COUNTRY_MA:
-    case FM_RADIO_COUNTRY_TR:
-      settings.upperLimit() = 10800;
-      settings.lowerLimit() = 87500;
-      settings.spaceType() = 100;
-      settings.preEmphasis() = 75;
-      break;
-    case FM_RADIO_COUNTRY_AU:
-    case FM_RADIO_COUNTRY_BD:
-      settings.upperLimit() = 108000;
-      settings.lowerLimit() = 87500;
-      settings.spaceType() = 200;
-      settings.preEmphasis() = 75;
-      break;
-    case FM_RADIO_COUNTRY_AW:
-    case FM_RADIO_COUNTRY_BS:
-    case FM_RADIO_COUNTRY_CO:
-    case FM_RADIO_COUNTRY_KR:
-      settings.upperLimit() = 108000;
-      settings.lowerLimit() = 88000;
-      settings.spaceType() = 200;
-      settings.preEmphasis() = 75;
-      break;
-    case FM_RADIO_COUNTRY_EC:
-      settings.upperLimit() = 108000;
-      settings.lowerLimit() = 88000;
-      settings.spaceType() = 200;
-      settings.preEmphasis() = 0;
-      break;
-    case FM_RADIO_COUNTRY_GM:
-      settings.upperLimit() = 108000;
-      settings.lowerLimit() = 88000;
-      settings.spaceType() = 0;
-      settings.preEmphasis() = 75;
-      break;
-    case FM_RADIO_COUNTRY_QA:
-      settings.upperLimit() = 108000;
-      settings.lowerLimit() = 88000;
-      settings.spaceType() = 200;
-      settings.preEmphasis() = 50;
-      break;
-    case FM_RADIO_COUNTRY_SG:
-      settings.upperLimit() = 108000;
-      settings.lowerLimit() = 88000;
-      settings.spaceType() = 200;
-      settings.preEmphasis() = 50;
-      break;
-    case FM_RADIO_COUNTRY_IN:
-      settings.upperLimit() = 100000;
-      settings.lowerLimit() = 108000;
-      settings.spaceType() = 100;
-      settings.preEmphasis() = 50;
-      break;
-    case FM_RADIO_COUNTRY_NZ:
-      settings.upperLimit() = 100000;
-      settings.lowerLimit() = 88000;
-      settings.spaceType() = 50;
-      settings.preEmphasis() = 50;
-      break;
-    case FM_RADIO_COUNTRY_USER_DEFINED:
-      break;
-    default:
-      MOZ_ASSERT(0);
-      break;
-    }
-    return settings;
-}
-
 void FactoryReset(mozilla::dom::FactoryResetReason& aReason)
 {
   AssertMainThread();
   PROXY_IF_SANDBOXED(FactoryReset(aReason));
 }
 
 void
 StartDiskSpaceWatcher()
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -490,114 +490,16 @@ void SetCurrentThreadPriority(hal::Threa
  * Set a thread priority to appropriate platform-specific value for
  * given functionality. Instead of providing arbitrary priority numbers you
  * must specify a type of function like THREAD_PRIORITY_COMPOSITOR.
  */
 void SetThreadPriority(PlatformThreadId aThreadId,
                        hal::ThreadPriority aThreadPriority);
 
 /**
- * Register an observer for the FM radio.
- */
-void RegisterFMRadioObserver(hal::FMRadioObserver* aRadioObserver);
-
-/**
- * Unregister the observer for the FM radio.
- */
-void UnregisterFMRadioObserver(hal::FMRadioObserver* aRadioObserver);
-
-/**
- * Register an observer for the FM radio.
- */
-void RegisterFMRadioRDSObserver(hal::FMRadioRDSObserver* aRDSObserver);
-
-/**
- * Unregister the observer for the FM radio.
- */
-void UnregisterFMRadioRDSObserver(hal::FMRadioRDSObserver* aRDSObserver);
-
-/**
- * Notify observers that a call to EnableFMRadio, DisableFMRadio, or FMRadioSeek
- * has completed, and indicate what the call returned.
- */
-void NotifyFMRadioStatus(const hal::FMRadioOperationInformation& aRadioState);
-
-/**
- * Notify observers of new RDS data
- * This can be called on any thread.
- */
-void NotifyFMRadioRDSGroup(const hal::FMRadioRDSGroup& aRDSGroup);
-
-/**
- * Enable the FM radio and configure it according to the settings in aInfo.
- */
-void EnableFMRadio(const hal::FMRadioSettings& aInfo);
-
-/**
- * Disable the FM radio.
- */
-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);
-
-/**
- * Get the current FM radio settings.
- */
-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);
-
-/**
- * Get the FM radio's frequency.
- */
-uint32_t GetFMRadioFrequency();
-
-/**
- * Get FM radio power state
- */
-bool IsFMRadioOn();
-
-/**
- * Get FM radio signal strength
- */
-uint32_t GetFMRadioSignalStrength();
-
-/**
- * Cancel FM radio seeking
- */
-void CancelFMRadioSeek();
-
-/**
- * Get FM radio band settings by country.
- */
-hal::FMRadioSettings GetFMBandSettings(hal::FMRadioCountry aCountry);
-
-/**
- * Enable RDS data reception
- */
-MOZ_MUST_USE bool EnableRDS(uint32_t aMask);
-
-/**
- * Disable RDS data reception
- */
-void DisableRDS();
-
-/**
  * Start a watchdog to compulsively shutdown the system if it hangs.
  * @param aMode Specify how to shutdown the system.
  * @param aTimeoutSecs Specify the delayed seconds to shutdown the system.
  *
  * This API is currently only allowed to be used from the main process.
  */
 void StartForceQuitWatchdog(hal::ShutdownMode aMode, int32_t aTimeoutSecs);
 
--- a/hal/HalTypes.h
+++ b/hal/HalTypes.h
@@ -109,95 +109,16 @@ ThreadPriorityToString(ThreadPriority aP
  */
 enum WakeLockControl {
   WAKE_LOCK_REMOVE_ONE = -1,
   WAKE_LOCK_NO_CHANGE  = 0,
   WAKE_LOCK_ADD_ONE    = 1,
   NUM_WAKE_LOCK
 };
 
-class FMRadioOperationInformation;
-
-enum FMRadioOperation {
-  FM_RADIO_OPERATION_UNKNOWN = -1,
-  FM_RADIO_OPERATION_ENABLE,
-  FM_RADIO_OPERATION_DISABLE,
-  FM_RADIO_OPERATION_SEEK,
-  FM_RADIO_OPERATION_TUNE,
-  NUM_FM_RADIO_OPERATION
-};
-
-enum FMRadioOperationStatus {
-  FM_RADIO_OPERATION_STATUS_UNKNOWN = -1,
-  FM_RADIO_OPERATION_STATUS_SUCCESS,
-  FM_RADIO_OPERATION_STATUS_FAIL,
-  NUM_FM_RADIO_OPERATION_STATUS
-};
-
-enum FMRadioSeekDirection {
-  FM_RADIO_SEEK_DIRECTION_UNKNOWN = -1,
-  FM_RADIO_SEEK_DIRECTION_UP,
-  FM_RADIO_SEEK_DIRECTION_DOWN,
-  NUM_FM_RADIO_SEEK_DIRECTION
-};
-
-enum FMRadioCountry {
-  FM_RADIO_COUNTRY_UNKNOWN = -1,
-  FM_RADIO_COUNTRY_US,  //USA
-  FM_RADIO_COUNTRY_EU,
-  FM_RADIO_COUNTRY_JP_STANDARD,
-  FM_RADIO_COUNTRY_JP_WIDE,
-  FM_RADIO_COUNTRY_DE,  //Germany
-  FM_RADIO_COUNTRY_AW,  //Aruba
-  FM_RADIO_COUNTRY_AU,  //Australlia
-  FM_RADIO_COUNTRY_BS,  //Bahamas
-  FM_RADIO_COUNTRY_BD,  //Bangladesh
-  FM_RADIO_COUNTRY_CY,  //Cyprus
-  FM_RADIO_COUNTRY_VA,  //Vatican
-  FM_RADIO_COUNTRY_CO,  //Colombia
-  FM_RADIO_COUNTRY_KR,  //Korea
-  FM_RADIO_COUNTRY_DK,  //Denmark
-  FM_RADIO_COUNTRY_EC,  //Ecuador
-  FM_RADIO_COUNTRY_ES,  //Spain
-  FM_RADIO_COUNTRY_FI,  //Finland
-  FM_RADIO_COUNTRY_FR,  //France
-  FM_RADIO_COUNTRY_GM,  //Gambia
-  FM_RADIO_COUNTRY_HU,  //Hungary
-  FM_RADIO_COUNTRY_IN,  //India
-  FM_RADIO_COUNTRY_IR,  //Iran
-  FM_RADIO_COUNTRY_IT,  //Italy
-  FM_RADIO_COUNTRY_KW,  //Kuwait
-  FM_RADIO_COUNTRY_LT,  //Lithuania
-  FM_RADIO_COUNTRY_ML,  //Mali
-  FM_RADIO_COUNTRY_MA,  //Morocco
-  FM_RADIO_COUNTRY_NO,  //Norway
-  FM_RADIO_COUNTRY_NZ,  //New Zealand
-  FM_RADIO_COUNTRY_OM,  //Oman
-  FM_RADIO_COUNTRY_PG,  //Papua New Guinea
-  FM_RADIO_COUNTRY_NL,  //Netherlands
-  FM_RADIO_COUNTRY_QA,  //Qatar
-  FM_RADIO_COUNTRY_CZ,  //Czech Republic
-  FM_RADIO_COUNTRY_UK,  //United Kingdom of Great Britain and Northern Ireland
-  FM_RADIO_COUNTRY_RW,  //Rwandese Republic
-  FM_RADIO_COUNTRY_SN,  //Senegal
-  FM_RADIO_COUNTRY_SG,  //Singapore
-  FM_RADIO_COUNTRY_SI,  //Slovenia
-  FM_RADIO_COUNTRY_ZA,  //South Africa
-  FM_RADIO_COUNTRY_SE,  //Sweden
-  FM_RADIO_COUNTRY_CH,  //Switzerland
-  FM_RADIO_COUNTRY_TW,  //Taiwan
-  FM_RADIO_COUNTRY_TR,  //Turkey
-  FM_RADIO_COUNTRY_UA,  //Ukraine
-  FM_RADIO_COUNTRY_USER_DEFINED,
-  NUM_FM_RADIO_COUNTRY
-};
-
-class FMRadioRDSGroup;
-typedef Observer<FMRadioOperationInformation> FMRadioObserver;
-typedef Observer<FMRadioRDSGroup> FMRadioRDSObserver;
 } // namespace hal
 } // namespace mozilla
 
 namespace IPC {
 
 /**
  * Serializer for ShutdownMode.
  */
@@ -245,55 +166,12 @@ struct ParamTraits<mozilla::hal::SwitchD
 template <>
 struct ParamTraits<mozilla::hal::ProcessPriority>:
   public ContiguousEnumSerializer<
            mozilla::hal::ProcessPriority,
            mozilla::hal::PROCESS_PRIORITY_UNKNOWN,
            mozilla::hal::NUM_PROCESS_PRIORITY> {
 };
 
-/**
- * Serializer for FMRadioOperation
- */
-template <>
-struct ParamTraits<mozilla::hal::FMRadioOperation>:
-  public ContiguousEnumSerializer<
-           mozilla::hal::FMRadioOperation,
-           mozilla::hal::FM_RADIO_OPERATION_UNKNOWN,
-           mozilla::hal::NUM_FM_RADIO_OPERATION>
-{};
-
-/**
- * Serializer for FMRadioOperationStatus
- */
-template <>
-struct ParamTraits<mozilla::hal::FMRadioOperationStatus>:
-  public ContiguousEnumSerializer<
-           mozilla::hal::FMRadioOperationStatus,
-           mozilla::hal::FM_RADIO_OPERATION_STATUS_UNKNOWN,
-           mozilla::hal::NUM_FM_RADIO_OPERATION_STATUS>
-{};
-
-/**
- * Serializer for FMRadioSeekDirection
- */
-template <>
-struct ParamTraits<mozilla::hal::FMRadioSeekDirection>:
-  public ContiguousEnumSerializer<
-           mozilla::hal::FMRadioSeekDirection,
-           mozilla::hal::FM_RADIO_SEEK_DIRECTION_UNKNOWN,
-           mozilla::hal::NUM_FM_RADIO_SEEK_DIRECTION>
-{};
-
-/**
- * Serializer for FMRadioCountry
- **/
-template <>
-struct ParamTraits<mozilla::hal::FMRadioCountry>:
-  public ContiguousEnumSerializer<
-           mozilla::hal::FMRadioCountry,
-           mozilla::hal::FM_RADIO_COUNTRY_UNKNOWN,
-           mozilla::hal::NUM_FM_RADIO_COUNTRY>
-{};
 
 } // namespace IPC
 
 #endif // mozilla_hal_Types_h
deleted file mode 100644
--- a/hal/fallback/FallbackFMRadio.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set sw=2 ts=8 et ft=cpp : */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "Hal.h"
-
-namespace mozilla {
-namespace hal_impl {
-
-void
-EnableFMRadio(const hal::FMRadioSettings& aInfo)
-{}
-
-void
-DisableFMRadio()
-{}
-
-void
-FMRadioSeek(const hal::FMRadioSeekDirection& aDirection)
-{}
-
-void
-GetFMRadioSettings(hal::FMRadioSettings* aInfo)
-{
-  aInfo->country() = hal::FM_RADIO_COUNTRY_UNKNOWN;
-  aInfo->upperLimit() = 0;
-  aInfo->lowerLimit() = 0;
-  aInfo->spaceType() = 0;
-  aInfo->preEmphasis() = 0;
-}
-
-void
-SetFMRadioFrequency(const uint32_t frequency)
-{}
-
-uint32_t
-GetFMRadioFrequency()
-{
-  return 0;
-}
-
-bool
-IsFMRadioOn()
-{
-  return false;
-}
-
-uint32_t
-GetFMRadioSignalStrength()
-{
-  return 0;
-}
-
-void
-CancelFMRadioSeek()
-{}
-
-bool
-EnableRDS(uint32_t aMask)
-{
-  return false;
-}
-
-void
-DisableRDS()
-{}
-
-} // namespace hal_impl
-} // namespace mozilla
deleted file mode 100644
--- a/hal/gonk/GonkFMRadio.cpp
+++ /dev/null
@@ -1,718 +0,0 @@
-/* Copyright 2012 Mozilla Foundation and Mozilla contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Hal.h"
-#include "HalLog.h"
-#include "tavarua.h"
-#include "nsThreadUtils.h"
-#include "mozilla/FileUtils.h"
-
-#include <cutils/properties.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <linux/videodev2.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/epoll.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-/* Bionic might not have the newer version of the v4l2 headers that
- * define these controls, so we define them here if they're not found.
- */
-
-#ifndef V4L2_CTRL_CLASS_FM_RX
-#define V4L2_CTRL_CLASS_FM_RX 0x00a10000
-#define V4L2_CID_FM_RX_CLASS_BASE (V4L2_CTRL_CLASS_FM_RX | 0x900)
-#define V4L2_CID_TUNE_DEEMPHASIS  (V4L2_CID_FM_RX_CLASS_BASE + 1)
-#define V4L2_DEEMPHASIS_DISABLED  0
-#define V4L2_DEEMPHASIS_50_uS     1
-#define V4L2_DEEMPHASIS_75_uS     2
-#define V4L2_CID_RDS_RECEPTION    (V4L2_CID_FM_RX_CLASS_BASE + 2)
-#endif
-
-#ifndef V4L2_RDS_BLOCK_MSK
-struct v4l2_rds_data {
-  uint8_t lsb;
-  uint8_t msb;
-  uint8_t block;
-} __attribute__ ((packed));
-#define V4L2_RDS_BLOCK_MSK 0x7
-#define V4L2_RDS_BLOCK_A 0
-#define V4L2_RDS_BLOCK_B 1
-#define V4L2_RDS_BLOCK_C 2
-#define V4L2_RDS_BLOCK_D 3
-#define V4L2_RDS_BLOCK_C_ALT 4
-#define V4L2_RDS_BLOCK_INVALID 7
-#define V4L2_RDS_BLOCK_CORRECTED 0x40
-#define V4L2_RDS_BLOCK_ERROR 0x80
-#endif
-
-#ifndef VIDIOC_S_HW_FREQ_SEEK
-struct v4l2_hw_freq_seek {
- __u32 tuner;
- __u32 type;
- __u32 seek_upward;
- __u32 wrap_around;
- __u32 spacing;
- __u32 rangelow;
- __u32 rangehigh;
- __u32 reserved[5];
-};
-#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
-#endif
-
-namespace mozilla {
-namespace hal_impl {
-
-uint32_t GetFMRadioFrequency();
-
-static int sRadioFD;
-static bool sRadioEnabled;
-static bool sRDSEnabled;
-static pthread_t sRadioThread;
-static pthread_t sRDSThread;
-static hal::FMRadioSettings sRadioSettings;
-static int sMsmFMVersion;
-static bool sMsmFMMode;
-static bool sRDSSupported;
-
-static int
-setControl(uint32_t id, int32_t value)
-{
-  struct v4l2_control control = {0};
-  control.id = id;
-  control.value = value;
-  return ioctl(sRadioFD, VIDIOC_S_CTRL, &control);
-}
-
-class RadioUpdate : public Runnable {
-  hal::FMRadioOperation mOp;
-  hal::FMRadioOperationStatus mStatus;
-public:
-  RadioUpdate(hal::FMRadioOperation op, hal::FMRadioOperationStatus status)
-    : mOp(op)
-    , mStatus(status)
-  {}
-
-  NS_IMETHOD Run() override {
-    hal::FMRadioOperationInformation info;
-    info.operation() = mOp;
-    info.status() = mStatus;
-    info.frequency() = GetFMRadioFrequency();
-    hal::NotifyFMRadioStatus(info);
-    return NS_OK;
-  }
-};
-
-/* Runs on the radio thread */
-static void
-initMsmFMRadio(hal::FMRadioSettings &aInfo)
-{
-  mozilla::ScopedClose fd(sRadioFD);
-  char version[64];
-  int rc;
-  snprintf(version, sizeof(version), "%d", sMsmFMVersion);
-  property_set("hw.fm.version", version);
-
-  /* Set the mode for soc downloader */
-  property_set("hw.fm.mode", "normal");
-  /* start fm_dl service */
-  property_set("ctl.start", "fm_dl");
-
-  /*
-   * Fix bug 800263. Wait until the FM radio chips initialization is done
-   * then set other properties, or the system will hang and reboot. This
-   * work around is from codeaurora
-   * (git://codeaurora.org/platform/frameworks/base.git).
-   */
-  for (int i = 0; i < 4; ++i) {
-    sleep(1);
-    char value[PROPERTY_VALUE_MAX];
-    property_get("hw.fm.init", value, "0");
-    if (!strcmp(value, "1")) {
-      break;
-    }
-  }
-
-  rc = setControl(V4L2_CID_PRIVATE_TAVARUA_STATE, FM_RECV);
-  if (rc < 0) {
-    HAL_LOG("Unable to turn on radio |%s|", strerror(errno));
-    return;
-  }
-
-  int preEmphasis = aInfo.preEmphasis() <= 50;
-  rc = setControl(V4L2_CID_PRIVATE_TAVARUA_EMPHASIS, preEmphasis);
-  if (rc) {
-    HAL_LOG("Unable to configure preemphasis");
-    return;
-  }
-
-  rc = setControl(V4L2_CID_PRIVATE_TAVARUA_RDS_STD, 0);
-  if (rc) {
-    HAL_LOG("Unable to configure RDS");
-    return;
-  }
-
-  int spacing;
-  switch (aInfo.spaceType()) {
-  case 50:
-    spacing = FM_CH_SPACE_50KHZ;
-    break;
-  case 100:
-    spacing = FM_CH_SPACE_100KHZ;
-    break;
-  case 200:
-    spacing = FM_CH_SPACE_200KHZ;
-    break;
-  default:
-    HAL_LOG("Unsupported space value - %d", aInfo.spaceType());
-    return;
-  }
-
-  rc = setControl(V4L2_CID_PRIVATE_TAVARUA_SPACING, spacing);
-  if (rc) {
-    HAL_LOG("Unable to configure spacing");
-    return;
-  }
-
-  /*
-   * Frequency conversions
-   *
-   * HAL uses units of 1k for frequencies
-   * V4L2 uses units of 62.5kHz
-   * Multiplying by (10000 / 625) converts from HAL units to V4L2.
-   */
-
-  struct v4l2_tuner tuner = {0};
-  tuner.rangelow = (aInfo.lowerLimit() * 10000) / 625;
-  tuner.rangehigh = (aInfo.upperLimit() * 10000) / 625;
-  tuner.audmode = V4L2_TUNER_MODE_STEREO;
-  rc = ioctl(fd, VIDIOC_S_TUNER, &tuner);
-  if (rc < 0) {
-    HAL_LOG("Unable to adjust band limits");
-    return;
-  }
-
-  rc = setControl(V4L2_CID_PRIVATE_TAVARUA_REGION, TAVARUA_REGION_OTHER);
-  if (rc < 0) {
-    HAL_LOG("Unable to configure region");
-    return;
-  }
-
-  // Some devices do not support analog audio routing. This should be
-  // indicated by the 'ro.moz.fm.noAnalog' property at build time.
-  char propval[PROPERTY_VALUE_MAX];
-  property_get("ro.moz.fm.noAnalog", propval, "");
-  bool noAnalog = !strcmp(propval, "true");
-
-  rc = setControl(V4L2_CID_PRIVATE_TAVARUA_SET_AUDIO_PATH,
-                  noAnalog ? FM_DIGITAL_PATH : FM_ANALOG_PATH);
-  if (rc < 0) {
-    HAL_LOG("Unable to set audio path");
-    return;
-  }
-
-  if (!noAnalog) {
-    /* Set the mode for soc downloader */
-    property_set("hw.fm.mode", "config_dac");
-    /* Use analog mode FM */
-    property_set("hw.fm.isAnalog", "true");
-    /* start fm_dl service */
-    property_set("ctl.start", "fm_dl");
-
-    for (int i = 0; i < 4; ++i) {
-      sleep(1);
-      char value[PROPERTY_VALUE_MAX];
-      property_get("hw.fm.init", value, "0");
-      if (!strcmp(value, "1")) {
-        break;
-      }
-    }
-  }
-
-  fd.forget();
-  sRadioEnabled = true;
-}
-
-/* Runs on the radio thread */
-static void *
-runMsmFMRadio(void *)
-{
-  initMsmFMRadio(sRadioSettings);
-  if (!sRadioEnabled) {
-    NS_DispatchToMainThread(new RadioUpdate(hal::FM_RADIO_OPERATION_ENABLE,
-                                            hal::FM_RADIO_OPERATION_STATUS_FAIL));
-    return nullptr;
-  }
-
-  uint8_t buf[128];
-  struct v4l2_buffer buffer = {0};
-  buffer.index = 1;
-  buffer.type = V4L2_BUF_TYPE_PRIVATE;
-  buffer.length = sizeof(buf);
-  buffer.m.userptr = (long unsigned int)buf;
-
-  while (sRadioEnabled) {
-    if (ioctl(sRadioFD, VIDIOC_DQBUF, &buffer) < 0) {
-      if (errno == EINTR)
-        continue;
-      break;
-    }
-
-    /* The tavarua driver reports a number of things asynchronously.
-     * In those cases, the status update comes from this thread. */
-    for (unsigned int i = 0; i < buffer.bytesused; i++) {
-      switch (buf[i]) {
-      case TAVARUA_EVT_RADIO_READY:
-        // 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,
-                                                hal::FM_RADIO_OPERATION_STATUS_SUCCESS));
-        break;
-      case TAVARUA_EVT_TUNE_SUCC:
-        NS_DispatchToMainThread(new RadioUpdate(hal::FM_RADIO_OPERATION_TUNE,
-                                                hal::FM_RADIO_OPERATION_STATUS_SUCCESS));
-        break;
-      default:
-        break;
-      }
-    }
-  }
-
-  return nullptr;
-}
-
-/* This runs on the main thread but most of the
- * initialization is pushed to the radio thread. */
-void
-EnableFMRadio(const hal::FMRadioSettings& aInfo)
-{
-  if (sRadioEnabled) {
-    HAL_LOG("Radio already enabled!");
-    return;
-  }
-
-  hal::FMRadioOperationInformation info;
-  info.operation() = hal::FM_RADIO_OPERATION_ENABLE;
-  info.status() = hal::FM_RADIO_OPERATION_STATUS_FAIL;
-
-  mozilla::ScopedClose fd(open("/dev/radio0", O_RDWR));
-  if (fd < 0) {
-    HAL_LOG("Unable to open radio device");
-    hal::NotifyFMRadioStatus(info);
-    return;
-  }
-
-  struct v4l2_capability cap = {{0}};
-  int rc = ioctl(fd, VIDIOC_QUERYCAP, &cap);
-  if (rc < 0) {
-    HAL_LOG("Unable to query radio device");
-    hal::NotifyFMRadioStatus(info);
-    return;
-  }
-
-  sMsmFMMode = !strcmp((char *)cap.driver, "radio-tavarua") ||
-      !strcmp((char *)cap.driver, "radio-iris");
-  HAL_LOG("Radio: %s (%s)\n", cap.driver, cap.card);
-
-  if (!(cap.capabilities & V4L2_CAP_RADIO)) {
-    HAL_LOG("/dev/radio0 isn't a radio");
-    hal::NotifyFMRadioStatus(info);
-    return;
-  }
-
-  if (!(cap.capabilities & V4L2_CAP_TUNER)) {
-    HAL_LOG("/dev/radio0 doesn't support the tuner interface");
-    hal::NotifyFMRadioStatus(info);
-    return;
-  }
-
-  sRDSSupported = cap.capabilities & V4L2_CAP_RDS_CAPTURE;
-  sRadioSettings = aInfo;
-
-  if (sMsmFMMode) {
-    sRadioFD = fd.forget();
-    sMsmFMVersion = cap.version;
-    if (pthread_create(&sRadioThread, nullptr, runMsmFMRadio, nullptr)) {
-      HAL_LOG("Couldn't create radio thread");
-      hal::NotifyFMRadioStatus(info);
-    }
-    return;
-  }
-
-  struct v4l2_tuner tuner = {0};
-  tuner.type = V4L2_TUNER_RADIO;
-  tuner.rangelow = (aInfo.lowerLimit() * 10000) / 625;
-  tuner.rangehigh = (aInfo.upperLimit() * 10000) / 625;
-  tuner.audmode = V4L2_TUNER_MODE_STEREO;
-  rc = ioctl(fd, VIDIOC_S_TUNER, &tuner);
-  if (rc < 0) {
-    HAL_LOG("Unable to adjust band limits");
-  }
-
-  int emphasis;
-  switch (aInfo.preEmphasis()) {
-  case 0:
-    emphasis = V4L2_DEEMPHASIS_DISABLED;
-    break;
-  case 50:
-    emphasis = V4L2_DEEMPHASIS_50_uS;
-    break;
-  case 75:
-    emphasis = V4L2_DEEMPHASIS_75_uS;
-    break;
-  default:
-    MOZ_CRASH("Invalid preemphasis setting");
-    break;
-  }
-  rc = setControl(V4L2_CID_TUNE_DEEMPHASIS, emphasis);
-  if (rc < 0) {
-    HAL_LOG("Unable to configure deemphasis");
-  }
-
-  sRadioFD = fd.forget();
-  sRadioEnabled = true;
-
-  info.status() = hal::FM_RADIO_OPERATION_STATUS_SUCCESS;
-  hal::NotifyFMRadioStatus(info);
-}
-
-void
-DisableFMRadio()
-{
-  if (!sRadioEnabled)
-    return;
-
-  if (sRDSEnabled)
-    hal::DisableRDS();
-
-  sRadioEnabled = false;
-
-  if (sMsmFMMode) {
-    int rc = setControl(V4L2_CID_PRIVATE_TAVARUA_STATE, FM_OFF);
-    if (rc < 0) {
-      HAL_LOG("Unable to turn off radio");
-    }
-
-    pthread_join(sRadioThread, nullptr);
-  }
-
-  close(sRadioFD);
-
-  hal::FMRadioOperationInformation info;
-  info.operation() = hal::FM_RADIO_OPERATION_DISABLE;
-  info.status() = hal::FM_RADIO_OPERATION_STATUS_SUCCESS;
-  hal::NotifyFMRadioStatus(info);
-}
-
-void
-FMRadioSeek(const hal::FMRadioSeekDirection& aDirection)
-{
-  struct v4l2_hw_freq_seek seek = {0};
-  seek.type = V4L2_TUNER_RADIO;
-  seek.seek_upward = aDirection == hal::FMRadioSeekDirection::FM_RADIO_SEEK_DIRECTION_UP;
-
-  /* ICS and older don't have the spacing field */
-#if ANDROID_VERSION == 15
-  seek.reserved[0] = sRadioSettings.spaceType() * 1000;
-#else
-  seek.spacing = sRadioSettings.spaceType() * 1000;
-#endif
-
-  int rc = ioctl(sRadioFD, VIDIOC_S_HW_FREQ_SEEK, &seek);
-  if (sMsmFMMode && rc >= 0)
-    return;
-
-  NS_DispatchToMainThread(new RadioUpdate(hal::FM_RADIO_OPERATION_SEEK,
-                                          rc < 0 ?
-                                          hal::FM_RADIO_OPERATION_STATUS_FAIL :
-                                          hal::FM_RADIO_OPERATION_STATUS_SUCCESS));
-
-  if (rc < 0) {
-    HAL_LOG("Could not initiate hardware seek");
-    return;
-  }
-
-  NS_DispatchToMainThread(new RadioUpdate(hal::FM_RADIO_OPERATION_TUNE,
-                                          hal::FM_RADIO_OPERATION_STATUS_SUCCESS));
-}
-
-void
-GetFMRadioSettings(hal::FMRadioSettings* aInfo)
-{
-  if (!sRadioEnabled) {
-    return;
-  }
-
-  struct v4l2_tuner tuner = {0};
-  int rc = ioctl(sRadioFD, VIDIOC_G_TUNER, &tuner);
-  if (rc < 0) {
-    HAL_LOG("Could not query fm radio for settings");
-    return;
-  }
-
-  aInfo->upperLimit() = (tuner.rangehigh * 625) / 10000;
-  aInfo->lowerLimit() = (tuner.rangelow * 625) / 10000;
-}
-
-void
-SetFMRadioFrequency(const uint32_t frequency)
-{
-  struct v4l2_frequency freq = {0};
-  freq.type = V4L2_TUNER_RADIO;
-  freq.frequency = (frequency * 10000) / 625;
-
-  int rc = ioctl(sRadioFD, VIDIOC_S_FREQUENCY, &freq);
-  if (rc < 0)
-    HAL_LOG("Could not set radio frequency");
-
-  if (sMsmFMMode && rc >= 0)
-    return;
-
-  NS_DispatchToMainThread(new RadioUpdate(hal::FM_RADIO_OPERATION_TUNE,
-                                          rc < 0 ?
-                                          hal::FM_RADIO_OPERATION_STATUS_FAIL :
-                                          hal::FM_RADIO_OPERATION_STATUS_SUCCESS));
-}
-
-uint32_t
-GetFMRadioFrequency()
-{
-  if (!sRadioEnabled)
-    return 0;
-
-  struct v4l2_frequency freq = {0};
-  int rc = ioctl(sRadioFD, VIDIOC_G_FREQUENCY, &freq);
-  if (rc < 0) {
-    HAL_LOG("Could not get radio frequency");
-    return 0;
-  }
-
-  return (freq.frequency * 625) / 10000;
-}
-
-bool
-IsFMRadioOn()
-{
-  return sRadioEnabled;
-}
-
-uint32_t
-GetFMRadioSignalStrength()
-{
-  struct v4l2_tuner tuner = {0};
-  int rc = ioctl(sRadioFD, VIDIOC_G_TUNER, &tuner);
-  if (rc < 0) {
-    HAL_LOG("Could not query fm radio for signal strength");
-    return 0;
-  }
-
-  return tuner.signal;
-}
-
-void
-CancelFMRadioSeek()
-{}
-
-/* Runs on the rds thread */
-static void*
-readRDSDataThread(void* data)
-{
-  v4l2_rds_data rdsblocks[16];
-  uint16_t blocks[4];
-
-  ScopedClose pipefd((int)data);
-
-  ScopedClose epollfd(epoll_create(2));
-  if (epollfd < 0) {
-    HAL_LOG("Could not create epoll FD for RDS thread (%d)", errno);
-    return nullptr;
-  }
-
-  epoll_event event = {
-    EPOLLIN,
-    { 0 }
-  };
-
-  event.data.fd = pipefd;
-  if (epoll_ctl(epollfd, EPOLL_CTL_ADD, pipefd, &event) < 0) {
-    HAL_LOG("Could not set up epoll FD for RDS thread (%d)", errno);
-    return nullptr;
-  }
-
-  event.data.fd = sRadioFD;
-  if (epoll_ctl(epollfd, EPOLL_CTL_ADD, sRadioFD, &event) < 0) {
-    HAL_LOG("Could not set up epoll FD for RDS thread (%d)", errno);
-    return nullptr;
-  }
-
-  epoll_event events[2] = {{ 0 }};
-  int event_count;
-  uint32_t block_bitmap = 0;
-  while ((event_count = epoll_wait(epollfd, events, 2, -1)) > 0 ||
-         errno == EINTR) {
-    bool RDSDataAvailable = false;
-    for (int i = 0; i < event_count; i++) {
-      if (events[i].data.fd == pipefd) {
-        if (!sRDSEnabled)
-          return nullptr;
-        char tmp[32];
-        TEMP_FAILURE_RETRY(read(pipefd, tmp, sizeof(tmp)));
-      } else if (events[i].data.fd == sRadioFD) {
-        RDSDataAvailable = true;
-      }
-    }
-
-    if (!RDSDataAvailable)
-      continue;
-
-    ssize_t len =
-      TEMP_FAILURE_RETRY(read(sRadioFD, rdsblocks, sizeof(rdsblocks)));
-    if (len < 0) {
-      HAL_LOG("Unexpected error while reading RDS data %d", errno);
-      return nullptr;
-    }
-
-    int blockcount = len / sizeof(rdsblocks[0]);
-    for (int i = 0; i < blockcount; i++) {
-      if ((rdsblocks[i].block & V4L2_RDS_BLOCK_MSK) == V4L2_RDS_BLOCK_INVALID ||
-           rdsblocks[i].block & V4L2_RDS_BLOCK_ERROR) {
-        block_bitmap |= 1 << V4L2_RDS_BLOCK_INVALID;
-        continue;
-      }
-
-      int blocknum = rdsblocks[i].block & V4L2_RDS_BLOCK_MSK;
-      // In some cases, the full set of bits in an RDS group isn't
-      // needed, in which case version B RDS groups can be sent.
-      // Version B groups replace block C with block C' (V4L2_RDS_BLOCK_C_ALT).
-      // Block C' always stores the PI code, so receivers can find the PI
-      // code more quickly/reliably.
-      // However, we only process whole RDS groups, so it doesn't matter here.
-      if (blocknum == V4L2_RDS_BLOCK_C_ALT)
-        blocknum = V4L2_RDS_BLOCK_C;
-      if (blocknum > V4L2_RDS_BLOCK_D) {
-        HAL_LOG("Unexpected RDS block number %d. This is a driver bug.",
-                blocknum);
-        continue;
-      }
-
-      if (blocknum == V4L2_RDS_BLOCK_A)
-        block_bitmap = 0;
-
-      // Skip the group if we skipped a block.
-      // This stops us from processing blocks sent out of order.
-      if (block_bitmap != ((1u << blocknum) - 1u)) {
-        block_bitmap |= 1 << V4L2_RDS_BLOCK_INVALID;
-        continue;
-      }
-
-      block_bitmap |= 1 << blocknum;
-
-      blocks[blocknum] = (rdsblocks[i].msb << 8) | rdsblocks[i].lsb;
-
-      // Make sure we have all 4 blocks and that they're valid
-      if (block_bitmap != 0x0F)
-        continue;
-
-      hal::FMRadioRDSGroup group;
-      group.blockA() = blocks[V4L2_RDS_BLOCK_A];
-      group.blockB() = blocks[V4L2_RDS_BLOCK_B];
-      group.blockC() = blocks[V4L2_RDS_BLOCK_C];
-      group.blockD() = blocks[V4L2_RDS_BLOCK_D];
-      NotifyFMRadioRDSGroup(group);
-    }
-  }
-
-  return nullptr;
-}
-
-static int sRDSPipeFD;
-
-bool
-EnableRDS(uint32_t aMask)
-{
-  if (!sRadioEnabled || !sRDSSupported)
-    return false;
-
-  if (sMsmFMMode)
-    setControl(V4L2_CID_PRIVATE_TAVARUA_RDSGROUP_MASK, aMask);
-
-  if (sRDSEnabled)
-    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 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 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 false;
-  }
-
-  readfd.forget();
-  writefd.forget();
-  return true;
-}
-
-void
-DisableRDS()
-{
-  if (!sRadioEnabled || !sRDSEnabled)
-    return;
-
-  int rc = setControl(V4L2_CID_RDS_RECEPTION, false);
-  if (rc < 0) {
-    HAL_LOG("Could not disable RDS reception (%d)", rc);
-  }
-
-  sRDSEnabled = false;
-
-  write(sRDSPipeFD, "x", 1);
-
-  pthread_join(sRDSThread, nullptr);
-
-  close(sRDSPipeFD);
-}
-
-} // hal_impl
-} // namespace mozilla
--- a/hal/moz.build
+++ b/hal/moz.build
@@ -43,17 +43,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'andr
     ]
     # AndroidHal.cpp cannot be built in unified mode because it relies on HalImpl.h.
     SOURCES += [
         'android/AndroidHal.cpp',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     UNIFIED_SOURCES += [
         'gonk/GonkDiskSpaceWatcher.cpp',
-        'gonk/GonkFMRadio.cpp',
         'gonk/GonkSensor.cpp',
         'gonk/GonkSensorsHelpers.cpp',
         'gonk/GonkSensorsInterface.cpp',
         'gonk/GonkSensorsPollInterface.cpp',
         'gonk/GonkSensorsRegistryInterface.cpp',
         'gonk/GonkSwitch.cpp',
         'gonk/SystemService.cpp',
         'gonk/UeventPoller.cpp',
@@ -131,17 +130,16 @@ else:
         'fallback/FallbackVibration.cpp',
     ]
 
 # Fallbacks for backends implemented on Gonk only.
 if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
     UNIFIED_SOURCES += [
         'fallback/FallbackDiskSpaceWatcher.cpp',
         'fallback/FallbackFactoryReset.cpp',
-        'fallback/FallbackFMRadio.cpp',
         'fallback/FallbackProcessPriority.cpp',
         'fallback/FallbackScreenPower.cpp',
         'fallback/FallbackSwitch.cpp',
         'fallback/FallbackSystemService.cpp',
         'fallback/FallbackThreadPriority.cpp',
         'fallback/FallbackTime.cpp',
         'fallback/FallbackWakeLocks.cpp',
     ]
--- a/hal/sandbox/PHal.ipdl
+++ b/hal/sandbox/PHal.ipdl
@@ -13,19 +13,16 @@ using mozilla::dom::ScreenOrientationInt
 using mozilla::hal::SensorType from "mozilla/HalSensor.h";
 using mozilla::hal::SensorAccuracyType from "mozilla/HalSensor.h";
 using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h";
 using mozilla::hal::SwitchState from "mozilla/HalTypes.h";
 using mozilla::hal::SwitchDevice from "mozilla/HalTypes.h";
 using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
 using nsIntRect from "nsRect.h";
 using PRTime from "prtime.h";
-using mozilla::hal::FMRadioCountry from "mozilla/HalTypes.h";
-using mozilla::hal::FMRadioOperation from "mozilla/HalTypes.h";
-using mozilla::hal::FMRadioOperationStatus from "mozilla/HalTypes.h";
 
 namespace mozilla {
 
 namespace hal {
 struct BatteryInformation {
   double level;
   bool   charging;
   double remainingTime;
@@ -59,37 +56,16 @@ struct WakeLockInformation {
 struct ScreenConfiguration {
   nsIntRect rect;
   ScreenOrientationInternal orientation;
   uint16_t angle;
   uint32_t colorDepth;
   uint32_t pixelDepth;
 };
 
-struct FMRadioOperationInformation {
-  FMRadioOperation operation;
-  FMRadioOperationStatus status;
-  uint32_t frequency;
-};
-
-struct FMRadioRDSGroup {
-  uint16_t blockA;
-  uint16_t blockB;
-  uint16_t blockC;
-  uint16_t blockD;
-};
-
-struct FMRadioSettings {
-  FMRadioCountry country;
-  uint32_t upperLimit;
-  uint32_t lowerLimit;
-  uint32_t spaceType;
-  uint32_t preEmphasis;
-};
-
 struct SystemTimezoneChangeInformation {
   // These timezone offsets are relative to UTC in minutes and
   // have already taken daylight saving time (DST) into account.
   int32_t oldTimezoneOffsetMinutes;
   int32_t newTimezoneOffsetMinutes;
 };
 
 } // namespace hal
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -363,86 +363,16 @@ SetCurrentThreadPriority(ThreadPriority 
 void
 SetThreadPriority(PlatformThreadId aThreadId,
                   ThreadPriority aThreadPriority)
 {
   NS_RUNTIMEABORT("Setting thread priority cannot be called from sandboxed contexts.");
 }
 
 void
-EnableFMRadio(const hal::FMRadioSettings& aSettings)
-{
-  NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
-}
-
-void
-DisableFMRadio()
-{
-  NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
-}
-
-void
-FMRadioSeek(const hal::FMRadioSeekDirection& aDirection)
-{
-  NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
-}
-
-void
-GetFMRadioSettings(FMRadioSettings* aSettings)
-{
-  NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
-}
-
-void
-SetFMRadioFrequency(const uint32_t aFrequency)
-{
-  NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
-}
-
-uint32_t
-GetFMRadioFrequency()
-{
-  NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
-  return 0;
-}
-
-bool
-IsFMRadioOn()
-{
-  NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
-  return false;
-}
-
-uint32_t
-GetFMRadioSignalStrength()
-{
-  NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
-  return 0;
-}
-
-void
-CancelFMRadioSeek()
-{
-  NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
-}
-
-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.");
-}
-
-void
 FactoryReset(FactoryResetReason& aReason)
 {
   if (aReason == FactoryResetReason::Normal) {
     Hal()->SendFactoryReset(NS_LITERAL_STRING("normal"));
   } else if (aReason == FactoryResetReason::Wipe) {
     Hal()->SendFactoryReset(NS_LITERAL_STRING("wipe"));
   } else if (aReason == FactoryResetReason::Root) {
     Hal()->SendFactoryReset(NS_LITERAL_STRING("root"));