Backout bug 792109, bug 749053 and bug 779500 because of leaks in debug tests
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 19 Sep 2012 15:42:18 -0400
changeset 111134 e60144694d560dba2aee930623c9871ee6c4cfa5
parent 111122 45a10fa9d60bd848e5606b40d9d664b33a8561e9
child 111135 58f286147a9a2e35c497a6d9736595f6f53350e9
push id2248
push userakeybl@mozilla.com
push dateMon, 08 Oct 2012 19:23:44 +0000
treeherdermozilla-aurora@118a3b748323 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs792109, 749053, 779500
milestone18.0a1
Backout bug 792109, bug 749053 and bug 779500 because of leaks in debug tests
b2g/chrome/content/shell.js
b2g/installer/package-manifest.in
configure.in
content/base/src/nsGkAtomList.h
dom/Makefile.in
dom/base/Makefile.in
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/dom-config.mk
dom/fm/DOMFMRadio.manifest
dom/fm/DOMFMRadioChild.js
dom/fm/DOMFMRadioParent.jsm
dom/fm/FMRadio.cpp
dom/fm/FMRadio.h
dom/fm/Makefile.in
dom/fm/nsFMRadioSettings.cpp
dom/fm/nsFMRadioSettings.h
dom/fm/nsIDOMFMRadio.idl
dom/fm/nsIFMRadio.idl
dom/system/gonk/AudioManager.cpp
dom/system/gonk/AudioManager.h
dom/system/gonk/nsIAudioManager.idl
hal/Hal.cpp
hal/Hal.h
hal/HalTypes.h
hal/Makefile.in
hal/fallback/FallbackFMRadio.cpp
hal/gonk/GonkFMRadio.cpp
hal/gonk/tavarua.h
hal/sandbox/PHal.ipdl
hal/sandbox/SandboxHal.cpp
layout/build/Makefile.in
layout/build/nsLayoutModule.cpp
media/libcubeb/src/cubeb_opensl.c
media/libsydneyaudio/src/gonk/AudioSystem.h
mobile/android/base/gfx/GeckoLayerClient.java
mobile/android/base/gfx/ViewportMetrics.java
mobile/android/chrome/content/browser.js
toolkit/toolkit-makefiles.sh
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
widget/android/AndroidJavaWrappers.cpp
widget/android/AndroidJavaWrappers.h
widget/android/nsIAndroidBridge.idl
--- a/b2g/chrome/content/shell.js
+++ b/b2g/chrome/content/shell.js
@@ -8,19 +8,16 @@ const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 const Cr = Components.results;
 
 Cu.import('resource://gre/modules/XPCOMUtils.jsm');
 Cu.import('resource://gre/modules/Services.jsm');
 Cu.import('resource://gre/modules/ContactService.jsm');
 Cu.import('resource://gre/modules/SettingsChangeNotifier.jsm');
-#ifdef MOZ_B2G_FM
-Cu.import('resource://gre/modules/DOMFMRadioParent.jsm');
-#endif
 Cu.import('resource://gre/modules/AlarmService.jsm');
 Cu.import('resource://gre/modules/ActivitiesService.jsm');
 Cu.import('resource://gre/modules/PermissionPromptHelper.jsm');
 Cu.import('resource://gre/modules/ObjectWrapper.jsm');
 Cu.import('resource://gre/modules/accessibility/AccessFu.jsm');
 Cu.import('resource://gre/modules/Payment.jsm');
 
 XPCOMUtils.defineLazyServiceGetter(Services, 'env',
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -157,19 +157,16 @@
 @BINPATH@/components/dom_apps.xpt
 @BINPATH@/components/dom_base.xpt
 #ifdef MOZ_B2G_RIL
 @BINPATH@/components/dom_telephony.xpt
 @BINPATH@/components/dom_wifi.xpt
 @BINPATH@/components/dom_system_gonk.xpt
 @BINPATH@/components/dom_icc.xpt
 #endif
-#ifdef MOZ_B2G_FM
-@BINPATH@/components/dom_fm.xpt
-#endif
 @BINPATH@/components/dom_battery.xpt
 #ifdef MOZ_B2G_BT
 @BINPATH@/components/dom_bluetooth.xpt
 #endif
 @BINPATH@/components/dom_camera.xpt
 @BINPATH@/components/dom_canvas.xpt
 @BINPATH@/components/dom_contacts.xpt
 @BINPATH@/components/dom_alarm.xpt
@@ -450,20 +447,16 @@
 @BINPATH@/components/RILContentHelper.js
 @BINPATH@/components/SmsDatabaseService.manifest
 @BINPATH@/components/SmsDatabaseService.js
 @BINPATH@/components/WifiWorker.js
 @BINPATH@/components/WifiWorker.manifest
 @BINPATH@/components/DOMWifiManager.js
 @BINPATH@/components/DOMWifiManager.manifest
 #endif
-#ifdef MOZ_B2G_FM
-@BINPATH@/components/DOMFMRadioChild.js
-@BINPATH@/components/DOMFMRadio.manifest
-#endif
 #ifdef XP_MACOSX
 @BINPATH@/components/libalerts.dylib
 #endif
 #ifdef MOZ_ENABLE_DBUS
 @BINPATH@/components/@DLL_PREFIX@dbusservice@DLL_SUFFIX@
 #endif
 @BINPATH@/components/nsINIProcessor.manifest
 @BINPATH@/components/nsINIProcessor.js
--- a/configure.in
+++ b/configure.in
@@ -2069,17 +2069,16 @@ ia64*-hpux*)
 
 *-android*|*-linuxandroid*)
     AC_DEFINE(NO_PW_GECOS)
     no_x=yes
     if test -n "$gonkdir"; then
         _PLATFORM_DEFAULT_TOOLKIT=cairo-gonk
         MOZ_B2G_RIL=1
         MOZ_B2G_BT=1
-        MOZ_B2G_FM=1
     else
         _PLATFORM_DEFAULT_TOOLKIT=cairo-android
         MOZ_LINKER=1
     fi
     TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
 
     MOZ_GFX_OPTIMIZE_MOBILE=1
     MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions"
@@ -7316,24 +7315,16 @@ MOZ_ARG_ENABLE_BOOL(b2g-ril,
     MOZ_B2G_RIL=1,
     MOZ_B2G_RIL= )
 if test -n "$MOZ_B2G_RIL"; then
     AC_DEFINE(MOZ_B2G_RIL)
 fi
 AC_SUBST(MOZ_B2G_RIL)
 
 dnl ========================================================
-dnl = Enable Radio FM for B2G (Gonk usually)
-dnl ========================================================
-if test -n "$MOZ_B2G_FM"; then
-    AC_DEFINE(MOZ_B2G_FM)
-fi
-AC_SUBST(MOZ_B2G_FM)
-
-dnl ========================================================
 dnl = Enable Bluetooth Interface for B2G (Gonk usually)
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(b2g-bt,
 [  --enable-b2g-bt      Set compile flags necessary for compiling Bluetooth API for B2G ],
     MOZ_B2G_BT=1,
     MOZ_B2G_BT= )
 if test -n "$MOZ_B2G_BT"; then
     AC_DEFINE(MOZ_B2G_BT)
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -755,18 +755,16 @@ GK_ATOM(onresize, "onresize")
 GK_ATOM(onscroll, "onscroll")
 GK_ATOM(onselect, "onselect")
 GK_ATOM(onsent, "onsent")
 GK_ATOM(onset, "onset")
 GK_ATOM(onshow, "onshow")
 GK_ATOM(onstatechange, "onstatechange")
 GK_ATOM(onstatuschanged, "onstatuschanged")
 GK_ATOM(onstkcommand, "onstkcommand")
-GK_ATOM(onantennastatechange, "onantennastatechange")
-GK_ATOM(onseekcomplete, "onseekcomplete")
 GK_ATOM(onstksessionend, "onstksessionend")
 GK_ATOM(onsubmit, "onsubmit")
 GK_ATOM(onsuccess, "onsuccess")
 GK_ATOM(ontext, "ontext")
 GK_ATOM(ontouchstart, "ontouchstart")
 GK_ATOM(ontouchend, "ontouchend")
 GK_ATOM(ontouchmove, "ontouchmove")
 GK_ATOM(ontouchenter, "ontouchenter")
--- a/dom/Makefile.in
+++ b/dom/Makefile.in
@@ -76,20 +76,16 @@ PARALLEL_DIRS += \
 ifdef MOZ_B2G_RIL
 PARALLEL_DIRS += \
   telephony \
   wifi \
   icc \
   $(NULL)
 endif
 
-ifdef MOZ_B2G_FM
-PARALLEL_DIRS += fm
-endif
-
 ifdef MOZ_PAY
 PARALLEL_DIRS += \
   payment \
   $(NULL)
 endif
 
 # bindings/test is here, because it needs to build after bindings/, and
 # we build subdirectories before ourselves.
--- a/dom/base/Makefile.in
+++ b/dom/base/Makefile.in
@@ -114,20 +114,16 @@ include $(topsrcdir)/dom/dom-config.mk
 ifdef MOZ_JSDEBUGGER
 DEFINES += -DMOZ_JSDEBUGGER
 endif
 
 ifdef MOZ_B2G_RIL
 DEFINES += -DMOZ_B2G_RIL
 endif
 
-ifdef MOZ_B2G_FM
-DEFINES += -DMOZ_B2G_FM
-endif
-
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES += \
 		-I$(topsrcdir)/js/xpconnect/src \
 		-I$(topsrcdir)/js/xpconnect/wrappers \
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -512,20 +512,16 @@ using mozilla::dom::indexedDB::IDBWrappe
 #include "TelephonyCall.h"
 #include "CallEvent.h"
 #include "nsIDOMVoicemail.h"
 #include "nsIDOMVoicemailEvent.h"
 #include "nsIDOMIccManager.h"
 #include "StkCommandEvent.h"
 #endif
 
-#ifdef MOZ_B2G_FM
-#include "FMRadio.h"
-#endif
-
 #ifdef MOZ_B2G_BT
 #include "BluetoothManager.h"
 #include "BluetoothAdapter.h"
 #include "BluetoothDevice.h"
 #include "BluetoothPropertyEvent.h"
 #endif
 
 #include "nsIDOMNavigatorSystemMessages.h"
@@ -1684,21 +1680,16 @@ static nsDOMClassInfoData sClassInfoData
   NS_DEFINE_CLASSINFO_DATA(MozVoicemailEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MozIccManager, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(MozStkCommandEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 #endif
 
-#ifdef MOZ_B2G_FM
-  NS_DEFINE_CLASSINFO_DATA(FMRadio, nsEventTargetSH,
-                           EVENTTARGET_SCRIPTABLE_FLAGS)
-#endif
-
 #ifdef MOZ_B2G_BT
   NS_DEFINE_CLASSINFO_DATA(BluetoothManager, nsEventTargetSH,
                            EVENTTARGET_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(BluetoothAdapter, nsEventTargetSH,
                            EVENTTARGET_SCRIPTABLE_FLAGS)  
   NS_DEFINE_CLASSINFO_DATA(BluetoothDevice, nsEventTargetSH,
                            EVENTTARGET_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(BluetoothPropertyEvent, nsDOMGenericSH,
@@ -4499,23 +4490,16 @@ nsDOMClassInfo::Init()
 
   DOM_CLASSINFO_MAP_BEGIN(MozStkCommandEvent, nsIDOMMozStkCommandEvent)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozStkCommandEvent)
     DOM_CLASSINFO_EVENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
 #endif
 
-#ifdef MOZ_B2G_FM
-  DOM_CLASSINFO_MAP_BEGIN(FMRadio, nsIFMRadio)
-    DOM_CLASSINFO_MAP_ENTRY(nsIFMRadio)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
-  DOM_CLASSINFO_MAP_END
-#endif
-
 #ifdef MOZ_B2G_BT
   DOM_CLASSINFO_MAP_BEGIN(BluetoothManager, nsIDOMBluetoothManager)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMBluetoothManager)
   DOM_CLASSINFO_MAP_END  
 
   DOM_CLASSINFO_MAP_BEGIN(BluetoothAdapter, nsIDOMBluetoothAdapter)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMBluetoothAdapter)
   DOM_CLASSINFO_MAP_END
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -516,20 +516,16 @@ DOMCI_CLASS(Telephony)
 DOMCI_CLASS(TelephonyCall)
 DOMCI_CLASS(CallEvent)
 DOMCI_CLASS(MozVoicemail)
 DOMCI_CLASS(MozVoicemailEvent)
 DOMCI_CLASS(MozIccManager)
 DOMCI_CLASS(MozStkCommandEvent)
 #endif
 
-#ifdef MOZ_B2G_FM
-DOMCI_CLASS(FMRadio)
-#endif
-
 #ifdef MOZ_B2G_BT
 DOMCI_CLASS(BluetoothManager)
 DOMCI_CLASS(BluetoothAdapter)
 DOMCI_CLASS(BluetoothDevice)
 DOMCI_CLASS(BluetoothPropertyEvent)
 #endif
 
 DOMCI_CLASS(CameraManager)
--- a/dom/dom-config.mk
+++ b/dom/dom-config.mk
@@ -39,20 +39,14 @@ ifdef MOZ_B2G_RIL
 DOM_SRCDIRS += \
   dom/system/gonk \
   dom/telephony \
   dom/wifi \
   dom/icc/src \
   $(NULL)
 endif
 
-ifdef MOZ_B2G_FM
-DOM_SRCDIRS += \
-  dom/fm \
-  $(NULL)
-endif
-
 ifdef MOZ_B2G_BT
 DOM_SRCDIRS += dom/bluetooth
 endif
 
 LOCAL_INCLUDES += $(DOM_SRCDIRS:%=-I$(topsrcdir)/%)
 DEFINES += -D_IMPL_NS_LAYOUT
deleted file mode 100644
--- a/dom/fm/DOMFMRadio.manifest
+++ /dev/null
@@ -1,4 +0,0 @@
-# DOMFMRadio.js
-component {901f8a83-03a6-4be9-bb8f-35387d3849da} DOMFMRadioChild.js
-contract @mozilla.org/domfmradio;1 {901f8a83-03a6-4be9-bb8f-35387d3849da}
-category JavaScript-navigator-property mozFMRadio @mozilla.org/domfmradio;1
deleted file mode 100644
--- a/dom/fm/DOMFMRadioChild.js
+++ /dev/null
@@ -1,390 +0,0 @@
-/* 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/. */
-
-"use strict"
-let DEBUG = 0;
-if (DEBUG)
-  debug = function (s) { dump("-*- DOMFMRadioChild: " + s + "\n"); };
-else
-  debug = function (s) { };
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
-
-const DOMFMMANAGER_CONTRACTID = "@mozilla.org/domfmradio;1";
-const DOMFMMANAGER_CID = Components.ID("{901f8a83-03a6-4be9-bb8f-35387d3849da}");
-
-XPCOMUtils.defineLazyGetter(Services, "DOMRequest", function() {
-  return Cc["@mozilla.org/dom/dom-request-service;1"]
-           .getService(Ci.nsIDOMRequestService);
-});
-
-XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
-                                   "@mozilla.org/childprocessmessagemanager;1",
-                                   "nsISyncMessageSender");
-
-function DOMFMRadioChild() { }
-
-DOMFMRadioChild.prototype = {
-  __proto__: DOMRequestIpcHelper.prototype,
-
-  classID: DOMFMMANAGER_CID,
-  classInfo: XPCOMUtils.generateCI({
-               classID: DOMFMMANAGER_CID,
-               contractID: DOMFMMANAGER_CONTRACTID,
-               classDescription: "DOMFMRadio",
-               interfaces: [Ci.nsIDOMFMRadio],
-               flags: Ci.nsIClassInfo.DOM_OBJECT
-             }),
-
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMFMRadio,
-                                         Ci.nsIDOMGlobalPropertyInitializer]),
-
-  // nsIDOMGlobalPropertyInitializer implementation
-  init: function(aWindow) {
-    let principal = aWindow.document.nodePrincipal;
-    let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]
-                   .getService(Ci.nsIScriptSecurityManager);
-
-    let perm = (principal == secMan.getSystemPrincipal()) ?
-                 Ci.nsIPermissionManager.ALLOW_ACTION :
-                 Services.perms.testExactPermission(principal.URI, "fmradio");
-    this._hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION;
-
-    if (!this._hasPrivileges) {
-      throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
-    }
-
-    const messages = ["DOMFMRadio:enable:Return:OK",
-                      "DOMFMRadio:enable:Return:NO",
-                      "DOMFMRadio:disable:Return:OK",
-                      "DOMFMRadio:disable:Return:NO",
-                      "DOMFMRadio:setFrequency:Return:OK",
-                      "DOMFMRadio:setFrequency:Return:NO",
-                      "DOMFMRadio:seekUp:Return:OK",
-                      "DOMFMRadio:seekUp:Return:NO",
-                      "DOMFMRadio:seekDown:Return:OK",
-                      "DOMFMRadio:seekDown:Return:NO",
-                      "DOMFMRadio:cancelSeek:Return:OK",
-                      "DOMFMRadio:cancelSeek:Return:NO",
-                      "DOMFMRadio:frequencyChange",
-                      "DOMFMRadio:powerStateChange",
-                      "DOMFMRadio:antennaChange"];
-    this.initHelper(aWindow, messages);
-  },
-
-  // Called from DOMRequestIpcHelper
-  uninit: function() {
-    this._onFrequencyChange = null;
-    this._onAntennaChange = null;
-    this._onDisabled = null;
-    this._onEnabled = null;
-  },
-
-  _createEvent: function(name) {
-    return new this._window.Event(name);
-  },
-
-  _sendMessageForRequest: function(name, data, request) {
-    let id = this.getRequestId(request);
-    cpmm.sendAsyncMessage(name, {
-      data: data,
-      rid: id,
-      mid: this._id
-    });
-  },
-
-  _fireFrequencyChangeEvent: function() {
-    let e = this._createEvent("frequencychange");
-    if (this._onFrequencyChange) {
-      this._onFrequencyChange.handleEvent(e);
-    }
-    this.dispatchEvent(e);
-  },
-
-  _firePowerStateChangeEvent: function() {
-    let _enabled = this.enabled;
-    debug("Current power state: " + _enabled);
-    if (_enabled) {
-      let e = this._createEvent("enabled");
-      if (this._onEnabled) {
-        this._onEnabled.handleEvent(e);
-      }
-      this.dispatchEvent(e);
-    } else {
-      let e = this._createEvent("disabled");
-      if (this._onDisabled) {
-        this._onDisabled.handleEvent(e);
-      }
-      this.dispatchEvent(e);
-    }
-  },
-
-  _fireAntennaAvailableChangeEvent: function() {
-    let e = this._createEvent("antennaavailablechange");
-    if (this._onAntennaChange) {
-      this._onAntennaChange.handleEvent(e);
-    }
-    this.dispatchEvent(e);
-  },
-
-  receiveMessage: function(aMessage) {
-    let msg = aMessage.json;
-    if (msg.mid && msg.mid != this._id) {
-      return;
-    }
-
-    let request;
-    switch (aMessage.name) {
-      case "DOMFMRadio:enable:Return:OK":
-        request = this.takeRequest(msg.rid);
-        if (!request) {
-          return;
-        }
-        Services.DOMRequest.fireSuccess(request, null);
-        break;
-      case "DOMFMRadio:enable:Return:NO":
-        request = this.takeRequest(msg.rid);
-        if (!request) {
-          return;
-        }
-        Services.DOMRequest.fireError(request, "Failed to turn on the FM radio");
-        break;
-      case "DOMFMRadio:disable:Return:OK":
-        request = this.takeRequest(msg.rid);
-        if (!request) {
-          return;
-        }
-        Services.DOMRequest.fireSuccess(request, null);
-        break;
-      case "DOMFMRadio:disable:Return:NO":
-        request = this.takeRequest(msg.rid);
-        if (!request) {
-          return;
-        }
-        Services.DOMRequest.fireError(request,
-                                      "Failed to turn off the FM radio");
-        break;
-      case "DOMFMRadio:setFrequency:Return:OK":
-        request = this.takeRequest(msg.rid);
-        if (!request) {
-          return;
-        }
-        Services.DOMRequest.fireSuccess(request, null);
-        break;
-      case "DOMFMRadio:setFrequency:Return:NO":
-        request = this.takeRequest(msg.rid);
-        if (!request) {
-          return;
-        }
-        Services.DOMRequest.fireError(request,
-                                      "Failed to set the FM radio frequency");
-        break;
-      case "DOMFMRadio:seekUp:Return:OK":
-        request = this.takeRequest(msg.rid);
-        if (!request) {
-          return;
-        }
-        Services.DOMRequest.fireSuccess(request, null);
-        break;
-      case "DOMFMRadio:seekUp:Return:NO":
-        request = this.takeRequest(msg.rid);
-        if (!request) {
-          return;
-        }
-        Services.DOMRequest.fireError(request, "FM radio seek-up failed");
-        break;
-      case "DOMFMRadio:seekDown:Return:OK":
-        request = this.takeRequest(msg.rid);
-        if (!request) {
-          return;
-        }
-        Services.DOMRequest.fireSuccess(request, null);
-        break;
-      case "DOMFMRadio:seekDown:Return:NO":
-        request = this.takeRequest(msg.rid);
-        if (!request) {
-          return;
-        }
-        Services.DOMRequest.fireError(request, "FM radio seek-down failed");
-        break;
-      case "DOMFMRadio:cancelSeek:Return:OK":
-        request = this.takeRequest(msg.rid);
-        if (!request) {
-          return;
-        }
-        Services.DOMRequest.fireSuccess(request, null);
-        break;
-      case "DOMFMRadio:cancelSeek:Return:NO":
-        request = this.takeRequest(msg.rid);
-        if (!request) {
-          return;
-        }
-        Services.DOMRequest.fireError(request, "Failed to cancel seek");
-        break;
-      case "DOMFMRadio:powerStateChange":
-        this._firePowerStateChangeEvent();
-        break;
-      case "DOMFMRadio:frequencyChange":
-        this._fireFrequencyChangeEvent();
-        break;
-      case "DOMFMRadio:antennaChange":
-        this._fireAntennaAvailableChangeEvent();
-        break;
-    }
-  },
-
-  _call: function(name, arg) {
-    var request = this.createRequest();
-    this._sendMessageForRequest("DOMFMRadio:" + name, arg, request);
-    return request;
-  },
-
-  // nsIDOMFMRadio
-  get enabled() {
-    return cpmm.sendSyncMessage("DOMFMRadio:getPowerState")[0];
-  },
-
-  get antennaAvailable() {
-    return cpmm.sendSyncMessage("DOMFMRadio:getAntennaState")[0];
-  },
-
-  get frequency() {
-    return cpmm.sendSyncMessage("DOMFMRadio:getFrequency")[0];
-  },
-
-  get frequencyUpperBound() {
-    let range = cpmm.sendSyncMessage("DOMFMRadio:getCurrentBand")[0];
-    return range.upper;
-  },
-
-  get frequencyLowerBound() {
-    let range = cpmm.sendSyncMessage("DOMFMRadio:getCurrentBand")[0];
-    return range.lower;
-  },
-
-  get channelWidth() {
-    let range = cpmm.sendSyncMessage("DOMFMRadio:getCurrentBand")[0];
-    return range.channelWidth;
-  },
-
-  set onantennaavailablechange(callback) {
-    this._onAntennaChange = callback;
-  },
-
-  set onenabled(callback) {
-    this._onEnabled = callback;
-  },
-
-  set ondisabled(callback) {
-    this._onDisabled = callback;
-  },
-
-  set onfrequencychange(callback) {
-    this._onFrequencyChange = callback;
-  },
-
-  disable: function nsIDOMFMRadio_disable() {
-    return this._call("disable", null);
-  },
-
-  enable: function nsIDOMFMRadio_enable(frequency) {
-    return this._call("enable", frequency);
-  },
-
-  setFrequency: function nsIDOMFMRadio_setFreq(frequency) {
-    return this._call("setFrequency", frequency);
-  },
-
-  seekDown: function nsIDOMFMRadio_seekDown() {
-    return this._call("seekDown", null);
-  },
-
-  seekUp: function nsIDOMFMRadio_seekUp() {
-    return this._call("seekUp", null);
-  },
-
-  cancelSeek: function nsIDOMFMRadio_cancelSeek() {
-    return this._call("cancelSeek", null);
-  },
-
-  // These are fake implementations, will be replaced by using
-  // nsJSDOMEventTargetHelper, see bug 731746
-  addEventListener: function(type, listener, useCapture) {
-    if (!this._eventListenersByType) {
-      this._eventListenersByType = {};
-    }
-
-    if (!listener) {
-      return;
-    }
-
-    var listeners = this._eventListenersByType[type];
-    if (!listeners) {
-      listeners = this._eventListenersByType[type] = [];
-    }
-
-    useCapture = !!useCapture;
-    for (let i = 0, len = listeners.length; i < len; i++) {
-      let l = listeners[i];
-      if (l && l.listener === listener && l.useCapture === useCapture) {
-        return;
-      }
-    }
-
-    listeners.push({
-      listener: listener,
-      useCapture: useCapture
-    });
-  },
-
-  removeEventListener: function(type, listener, useCapture) {
-    if (!this._eventListenersByType) {
-      return;
-    }
-
-    useCapture = !!useCapture;
-
-    var listeners = this._eventListenersByType[type];
-    if (listeners) {
-      for (let i = 0, len = listeners.length; i < len; i++) {
-        let l = listeners[i];
-        if (l && l.listener === listener && l.useCapture === useCapture) {
-          listeners.splice(i, 1);
-        }
-      }
-    }
-  },
-
-  dispatchEvent: function(evt) {
-    if (!this._eventListenersByType) {
-      return;
-    }
-
-    let type = evt.type;
-    var listeners = this._eventListenersByType[type];
-    if (listeners) {
-      for (let i = 0, len = listeners.length; i < len; i++) {
-        let listener = listeners[i].listener;
-
-        try {
-          if (typeof listener == "function") {
-            listener.call(this, evt);
-          } else if (listener && listener.handleEvent &&
-                     typeof listener.handleEvent == "function") {
-            listener.handleEvent(evt);
-          }
-        } catch (e) {
-          debug("Exception is caught: " + e);
-        }
-      }
-    }
-  }
-};
-
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([DOMFMRadioChild]);
-
deleted file mode 100644
--- a/dom/fm/DOMFMRadioParent.jsm
+++ /dev/null
@@ -1,456 +0,0 @@
-/* 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/. */
-
-"use strict"
-
-let DEBUG = 0;
-if (DEBUG)
-  debug = function(s) { dump("-*- DOMFMRadioParent component: " + s + "\n");  };
-else
-  debug = function(s) {};
-
-const Cu = Components.utils;
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-const MOZ_SETTINGS_CHANGED_OBSERVER_TOPIC  = "mozsettings-changed";
-const PROFILE_BEFORE_CHANGE_OBSERVER_TOPIC = "profile-before-change";
-
-const BAND_87500_108000_kHz = 1;
-const BAND_76000_108000_kHz = 2;
-const BAND_76000_90000_kHz  = 3;
-
-const FM_BANDS = { };
-FM_BANDS[BAND_76000_90000_kHz] = {
-  lower: 76000,
-  upper: 90000
-};
-
-FM_BANDS[BAND_87500_108000_kHz] = {
-  lower: 87500,
-  upper: 108000
-};
-
-FM_BANDS[BAND_76000_108000_kHz] = {
-  lower: 76000,
-  upper: 108000
-};
-
-const BAND_SETTING_KEY          = "fmRadio.band";
-const CHANNEL_WIDTH_SETTING_KEY = "fmRadio.channelWidth";
-
-// Hal types
-const CHANNEL_WIDTH_200KHZ = 200;
-const CHANNEL_WIDTH_100KHZ = 100;
-const CHANNEL_WIDTH_50KHZ  = 50;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
-                                   "@mozilla.org/parentprocessmessagemanager;1",
-                                   "nsIMessageListenerManager");
-
-XPCOMUtils.defineLazyGetter(this, "FMRadio", function() {
-  return Cc["@mozilla.org/fmradio;1"].getService(Ci.nsIFMRadio);
-});
-
-XPCOMUtils.defineLazyServiceGetter(this, "gSettingsService",
-                                   "@mozilla.org/settingsService;1",
-                                   "nsISettingsService");
-
-let EXPORTED_SYMBOLS = ["DOMFMRadioParent"];
-
-let DOMFMRadioParent = {
-  _initialized: false,
-
-  /* Indicates if the FM radio is currently enabled */
-  _isEnabled: false,
-
-  /* Indicates if the FM radio is currently being enabled */
-  _enabling: false,
-
-  /* Current frequency in KHz */
-  _currentFrequency: 0,
-
-  /* Current band setting */
-  _currentBand: BAND_87500_108000_kHz,
-
-  /* Current channel width */
-  _currentWidth: CHANNEL_WIDTH_100KHZ,
-
-  /* Indicates if the antenna is currently available */
-  _antennaAvailable: true,
-
-  _seeking: false,
-
-  _seekingCallback: null,
-
-  init: function() {
-    if (this._initialized === true) {
-      return;
-    }
-    this._initialized = true;
-
-    this._messages = ["DOMFMRadio:enable", "DOMFMRadio:disable",
-                      "DOMFMRadio:setFrequency", "DOMFMRadio:getCurrentBand",
-                      "DOMFMRadio:getPowerState", "DOMFMRadio:getFrequency",
-                      "DOMFMRadio:getAntennaState",
-                      "DOMFMRadio:seekUp", "DOMFMRadio:seekDown",
-                      "DOMFMRadio:cancelSeek"
-                     ];
-    this._messages.forEach(function(msgName) {
-      ppmm.addMessageListener(msgName, this);
-    }.bind(this));
-
-    Services.obs.addObserver(this, PROFILE_BEFORE_CHANGE_OBSERVER_TOPIC, false);
-    Services.obs.addObserver(this, MOZ_SETTINGS_CHANGED_OBSERVER_TOPIC, false);
-
-    this._updatePowerState();
-
-    // Get the band setting and channel width setting
-    let lock = gSettingsService.createLock();
-    lock.get(BAND_SETTING_KEY, this);
-    lock.get(CHANNEL_WIDTH_SETTING_KEY, this);
-
-    this._updateAntennaState();
-
-    let self = this;
-    FMRadio.onantennastatechange = function onantennachange() {
-      self._updateAntennaState();
-    };
-
-    debug("Initialized");
-  },
-
-  // nsISettingsServiceCallback
-  handle: function(aName, aResult) {
-    if (aName == BAND_SETTING_KEY) {
-      this._updateBand(aResult);
-    } else if (aName == CHANNEL_WIDTH_SETTING_KEY) {
-      this._updateChannelWidth(aResult);
-    }
-  },
-
-  handleError: function(aErrorMessage) {
-    this._updateBand(BAND_87500_108000_kHz);
-    this._updateChannelWidth(CHANNEL_WIDTH_100KHZ);
-  },
-
-  _updateAntennaState: function() {
-    let antennaState = FMRadio.isAntennaAvailable;
-
-    if (antennaState != this._antennaAvailable) {
-      this._antennaAvailable = antennaState;
-      ppmm.broadcastAsyncMessage("DOMFMRadio:antennaChange", { });
-    }
-  },
-
-  _updateBand: function(band) {
-      switch (parseInt(band)) {
-        case BAND_87500_108000_kHz:
-        case BAND_76000_108000_kHz:
-        case BAND_76000_90000_kHz:
-          this._currentBand = band;
-          break;
-      }
-  },
-
-  _updateChannelWidth: function(channelWidth) {
-    switch (parseInt(channelWidth)) {
-      case CHANNEL_WIDTH_50KHZ:
-      case CHANNEL_WIDTH_100KHZ:
-      case CHANNEL_WIDTH_200KHZ:
-        this._currentWidth = channelWidth;
-        break;
-    }
-  },
-
-  /**
-   * Update and cache the current frequency.
-   * Send frequency change message if the frequency is changed.
-   * The returned boolean value indicates if the frequency is changed.
-   */
-  _updateFrequency: function() {
-    let frequency = FMRadio.frequency;
-
-    if (frequency != this._currentFrequency) {
-      this._currentFrequency = frequency;
-      ppmm.broadcastAsyncMessage("DOMFMRadio:frequencyChange", { });
-      return true;
-    }
-
-    return false;
-  },
-
-  /**
-   * Update and cache the power state of the FM radio.
-   * Send message if the power state is changed.
-   */
-  _updatePowerState: function() {
-    let enabled = FMRadio.enabled;
-
-    if (this._isEnabled != enabled) {
-      this._isEnabled = enabled;
-      ppmm.broadcastAsyncMessage("DOMFMRadio:powerStateChange", { });
-
-      // If the FM radio is enabled, update the current frequency immediately,
-      if (enabled) {
-        this._updateFrequency();
-      }
-    }
-  },
-
-  _onSeekComplete: function(success) {
-    if (this._seeking) {
-      this._seeking = false;
-
-      if (this._seekingCallback) {
-        this._seekingCallback(success);
-        this._seekingCallback = null;
-      }
-    }
-  },
-
-  /**
-
-   * Seek the next channel with given direction.
-   * Only one seek action is allowed at once.
-   */
-  _seekStation: function(direction, aMessage) {
-    let msg = aMessage.json || { };
-    let messageName = aMessage.name + ":Return";
-
-    // If the FM radio is disabled, do not execute the seek action.
-    if(!this._isEnabled) {
-       this._sendMessage(messageName, false, null, msg);
-       return;
-    }
-
-    let self = this;
-    function callback(success) {
-      debug("Seek completed.");
-      if (!success) {
-        self._sendMessage(messageName, false, null, msg);
-      } else {
-        // Make sure the FM app will get the right frequency.
-        self._updateFrequency();
-        self._sendMessage(messageName, true, null, msg);
-      }
-    }
-
-    if (this._seeking) {
-      // Pass a boolean value to the callback which indicates that
-      // the seek action failed.
-      callback(false);
-      return;
-    }
-
-    this._seekingCallback = callback;
-    this._seeking = true;
-
-    let self = this;
-    FMRadio.seek(direction);
-    FMRadio.addEventListener("seekcomplete", function FM_onSeekComplete() {
-      FMRadio.removeEventListener("seekcomplete", FM_onSeekComplete);
-      self._onSeekComplete(true);
-    });
-  },
-
-  /**
-   * Round the frequency to match the range of frequency and the channel width.
-   * If the given frequency is out of range, return null.
-   * For example:
-   *  - lower: 87.5MHz, upper: 108MHz, channel width: 0.2MHz
-   *    87600 is rounded to 87700
-   *    87580 is rounded to 87500
-   *    109000 is not rounded, null will be returned
-   */
-  _roundFrequency: function(frequencyInKHz) {
-    if (frequencyInKHz < FM_BANDS[this._currentBand].lower ||
-        frequencyInKHz > FM_BANDS[this._currentBand].upper) {
-      return null;
-    }
-
-    let partToBeRounded = frequencyInKHz - FM_BANDS[this._currentBand].lower;
-    let roundedPart = Math.round(partToBeRounded / this._currentWidth) *
-                        this._currentWidth;
-    return FM_BANDS[this._currentBand].lower + roundedPart;
-  },
-
-  observe: function(aSubject, aTopic, aData) {
-    switch (aTopic) {
-      case PROFILE_BEFORE_CHANGE_OBSERVER_TOPIC:
-        this._messages.forEach(function(msgName) {
-          ppmm.removeMessageListener(msgName, this);
-        }.bind(this));
-
-        Services.obs.removeObserver(this, PROFILE_BEFORE_CHANGE_OBSERVER_TOPIC);
-        Services.obs.removeObserver(this, MOZ_SETTINGS_CHANGED_OBSERVER_TOPIC);
-
-        ppmm = null;
-        this._messages = null;
-        break;
-      case MOZ_SETTINGS_CHANGED_OBSERVER_TOPIC:
-        let setting = JSON.parse(aData);
-        this.handleMozSettingsChanged(setting);
-        break;
-    }
-  },
-
-  _sendMessage: function(message, success, data, msg) {
-    msg.manager.sendAsyncMessage(message + (success ? ":OK" : ":NO"), {
-      data: data,
-      rid: msg.rid,
-      mid: msg.mid
-    });
-  },
-
-  handleMozSettingsChanged: function(settings) {
-    switch (settings.key) {
-      case BAND_SETTING_KEY:
-        this._updateBand(settings.value);
-        break;
-      case CHANNEL_WIDTH_SETTING_KEY:
-        this._updateChannelWidth(settings.value);
-        break;
-    }
-  },
-
-  _enableFMRadio: function(msg) {
-    let frequencyInKHz = this._roundFrequency(msg.data * 1000);
-
-    // If the FM radio is already enabled or it is currently being enabled
-    // or the given frequency is out of range, return false.
-    if (this._isEnabled || this._enabling || !frequencyInKHz) {
-      this._sendMessage("DOMFMRadio:enable:Return", false, null, msg);
-      return;
-    }
-
-    this._enabling = true;
-    let self = this;
-
-    FMRadio.addEventListener("enabled", function on_enabled() {
-      debug("FM Radio is enabled!");
-      self._enabling = false;
-
-      FMRadio.removeEventListener("enabled", on_enabled);
-
-      // To make sure the FM app will get right frequency after the FM
-      // radio is enabled, we have to set the frequency first.
-      FMRadio.setFrequency(frequencyInKHz);
-
-      // Update the current frequency without sending 'frequencyChange'
-      // msg, to make sure the FM app will get the right frequency when the
-      // 'enabled' event is fired.
-      self._currentFrequency = FMRadio.frequency;
-
-      self._updatePowerState();
-      self._sendMessage("DOMFMRadio:enable:Return", true, null, msg);
-
-      // The frequency is changed from 'null' to some number, so we should
-      // send the 'frequencyChange' message manually.
-      ppmm.broadcastAsyncMessage("DOMFMRadio:frequencyChange", { });
-    });
-
-    FMRadio.enable({
-      lowerLimit: FM_BANDS[self._currentBand].lower,
-      upperLimit: FM_BANDS[self._currentBand].upper,
-      channelWidth:  self._currentWidth   // 100KHz by default
-    });
-  },
-
-  _disableFMRadio: function(msg) {
-    // If the FM radio is already disabled, return false.
-    if (!this._isEnabled) {
-      this._sendMessage("DOMFMRadio:disable:Return", false, null, msg);
-      return;
-    }
-
-    let self = this;
-    FMRadio.addEventListener("disabled", function on_disabled() {
-      debug("FM Radio is disabled!");
-      FMRadio.removeEventListener("disabled", on_disabled);
-
-      self._updatePowerState();
-      self._sendMessage("DOMFMRadio:disable:Return", true, null, msg);
-
-      // If the FM Radio is currently seeking, no fail-to-seek or similar
-      // event will be fired, execute the seek callback manually.
-      self._onSeekComplete(false);
-    });
-
-    FMRadio.disable();
-  },
-
-  receiveMessage: function(aMessage) {
-    let msg = aMessage.json || {};
-    msg.manager = aMessage.target;
-
-    let ret = 0;
-    let self = this;
-    switch (aMessage.name) {
-      case "DOMFMRadio:enable":
-        self._enableFMRadio(msg);
-        break;
-      case "DOMFMRadio:disable":
-        self._disableFMRadio(msg);
-        break;
-      case "DOMFMRadio:setFrequency":
-        let frequencyInKHz = self._roundFrequency(msg.data * 1000);
-
-        // If the FM radio is disabled or the given frequency is out of range,
-        // skip to set frequency and send back the False message immediately.
-        if (!self._isEnabled || !frequencyInKHz) {
-          self._sendMessage("DOMFMRadio:setFrequency:Return", false, null, msg);
-        } else {
-          FMRadio.setFrequency(frequencyInKHz);
-          self._sendMessage("DOMFMRadio:setFrequency:Return", true, null, msg);
-          this._updateFrequency();
-        }
-        break;
-      case "DOMFMRadio:getCurrentBand":
-        // this message is sync
-        return {
-          lower: FM_BANDS[self._currentBand].lower / 1000,   // in MHz
-          upper: FM_BANDS[self._currentBand].upper / 1000,   // in MHz
-          channelWidth: self._currentWidth / 1000            // in MHz
-        };
-      case "DOMFMRadio:getPowerState":
-        // this message is sync
-        return self._isEnabled;
-      case "DOMFMRadio:getFrequency":
-        // this message is sync
-        return self._isEnabled ? this._currentFrequency / 1000 : null; // in MHz
-      case "DOMFMRadio:getAntennaState":
-        // this message is sync
-        return self._antennaAvailable;
-      case "DOMFMRadio:seekUp":
-        self._seekStation(Ci.nsIFMRadio.SEEK_DIRECTION_UP, aMessage);
-        break;
-      case "DOMFMRadio:seekDown":
-        self._seekStation(Ci.nsIFMRadio.SEEK_DIRECTION_DOWN, aMessage);
-        break;
-      case "DOMFMRadio:cancelSeek":
-        // If the FM radio is disabled, or the FM radio is not currently
-        // seeking, do not execute the cancel seek action.
-        if (!self._isEnabled || !self._seeking) {
-          self._sendMessage("DOMFMRadio:cancelSeek:Return", false, null, msg);
-        } else {
-          FMRadio.cancelSeek();
-          // No fail-to-seek or similar event will be fired from the hal part,
-          // so execute the seek callback here manually.
-          this._onSeekComplete(false);
-          // The FM radio will stop at one frequency without any event, so we need to
-          // update the current frequency, make sure the FM app will get the right frequency.
-          this._updateFrequency();
-          self._sendMessage("DOMFMRadio:cancelSeek:Return", true, null, msg);
-        }
-        break;
-    }
-  }
-};
-
-DOMFMRadioParent.init();
-
deleted file mode 100644
--- a/dom/fm/FMRadio.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/* 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 "mozilla/Hal.h"
-#include "mozilla/HalTypes.h"
-#include "mozilla/Preferences.h"
-#include "nsIAudioManager.h"
-#include "FMRadio.h"
-#include "nsDOMEvent.h"
-#include "nsDOMClassInfo.h"
-#include "nsFMRadioSettings.h"
-#include "nsCOMPtr.h"
-
-#undef LOG
-#if defined(MOZ_WIDGET_GONK)
-#include <android/log.h>
-#define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "FMRadio" , ## args)
-#else
-#define LOG(args...)
-#endif
-
-// The pref indicates if the device has an internal antenna.
-// If the pref is true, the antanna will be always available.
-#define DOM_FM_ANTENNA_INTERNAL_PREF "dom.fm.antenna.internal"
-
-#define RADIO_SEEK_COMPLETE_EVENT_NAME   NS_LITERAL_STRING("seekcomplete")
-#define RADIO_DIABLED_EVENT_NAME         NS_LITERAL_STRING("disabled")
-#define RADIO_ENABLED_EVENT_NAME         NS_LITERAL_STRING("enabled")
-#define ANTENNA_STATE_CHANGED_EVENT_NAME NS_LITERAL_STRING("antennastatechange")
-
-#define NS_AUDIOMANAGER_CONTRACTID "@mozilla.org/telephony/audiomanager;1"
-
-using namespace mozilla::dom::fm;
-using namespace mozilla::hal;
-using mozilla::Preferences;
-
-FMRadio::FMRadio()
-  : mHeadphoneState(SWITCH_STATE_OFF)
-  , mHasInternalAntenna(false)
-{
-  LOG("FMRadio is initialized.");
-
-  mHasInternalAntenna = Preferences::GetBool(DOM_FM_ANTENNA_INTERNAL_PREF,
-                                             /* default = */ false);
-  if (mHasInternalAntenna) {
-    LOG("We have an internal antenna.");
-  } else {
-    RegisterSwitchObserver(SWITCH_HEADPHONES, this);
-    mHeadphoneState = GetCurrentSwitchState(SWITCH_HEADPHONES);
-  }
-
-  RegisterFMRadioObserver(this);
-}
-
-FMRadio::~FMRadio()
-{
-  UnregisterFMRadioObserver(this);
-  if (!mHasInternalAntenna) {
-    UnregisterSwitchObserver(SWITCH_HEADPHONES, this);
-  }
-}
-
-DOMCI_DATA(FMRadio, FMRadio)
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(FMRadio)
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(FMRadio,
-                                                  nsDOMEventTargetHelper)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(FMRadio,
-                                               nsDOMEventTargetHelper)
-NS_IMPL_CYCLE_COLLECTION_TRACE_END
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(FMRadio,
-                                                nsDOMEventTargetHelper)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(FMRadio)
-  NS_INTERFACE_MAP_ENTRY(nsIFMRadio)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(FMRadio)
-NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetHelper)
-
-NS_IMPL_EVENT_HANDLER(FMRadio, seekcomplete)
-NS_IMPL_EVENT_HANDLER(FMRadio, disabled)
-NS_IMPL_EVENT_HANDLER(FMRadio, enabled)
-NS_IMPL_EVENT_HANDLER(FMRadio, antennastatechange)
-
-NS_IMPL_ADDREF_INHERITED(FMRadio, nsDOMEventTargetHelper)
-NS_IMPL_RELEASE_INHERITED(FMRadio, nsDOMEventTargetHelper)
-
-/* readonly attribute boolean isAntennaAvailable; */
-NS_IMETHODIMP FMRadio::GetIsAntennaAvailable(bool *aIsAvailable)
-{
-  if (mHasInternalAntenna) {
-    *aIsAvailable = true;
-  } else {
-    *aIsAvailable = mHeadphoneState == SWITCH_STATE_ON;
-  }
-  return NS_OK;
-}
-
-/* readonly attribute long frequency; */
-NS_IMETHODIMP FMRadio::GetFrequency(int32_t *aFrequency)
-{
-  *aFrequency = GetFMRadioFrequency();
-  return NS_OK;
-}
-
-/* readonly attribute blean enabled; */
-NS_IMETHODIMP FMRadio::GetEnabled(bool *aEnabled)
-{
-  *aEnabled = IsFMRadioOn();
-  return NS_OK;
-}
-
-/* void enable (in nsIFMRadioSettings settings); */
-NS_IMETHODIMP FMRadio::Enable(nsIFMRadioSettings *settings)
-{
-  hal::FMRadioSettings info;
-
-  int32_t upperLimit, lowerLimit, channelWidth;
-
-  settings->GetUpperLimit(&upperLimit);
-  settings->GetLowerLimit(&lowerLimit);
-  settings->GetChannelWidth(&channelWidth);
-
-  info.upperLimit() = upperLimit;
-  info.lowerLimit() = lowerLimit;
-  info.spaceType() = channelWidth;
-
-  EnableFMRadio(info);
-
-  nsCOMPtr<nsIAudioManager> audioManager =
-    do_GetService(NS_AUDIOMANAGER_CONTRACTID);
-  NS_ENSURE_TRUE(audioManager, NS_OK);
-
-  audioManager->SetFmRadioAudioEnabled(true);
-
-  return NS_OK;
-}
-
-/* void disableRadio (); */
-NS_IMETHODIMP FMRadio::Disable()
-{
-  nsCOMPtr<nsIAudioManager> audioManager =
-    do_GetService(NS_AUDIOMANAGER_CONTRACTID);
-  NS_ENSURE_TRUE(audioManager, NS_OK);
-
-  audioManager->SetFmRadioAudioEnabled(false);
-
-  DisableFMRadio();
-
-  return NS_OK;
-}
-
-/* void cancelSeek */
-NS_IMETHODIMP FMRadio::CancelSeek()
-{
-  CancelFMRadioSeek();
-  return NS_OK;
-}
-
-/* void seek (in long direction); */
-NS_IMETHODIMP FMRadio::Seek(int32_t direction)
-{
-  if (direction == (int)FM_RADIO_SEEK_DIRECTION_UP) {
-    FMRadioSeek(FM_RADIO_SEEK_DIRECTION_UP);
-  } else {
-    FMRadioSeek(FM_RADIO_SEEK_DIRECTION_DOWN);
-  }
-  return NS_OK;
-}
-
-/* nsIFMRadioSettings getSettings (); */
-NS_IMETHODIMP FMRadio::GetSettings(nsIFMRadioSettings * *_retval)
-{
-  hal::FMRadioSettings settings;
-  GetFMRadioSettings(&settings);
-
-  nsCOMPtr<nsIFMRadioSettings> radioSettings(new nsFMRadioSettings(
-                                                   settings.upperLimit(),
-                                                   settings.lowerLimit(),
-                                                   settings.spaceType()));
-  radioSettings.forget(_retval);
-
-  return NS_OK;
-}
-
-/* void setFrequency (in long frequency); */
-NS_IMETHODIMP FMRadio::SetFrequency(int32_t frequency)
-{
-  SetFMRadioFrequency(frequency);
-  return NS_OK;
-}
-
-void FMRadio::Notify(const SwitchEvent& aEvent)
-{
-  if (mHeadphoneState != aEvent.status()) {
-    LOG("Antenna state is changed!");
-    mHeadphoneState = aEvent.status();
-    DispatchTrustedEventToSelf(ANTENNA_STATE_CHANGED_EVENT_NAME);
-  }
-}
-
-void FMRadio::Notify(const FMRadioOperationInformation& info)
-{
-  switch (info.operation())
-  {
-    case FM_RADIO_OPERATION_ENABLE:
-      DispatchTrustedEventToSelf(RADIO_ENABLED_EVENT_NAME);
-      break;
-    case FM_RADIO_OPERATION_DISABLE:
-      DispatchTrustedEventToSelf(RADIO_DIABLED_EVENT_NAME);
-      break;
-    case FM_RADIO_OPERATION_SEEK:
-      DispatchTrustedEventToSelf(RADIO_SEEK_COMPLETE_EVENT_NAME);
-      break;
-  }
-}
-
-nsresult
-FMRadio::DispatchTrustedEventToSelf(const nsAString& aEventName)
-{
-  nsRefPtr<nsDOMEvent> event = new nsDOMEvent(nullptr, nullptr);
-  nsresult rv = event->InitEvent(aEventName,
-                                 /* bubbles = */ false,
-                                 /* cancelable = */ false);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  rv = event->SetTrusted(true);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  bool dummy;
-  rv = DispatchEvent(event, &dummy);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
deleted file mode 100644
--- a/dom/fm/FMRadio.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=40: */
-/* 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/. */
-
-#ifndef mozilla_dom_fm_radio_h__
-#define mozilla_dom_fm_radio_h__
-
-#include "nsCOMPtr.h"
-#include "mozilla/HalTypes.h"
-#include "nsDOMEventTargetHelper.h"
-#include "nsIFMRadio.h"
-
-#define NS_FMRADIO_CONTRACTID "@mozilla.org/fmradio;1"
-// 9cb91834-78a9-4029-b644-7806173c5e2d
-#define NS_FMRADIO_CID {0x9cb91834, 0x78a9, 0x4029, \
-      {0xb6, 0x44, 0x78, 0x06, 0x17, 0x3c, 0x5e, 0x2d}}
-
-namespace mozilla {
-namespace dom {
-namespace fm {
-
-/* Header file */
-class FMRadio : public nsDOMEventTargetHelper
-              , public nsIFMRadio
-              , public hal::FMRadioObserver
-              , public hal::SwitchObserver
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIFMRADIO
-
-  NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetHelper::)
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
-                                                   FMRadio,
-                                                   nsDOMEventTargetHelper)
-  FMRadio();
-  virtual void Notify(const hal::FMRadioOperationInformation& info);
-  virtual void Notify(const hal::SwitchEvent& aEvent);
-
-private:
-  ~FMRadio();
-  bool mHasInternalAntenna;
-  hal::SwitchState mHeadphoneState;
-  /**
-   * Dispatch a trusted non-cancellable and no-bubbling event to itself
-   */
-  nsresult DispatchTrustedEventToSelf(const nsAString& aEventName);
-};
-
-} // namespace fm
-} // namespace dom
-} // namespace mozilla
-#endif
-
deleted file mode 100644
--- a/dom/fm/Makefile.in
+++ /dev/null
@@ -1,45 +0,0 @@
-# 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/.
-
-DEPTH            = ../..
-topsrcdir        = @top_srcdir@
-srcdir           = @srcdir@
-VPATH            = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE           = dom
-LIBRARY_NAME     = domfm_s
-XPIDL_MODULE     = dom_fm
-LIBXUL_LIBRARY   = 1
-FORCE_STATIC_LIB = 1
-
-include $(topsrcdir)/dom/dom-config.mk
-
-CPPSRCS += \
-  FMRadio.cpp \
-  nsFMRadioSettings.cpp \
-  $(NULL)
-
-XPIDLSRCS = \
-  nsIDOMFMRadio.idl \
-  nsIFMRadio.idl \
-  $(NULL)
-
-EXTRA_COMPONENTS =      \
-  DOMFMRadioChild.js       \
-  DOMFMRadio.manifest \
-  $(NULL)
-
-EXTRA_JS_MODULES =   \
-  DOMFMRadioParent.jsm \
-  $(NULL)
-
-include $(topsrcdir)/config/rules.mk
-include $(topsrcdir)/ipc/chromium/chromium-config.mk
-
-XPIDL_FLAGS += \
-  -I$(topsrcdir)/dom/interfaces/events \
-  $(NULL)
-
deleted file mode 100644
--- a/dom/fm/nsFMRadioSettings.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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 "nsFMRadioSettings.h"
-
-NS_IMPL_ISUPPORTS1(nsFMRadioSettings, nsIFMRadioSettings)
-
-nsFMRadioSettings::nsFMRadioSettings(int32_t aUpperLimit,
-                                     int32_t aLowerLimit,
-                                     int32_t aChannelWidth)
-{
-  mUpperLimit = aUpperLimit;
-  mLowerLimit = aLowerLimit;
-  mChannelWidth  = aChannelWidth;
-}
-
-nsFMRadioSettings::~nsFMRadioSettings()
-{
-
-}
-
-/* attribute long upperLimit; */
-NS_IMETHODIMP nsFMRadioSettings::GetUpperLimit(int32_t *aUpperLimit)
-{
-  *aUpperLimit = mUpperLimit;
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsFMRadioSettings::SetUpperLimit(int32_t aUpperLimit)
-{
-  mUpperLimit = aUpperLimit;
-  return NS_OK;
-}
-
-/* attribute long lowerLimit; */
-NS_IMETHODIMP nsFMRadioSettings::GetLowerLimit(int32_t *aLowerLimit)
-{
-  *aLowerLimit = mLowerLimit;
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsFMRadioSettings::SetLowerLimit(int32_t aLowerLimit)
-{
-  mLowerLimit = aLowerLimit;
-  return NS_OK;
-}
-
-/* attribute long spaceType; */
-NS_IMETHODIMP nsFMRadioSettings::GetChannelWidth(int32_t *aChannelWidth)
-{
-  *aChannelWidth = mChannelWidth;
-  return NS_OK;
-}
-
-NS_IMETHODIMP nsFMRadioSettings::SetChannelWidth(int32_t aChannelWidth)
-{
-  mChannelWidth = aChannelWidth;
-  return NS_OK;
-}
-
deleted file mode 100644
--- a/dom/fm/nsFMRadioSettings.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=40: */
-/* 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/. */
-
-#ifndef mozilla_dom_fm_radio_settings_h__
-#define mozilla_dom_fm_radio_settings_h__
-
-#include "nsIFMRadio.h"
-
-class nsFMRadioSettings : public nsIFMRadioSettings
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIFMRADIOSETTINGS
-
-  nsFMRadioSettings(int32_t aUpperLimit, int32_t aLowerLimit, int32_t aChannelWidth);
-private:
-  ~nsFMRadioSettings();
-  int32_t mUpperLimit;
-  int32_t mLowerLimit;
-  int32_t mChannelWidth;
-};
-#endif
-
deleted file mode 100644
--- a/dom/fm/nsIDOMFMRadio.idl
+++ /dev/null
@@ -1,122 +0,0 @@
-/* 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 "nsISupports.idl"
-#include "nsIDOMDOMRequest.idl"
-
-[scriptable, uuid(1d0443f3-ac30-4f9e-a070-002bb20ce1e6)]
-interface nsIDOMFMRadio : nsISupports {
-    /* Indicates if the FM radio is enabled. */
-    readonly attribute boolean enabled;
-
-    /* Indicates if the antenna is plugged and available. */
-    readonly attribute boolean antennaAvailable;
-
-    /**
-     * Current frequency in MHz.
-     * The value will be null if the FM radio is disabled.
-     */
-    readonly attribute jsval frequency;
-
-    /* The upper bound of frequency in MHz. */
-    readonly attribute double frequencyUpperBound;
-
-    /* The lower bound of frequency in MHz. */
-    readonly attribute double frequencyLowerBound;
-
-    /**
-     * The channel width of the ranges of frequency, in MHz.
-     * Usually, the value is one of:
-     *  - 0.05 MHz
-     *  - 0.1  MHz
-     *  - 0.2  MHz
-     */
-    readonly attribute double channelWidth;
-
-    /* Fired when the FM radio is enabled. */
-    attribute nsIDOMEventListener onenabled;
-
-    /* Fired when the FM radio is disabled. */
-    attribute nsIDOMEventListener ondisabled;
-
-    /**
-     * Fired when the antenna becomes available or unavailable, i.e., fired when
-     * the antennaAvailable attribute changes.
-     */
-    attribute nsIDOMEventListener onantennaavailablechange;
-
-    /* Fired when the FM radio's frequency is changed. */
-    attribute nsIDOMEventListener onfrequencychange;
-
-    /**
-     * Power the FM radio off.
-     * The disabled event will be fired if this request completes successfully.
-     */
-    nsIDOMDOMRequest disable();
-
-    /**
-     * Power the FM radio on, and tune the radio to the given frequency in MHz.
-     * This will fail if the given frequency is out of range.
-     * The enabled event and frequencychange event will be fired if this request
-     * completes successfully.
-     */
-    nsIDOMDOMRequest enable(in double frequency);
-
-    /**
-     * Tune the FM radio to the given frequency.
-     * This will fail if the given frequency is out of range.
-     *
-     * Note that the FM radio may not tuned to the exact frequency given. To get
-     * the frequency the radio is actually tuned to, wait for the request to fire
-     * onsucess (or wait for the frequencychange event to fire), and then read the
-     * frequency attribute.
-     */
-    nsIDOMDOMRequest setFrequency(in double frequency);
-
-    /**
-     * Tell the FM radio to seek up to the next channel. If the frequency is
-     * successfully changed, the frequencychange event will be triggered.
-     *
-     * Only one seek is allowed at once:
-     * If the radio is seeking when the seekUp is called, onerror will be fired.
-     */
-    nsIDOMDOMRequest seekUp();
-
-    /**
-     * Tell the FM radio to seek down to the next channel. If the frequency is
-     * successfully changed, the frequencychange event will be triggered.
-     *
-     * Only one seek is allowed at once:
-     * If the radio is seeking when the seekDown is called, onerror will be fired.
-     */
-    nsIDOMDOMRequest seekDown();
-
-    /**
-     * Cancel the seek action.
-     * If the radio is not currently seeking up or down, onerror will be fired.
-     */
-    nsIDOMDOMRequest cancelSeek();
-
-
-    /**
-     * These functions related to EventTarget are temporary hacks:
-     *   - addEventListener
-     *   - removeEventListener
-     *   - handleEvent
-     *
-     * These will be removed by inheriting from nsIJSDOMEventTarget,
-     * see bug 731746.
-     */
-    [optional_argc] void addEventListener(in DOMString type,
-                                          in nsIDOMEventListener listener,
-                                          [optional] in boolean useCapture,
-                                          [optional] in boolean wantsUntrusted);
-
-    void  removeEventListener(in DOMString type,
-                              in nsIDOMEventListener listener,
-                              [optional] in boolean useCapture);
-
-    boolean dispatchEvent(in nsIDOMEvent evt) raises(DOMException);
-};
-
deleted file mode 100644
--- a/dom/fm/nsIFMRadio.idl
+++ /dev/null
@@ -1,102 +0,0 @@
-/* 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 "nsIDOMEventTarget.idl"
-
-[scriptable, uuid(c142387a-5488-454b-8b5a-91f0dbee833b)]
-interface nsIFMRadioSettings : nsISupports
-{
-    /* Upper limit in KHz */
-    attribute long upperLimit;
-    /* Lower limit in KHz */
-    attribute long lowerLimit;
-    /* Channel width in KHz */
-    attribute long channelWidth;
-};
-
-/**
- * This is an interface to expose the FM radio hardware related functions;
- * it's kind of the FM radio hardware wrapper interface.
- *
- * Because the WebFM API (navigator.mozFMRadio) is implemented as a JS component,
- * it can't access our C++ hardware interface directly; instead it must go
- * through this interface.
- * Do not confuse this interface with the WebFM DOM interface (nsIDOMFMRadio).
- *
- * If the WebFM API is re-written in c++ some day, this interface will be useless.
- */
-[scriptable, builtinclass, uuid(26288adc-d2c1-4fbc-86b5-ecd8173fbf90)]
-interface nsIFMRadio : nsIDOMEventTarget {
-    const long SEEK_DIRECTION_UP   = 0;
-    const long SEEK_DIRECTION_DOWN = 1;
-
-    /**
-     * Indicates if the FM radio hardware is enabled.
-     */
-    readonly attribute boolean enabled;
-
-    /**
-     * Current frequency in KHz
-     */
-    readonly attribute long frequency;
-
-    /**
-     * Indicates if the antenna is plugged in and available.
-     */
-    readonly attribute boolean isAntennaAvailable;
-
-    /**
-     * Enable the FM radio hardware with the given settings.
-     */
-    void enable(in nsIFMRadioSettings settings);
-
-    /**
-     * Disable the FM radio hardware.
-     */
-    void disable();
-
-    /**
-     * Seek the next available channel (up or down).
-     *
-     * @param direction
-     *   The value should be one of SEEK_DIRECTION_DOWN and SEEK_DIRECTION_UP
-     */
-    void seek(in long direction);
-
-    /**
-     * Cancel the seek action.
-     */
-    void cancelSeek();
-
-    /**
-     * Get the current settings.
-     */
-    nsIFMRadioSettings getSettings();
-
-    /**
-     * Set the frequency in KHz
-     */
-    void setFrequency(in long frequency);
-
-    /**
-     * Fired when the antenna state is changed.
-     */
-    [implicit_jscontext] attribute jsval onantennastatechange;
-
-    /**
-     * Fired when a seek action completes.
-     */
-    [implicit_jscontext] attribute jsval onseekcomplete;
-
-    /**
-     * Fired when the FM radio hardware is enabled.
-     */
-    [implicit_jscontext] attribute jsval onenabled;
-
-    /**
-     * Fired when the FM radio hardware is disabled.
-     */
-    [implicit_jscontext] attribute jsval ondisabled;
-};
-
--- a/dom/system/gonk/AudioManager.cpp
+++ b/dom/system/gonk/AudioManager.cpp
@@ -28,29 +28,16 @@ using namespace mozilla;
 
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "AudioManager" , ## args) 
 
 #define HEADPHONES_STATUS_CHANGED "headphones-status-changed"
 #define HEADPHONES_STATUS_ON      NS_LITERAL_STRING("on").get()
 #define HEADPHONES_STATUS_OFF     NS_LITERAL_STRING("off").get()
 #define HEADPHONES_STATUS_UNKNOWN NS_LITERAL_STRING("unknown").get()
 
-static bool
-IsFmRadioAudioOn()
-{
-  if (static_cast<
-      audio_policy_dev_state_t (*) (audio_devices_t, const char *)
-      >(AudioSystem::getDeviceConnectionState)) {
-    return AudioSystem::getDeviceConnectionState(AUDIO_DEVICE_OUT_FM, "") == 
-           AUDIO_POLICY_DEVICE_STATE_AVAILABLE ? true : false;
-  } else {
-    return false;
-  }
-}
-
 NS_IMPL_ISUPPORTS1(AudioManager, nsIAudioManager)
 
 static AudioSystem::audio_devices
 GetRoutingMode(int aType) {
   if (aType == nsIAudioManager::FORCE_SPEAKER) {
     return AudioSystem::DEVICE_OUT_SPEAKER;
   } else if (aType == nsIAudioManager::FORCE_HEADPHONES) {
     return AudioSystem::DEVICE_OUT_WIRED_HEADSET;
@@ -141,21 +128,16 @@ AudioManager::SetMasterVolume(float aMas
 {
   if (AudioSystem::setMasterVolume(aMasterVolume)) {
     return NS_ERROR_FAILURE;
   }
   // For now, just set the voice volume at the same level
   if (AudioSystem::setVoiceVolume(aMasterVolume)) {
     return NS_ERROR_FAILURE;
   }
-
-  if (IsFmRadioAudioOn() && AudioSystem::setFmVolume(aMasterVolume)) {
-    return NS_ERROR_FAILURE;
-  }
-
   return NS_OK;
 }
 
 NS_IMETHODIMP
 AudioManager::GetMasterMuted(bool* aMasterMuted)
 {
   if (AudioSystem::getMasterMute(aMasterMuted)) {
     return NS_ERROR_FAILURE;
@@ -247,41 +229,10 @@ AudioManager::SetAudioRoute(int aRoutes)
     AudioSystem::setParameters(handle, cmd);
   } else if (static_cast<
              status_t (*)(audio_devices_t, audio_policy_dev_state_t, const char*)
              >(AudioSystem::setDeviceConnectionState)) {
     AudioSystem::setDeviceConnectionState(AUDIO_DEVICE_OUT_WIRED_HEADSET, 
         GetRoutingMode(aRoutes) == AudioSystem::DEVICE_OUT_WIRED_HEADSET ? 
         AUDIO_POLICY_DEVICE_STATE_AVAILABLE : AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
         "");
-
-    // The audio volume is not consistent when we plug and unplug the headset.
-    // Set the fm volume again here.
-    if (IsFmRadioAudioOn()) {
-      float masterVolume;
-      AudioSystem::getMasterVolume(&masterVolume);
-      AudioSystem::setFmVolume(masterVolume);
-    }
   }
 }
-
-NS_IMETHODIMP
-AudioManager::GetFmRadioAudioEnabled(bool *aFmRadioAudioEnabled)
-{
-  *aFmRadioAudioEnabled = IsFmRadioAudioOn();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-AudioManager::SetFmRadioAudioEnabled(bool aFmRadioAudioEnabled)
-{
-  if (static_cast<
-      status_t (*) (AudioSystem::audio_devices, AudioSystem::device_connection_state, const char *)
-      >(AudioSystem::setDeviceConnectionState)) {
-    AudioSystem::setDeviceConnectionState(AUDIO_DEVICE_OUT_FM,
-      aFmRadioAudioEnabled ? AUDIO_POLICY_DEVICE_STATE_AVAILABLE : 
-      AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE, "");
-    InternalSetAudioRoutes(GetCurrentSwitchState(SWITCH_HEADPHONES));
-    return NS_OK;
-  } else {
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-}
--- a/dom/system/gonk/AudioManager.h
+++ b/dom/system/gonk/AudioManager.h
@@ -40,17 +40,16 @@ class AudioManager : public nsIAudioMana
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIAUDIOMANAGER
 
   AudioManager();
   ~AudioManager();
 
   static void SetAudioRoute(int aRoutes);
-
 protected:
   int32_t mPhoneState;
 
 private:
   nsAutoPtr<mozilla::hal::SwitchObserver> mObserver;
 };
 
 } /* namespace gonk */
--- a/dom/system/gonk/nsIAudioManager.idl
+++ b/dom/system/gonk/nsIAudioManager.idl
@@ -18,21 +18,16 @@ interface nsIAudioManager : nsISupports
   attribute float masterVolume;
 
   /**
    * Master volume muted?
    */
   attribute boolean masterMuted;
 
   /**
-   * 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
@@ -776,202 +776,10 @@ SetProcessPriority(int aPid, ProcessPrio
   if (InSandbox()) {
     hal_sandbox::SetProcessPriority(aPid, aPriority);
   }
   else {
     hal_impl::SetProcessPriority(aPid, aPriority);
   }
 }
 
-typedef mozilla::ObserverList<FMRadioOperationInformation> FMRadioObserverList;
-static FMRadioObserverList sFMRadioObservers;
-
-void
-RegisterFMRadioObserver(FMRadioObserver* aFMRadioObserver) {
-  AssertMainThread();
-  sFMRadioObservers.AddObserver(aFMRadioObserver);
-}
-
-void
-UnregisterFMRadioObserver(FMRadioObserver* aFMRadioObserver) {
-  AssertMainThread();
-  sFMRadioObservers.RemoveObserver(aFMRadioObserver);
-}
-
-void
-NotifyFMRadioStatus(const FMRadioOperationInformation& aFMRadioState) {
-  sFMRadioObservers.Broadcast(aFMRadioState);
-}
-
-void
-EnableFMRadio(const FMRadioSettings& aInfo) {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(EnableFMRadio(aInfo));
-}
-
-void
-DisableFMRadio() {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(DisableFMRadio());
-}
-
-void
-FMRadioSeek(const FMRadioSeekDirection& aDirection) {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(FMRadioSeek(aDirection));
-}
-
-void
-GetFMRadioSettings(FMRadioSettings* aInfo) {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(GetFMRadioSettings(aInfo));
-}
-
-void
-SetFMRadioFrequency(const uint32_t aFrequency) {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(SetFMRadioFrequency(aFrequency));
-}
-
-uint32_t
-GetFMRadioFrequency() {
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(GetFMRadioFrequency());
-}
-
-bool
-IsFMRadioOn() {
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(IsFMRadioOn());
-}
-
-uint32_t
-GetFMRadioSignalStrength() {
-  AssertMainThread();
-  RETURN_PROXY_IF_SANDBOXED(GetFMRadioSignalStrength());
-}
-
-void
-CancelFMRadioSeek() {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(CancelFMRadioSeek());
-}
-
-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;
-}
-
 } // namespace hal
 } // namespace mozilla
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -432,83 +432,16 @@ bool SetAlarm(int32_t aSeconds, int32_t 
  * Set the priority of the given process.
  *
  * Exactly what this does will vary between platforms.  On *nix we might give
  * background processes higher nice values.  On other platforms, we might
  * ignore this call entirely.
  */
 void SetProcessPriority(int aPid, hal::ProcessPriority aPriority);
 
-/**
- * Register an observer for the FM radio.
- */
-void RegisterFMRadioObserver(hal::FMRadioObserver* aRadioObserver);
-
-/**
- * Unregister the observer for the FM radio.
- */
-void UnregisterFMRadioObserver(hal::FMRadioObserver* aRadioObserver);
-
-/**
- * Notify observers that a call to EnableFMRadio, DisableFMRadio, or FMRadioSeek
- * has completed, and indicate what the call returned.
- */
-void NotifyFMRadioStatus(const hal::FMRadioOperationInformation& aRadioState);
-
-/**
- * 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.
- *
- */
-void FMRadioSeek(const hal::FMRadioSeekDirection& aDirection);
-
-/**
- * Get the current FM radio settings.
- */
-void GetFMRadioSettings(hal::FMRadioSettings* aInfo);
-
-/**
- * Set the FM radio's frequency.
- */
-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);
-
 } // namespace MOZ_HAL_NAMESPACE
 } // namespace mozilla
 
 #ifdef MOZ_DEFINED_HAL_NAMESPACE
 # undef MOZ_DEFINED_HAL_NAMESPACE
 # undef MOZ_HAL_NAMESPACE
 #endif
 
--- a/hal/HalTypes.h
+++ b/hal/HalTypes.h
@@ -76,92 +76,16 @@ enum WakeLockControl {
 
 enum SystemTimeChange {
   SYS_TIME_CHANGE_UNKNOWN = -1,
   SYS_TIME_CHANGE_CLOCK,
   SYS_TIME_CHANGE_TZ,
   SYS_TIME_CHANGE_GUARD
 };
 
-class FMRadioOperationInformation;
-
-enum FMRadioOperation {
-  FM_RADIO_OPERATION_UNKNOWN = -1,
-  FM_RADIO_OPERATION_ENABLE,
-  FM_RADIO_OPERATION_DISABLE,
-  FM_RADIO_OPERATION_SEEK,
-  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
-};
-
-typedef Observer<FMRadioOperationInformation> FMRadioObserver;
 } // namespace hal
 } // namespace mozilla
 
 namespace IPC {
 
 /**
  * Light type serializer.
  */
@@ -234,50 +158,11 @@ struct ParamTraits<mozilla::hal::Process
  */
 template <>
 struct ParamTraits<mozilla::hal::SystemTimeChange>
   : public EnumSerializer<mozilla::hal::SystemTimeChange,
                           mozilla::hal::SYS_TIME_CHANGE_UNKNOWN,
                           mozilla::hal::SYS_TIME_CHANGE_GUARD>
 {};
  
-/**
- * Serializer for FMRadioOperation
- */
-template <>
-struct ParamTraits<mozilla::hal::FMRadioOperation>:
-  public EnumSerializer<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 EnumSerializer<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 EnumSerializer<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 EnumSerializer<mozilla::hal::FMRadioCountry,
-                        mozilla::hal::FM_RADIO_COUNTRY_UNKNOWN,
-                        mozilla::hal::NUM_FM_RADIO_COUNTRY>
-{};
 } // namespace IPC
 
 #endif // mozilla_hal_Types_h
--- a/hal/Makefile.in
+++ b/hal/Makefile.in
@@ -52,17 +52,16 @@ CPPSRCS += \
   $(NULL)
 else ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += \
   GonkHal.cpp \
   LinuxPower.cpp \
   GonkSensor.cpp \
   UeventPoller.cpp \
   GonkSwitch.cpp \
-  GonkFMRadio.cpp \
   $(NULL)
 else ifeq (Linux,$(OS_TARGET))
 CPPSRCS += \
   LinuxPower.cpp \
   FallbackScreenConfiguration.cpp \
   FallbackSensor.cpp \
   FallbackVibration.cpp \
   FallbackAlarm.cpp \
@@ -121,17 +120,16 @@ endif
 ifneq (gonk,$(MOZ_WIDGET_TOOLKIT)) #{
 CPPSRCS += \
   FallbackLights.cpp  \
   FallbackTime.cpp \
   FallbackWakeLocks.cpp \
   FallbackSwitch.cpp \
   FallbackScreenPower.cpp \
   FallbackProcessPriority.cpp \
-  FallbackFMRadio.cpp \
   $(NULL)
 endif #}
 
 # Fallbacks for backends implemented on Android only.
 ifneq (android,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += FallbackNetwork.cpp
 endif
 
deleted file mode 100644
--- a/hal/fallback/FallbackFMRadio.cpp
+++ /dev/null
@@ -1,60 +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->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()
-{}
-
-} // hal_impl
-} // namespace mozilla
deleted file mode 100644
--- a/hal/gonk/GonkFMRadio.cpp
+++ /dev/null
@@ -1,324 +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 "tavarua.h"
-#include "nsThreadUtils.h"
-#include "mozilla/FileUtils.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <linux/videodev2.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-namespace mozilla {
-namespace hal_impl {
-
-uint32_t GetFMRadioFrequency();
-
-static int sRadioFD;
-static bool sRadioEnabled;
-static pthread_t sMonitorThread;
-
-static int
-setControl(uint32_t id, int32_t value)
-{
-  struct v4l2_control control;
-  control.id = id;
-  control.value = value;
-  return ioctl(sRadioFD, VIDIOC_S_CTRL, &control);
-}
-
-class RadioUpdate : public nsRunnable {
-  hal::FMRadioOperation mOp;
-public:
-  RadioUpdate(hal::FMRadioOperation op)
-    : mOp(op)
-  {}
-
-  NS_IMETHOD Run() {
-    hal::FMRadioOperationInformation info;
-    info.operation() = mOp;
-    info.status() = hal::FM_RADIO_OPERATION_STATUS_SUCCESS;
-    info.frequency() = GetFMRadioFrequency();
-    hal::NotifyFMRadioStatus(info);
-    return NS_OK;
-  }
-};
-
-static void *
-pollTavaruaRadio(void *)
-{
-  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) {
-    int rc = ioctl(sRadioFD, VIDIOC_DQBUF, &buffer);
-    if (rc)
-      return NULL;
-
-    for (unsigned int i = 0; i < buffer.bytesused; i++) {
-      switch (buf[i]) {
-      case TAVARUA_EVT_RADIO_READY:
-        NS_DispatchToMainThread(new RadioUpdate(hal::FM_RADIO_OPERATION_ENABLE));
-        break;
-      case TAVARUA_EVT_SEEK_COMPLETE:
-        NS_DispatchToMainThread(new RadioUpdate(hal::FM_RADIO_OPERATION_SEEK));
-        break;
-      default:
-        break;
-      }
-    }
-  }
-
-  return NULL;
-}
-
-void
-EnableFMRadio(const hal::FMRadioSettings& aInfo)
-{
-  if (sRadioEnabled) {
-    HAL_LOG(("Radio already enabled!"));
-    return;
-  }
-
-  mozilla::ScopedClose fd(open("/dev/radio0", O_RDWR));
-  if (fd < 0) {
-    HAL_LOG(("Unable to open radio device"));
-    return;
-  }
-
-  struct v4l2_capability cap;
-  int rc = ioctl(fd, VIDIOC_QUERYCAP, &cap);
-  if (rc < 0) {
-    HAL_LOG(("Unable to query radio device"));
-    return;
-  }
-
-  HAL_LOG(("Radio: %s (%s)\n", cap.driver, cap.card));
-
-  if (!(cap.capabilities & V4L2_CAP_RADIO)) {
-    HAL_LOG(("/dev/radio0 isn't a radio"));
-    return;
-  }
-
-  if (!(cap.capabilities & V4L2_CAP_TUNER)) {
-    HAL_LOG(("/dev/radio0 doesn't support the tuner interface"));
-    return;
-  }
-  sRadioFD = fd;
-
-  // Tavarua specific start
-  char command[64];
-  snprintf(command, sizeof(command), "/system/bin/fm_qsoc_patches %d 0", cap.version);
-  rc = system(command);
-  if (rc) {
-    HAL_LOG(("Unable to initialize radio"));
-    return;
-  }
-
-  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;
-  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;
-  }
-
-  rc = setControl(V4L2_CID_PRIVATE_TAVARUA_SET_AUDIO_PATH, FM_DIGITAL_PATH);
-  if (rc < 0) {
-    HAL_LOG(("Unable to set audio path"));
-    return;
-  }
-
-  pthread_create(&sMonitorThread, NULL, pollTavaruaRadio, NULL);
-  // Tavarua specific end
-
-  fd.forget();
-  sRadioEnabled = true;
-}
-
-void
-DisableFMRadio()
-{
-  if (!sRadioEnabled)
-    return;
-
-  sRadioEnabled = false;
-
-  // Tavarua specific start
-  int rc = setControl(V4L2_CID_PRIVATE_TAVARUA_STATE, FM_OFF);
-  if (rc < 0) {
-    HAL_LOG(("Unable to turn off radio"));
-  }
-  // Tavarua specific end
-
-  pthread_join(sMonitorThread, NULL);
-
-  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;
-  int rc = ioctl(sRadioFD, VIDIOC_S_HW_FREQ_SEEK, &seek);
-  if (rc < 0) {
-    HAL_LOG(("Could not initiate hardware seek"));
-    return;
-  }
-}
-
-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"));
-}
-
-uint32_t
-GetFMRadioFrequency()
-{
-  if (!sRadioEnabled)
-    return 0;
-
-  struct v4l2_frequency freq;
-  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()
-{}
-
-} // hal_impl
-} // namespace mozilla
deleted file mode 100644
--- a/hal/gonk/tavarua.h
+++ /dev/null
@@ -1,484 +0,0 @@
-#ifndef __LINUX_TAVARUA_H
-#define __LINUX_TAVARUA_H
-
-/* This is a Linux header generated by "make headers_install" */
-
-#include <stdint.h>
-#include <linux/ioctl.h>
-#include <linux/videodev2.h>
-
-
-#undef FM_DEBUG
-
-/* constants */
-#define  RDS_BLOCKS_NUM             (4)
-#define BYTES_PER_BLOCK             (3)
-#define MAX_PS_LENGTH              (96)
-#define MAX_RT_LENGTH              (64)
-
-#define XFRDAT0                    (0x20)
-#define XFRDAT1                    (0x21)
-#define XFRDAT2                    (0x22)
-
-#define INTDET_PEEK_MSB            (0x88)
-#define INTDET_PEEK_LSB            (0x26)
-
-#define RMSSI_PEEK_MSB             (0x88)
-#define RMSSI_PEEK_LSB             (0xA8)
-
-#define MPX_DCC_BYPASS_POKE_MSB    (0x88)
-#define MPX_DCC_BYPASS_POKE_LSB    (0xC0)
-
-#define MPX_DCC_PEEK_MSB_REG1      (0x88)
-#define MPX_DCC_PEEK_LSB_REG1      (0xC2)
-
-#define MPX_DCC_PEEK_MSB_REG2      (0x88)
-#define MPX_DCC_PEEK_LSB_REG2      (0xC3)
-
-#define MPX_DCC_PEEK_MSB_REG3      (0x88)
-#define MPX_DCC_PEEK_LSB_REG3      (0xC4)
-
-#define ON_CHANNEL_TH_MSB          (0x0B)
-#define ON_CHANNEL_TH_LSB          (0xA8)
-
-#define OFF_CHANNEL_TH_MSB         (0x0B)
-#define OFF_CHANNEL_TH_LSB         (0xAC)
-
-#define ENF_200Khz                    (1)
-#define SRCH200KHZ_OFFSET             (7)
-#define SRCH_MASK                  (1 << SRCH200KHZ_OFFSET)
-
-/* Standard buffer size */
-#define STD_BUF_SIZE               (128)
-/* Search direction */
-#define SRCH_DIR_UP                 (0)
-#define SRCH_DIR_DOWN               (1)
-
-/* control options */
-#define CTRL_ON                     (1)
-#define CTRL_OFF                    (0)
-
-#define US_LOW_BAND                (87.5)
-#define US_HIGH_BAND               (108)
-
-/* constant for Tx */
-
-#define MASK_PI                    (0x0000FFFF)
-#define MASK_PI_MSB                (0x0000FF00)
-#define MASK_PI_LSB                (0x000000FF)
-#define MASK_PTY                   (0x0000001F)
-#define MASK_TXREPCOUNT            (0x0000000F)
-
-#undef FMDBG
-#ifdef FM_DEBUG
-  #define FMDBG(fmt, args...) printk(KERN_INFO "tavarua_radio: " fmt, ##args)
-#else
-  #define FMDBG(fmt, args...)
-#endif
-
-#undef FMDERR
-#define FMDERR(fmt, args...) printk(KERN_INFO "tavarua_radio: " fmt, ##args)
-
-#undef FMDBG_I2C
-#ifdef FM_DEBUG_I2C
-  #define FMDBG_I2C(fmt, args...) printk(KERN_INFO "fm_i2c: " fmt, ##args)
-#else
-  #define FMDBG_I2C(fmt, args...)
-#endif
-
-/* function declarations */
-/* FM Core audio paths. */
-#define TAVARUA_AUDIO_OUT_ANALOG_OFF	(0)
-#define TAVARUA_AUDIO_OUT_ANALOG_ON	(1)
-#define TAVARUA_AUDIO_OUT_DIGITAL_OFF	(0)
-#define TAVARUA_AUDIO_OUT_DIGITAL_ON	(1)
-
-int tavarua_set_audio_path(int digital_on, int analog_on);
-
-/* defines and enums*/
-
-#define MARIMBA_A0	0x01010013
-#define MARIMBA_2_1	0x02010204
-#define BAHAMA_1_0	0x0302010A
-#define BAHAMA_2_0	0x04020205
-#define WAIT_TIMEOUT 2000
-#define RADIO_INIT_TIME 15
-#define TAVARUA_DELAY 10
-/*
- * The frequency is set in units of 62.5 Hz when using V4L2_TUNER_CAP_LOW,
- * 62.5 kHz otherwise.
- * The tuner is able to have a channel spacing of 50, 100 or 200 kHz.
- * tuner->capability is therefore set to V4L2_TUNER_CAP_LOW
- * The FREQ_MUL is then: 1 MHz / 62.5 Hz = 16000
- */
-#define FREQ_MUL (1000000 / 62.5)
-
-enum v4l2_cid_private_tavarua_t {
-	V4L2_CID_PRIVATE_TAVARUA_SRCHMODE = (V4L2_CID_PRIVATE_BASE + 1),
-	V4L2_CID_PRIVATE_TAVARUA_SCANDWELL,
-	V4L2_CID_PRIVATE_TAVARUA_SRCHON,
-	V4L2_CID_PRIVATE_TAVARUA_STATE,
-	V4L2_CID_PRIVATE_TAVARUA_TRANSMIT_MODE,
-	V4L2_CID_PRIVATE_TAVARUA_RDSGROUP_MASK,
-	V4L2_CID_PRIVATE_TAVARUA_REGION,
-	V4L2_CID_PRIVATE_TAVARUA_SIGNAL_TH,
-	V4L2_CID_PRIVATE_TAVARUA_SRCH_PTY,
-	V4L2_CID_PRIVATE_TAVARUA_SRCH_PI,
-	V4L2_CID_PRIVATE_TAVARUA_SRCH_CNT,
-	V4L2_CID_PRIVATE_TAVARUA_EMPHASIS,
-	V4L2_CID_PRIVATE_TAVARUA_RDS_STD,
-	V4L2_CID_PRIVATE_TAVARUA_SPACING,
-	V4L2_CID_PRIVATE_TAVARUA_RDSON,
-	V4L2_CID_PRIVATE_TAVARUA_RDSGROUP_PROC,
-	V4L2_CID_PRIVATE_TAVARUA_LP_MODE,
-	V4L2_CID_PRIVATE_TAVARUA_ANTENNA,
-	V4L2_CID_PRIVATE_TAVARUA_RDSD_BUF,
-	V4L2_CID_PRIVATE_TAVARUA_PSALL,
-	/*v4l2 Tx controls*/
-	V4L2_CID_PRIVATE_TAVARUA_TX_SETPSREPEATCOUNT,
-	V4L2_CID_PRIVATE_TAVARUA_STOP_RDS_TX_PS_NAME,
-	V4L2_CID_PRIVATE_TAVARUA_STOP_RDS_TX_RT,
-	V4L2_CID_PRIVATE_TAVARUA_IOVERC,
-	V4L2_CID_PRIVATE_TAVARUA_INTDET,
-	V4L2_CID_PRIVATE_TAVARUA_MPX_DCC,
-	V4L2_CID_PRIVATE_TAVARUA_AF_JUMP,
-	V4L2_CID_PRIVATE_TAVARUA_RSSI_DELTA,
-	V4L2_CID_PRIVATE_TAVARUA_HLSI,
-
-	/*
-	* Here we have IOCTl's that are specific to IRIS
-	* (V4L2_CID_PRIVATE_BASE + 0x1E to V4L2_CID_PRIVATE_BASE + 0x28)
-	*/
-	V4L2_CID_PRIVATE_SOFT_MUTE,/* 0x800001E*/
-	V4L2_CID_PRIVATE_RIVA_ACCS_ADDR,
-	V4L2_CID_PRIVATE_RIVA_ACCS_LEN,
-	V4L2_CID_PRIVATE_RIVA_PEEK,
-	V4L2_CID_PRIVATE_RIVA_POKE,
-	V4L2_CID_PRIVATE_SSBI_ACCS_ADDR,
-	V4L2_CID_PRIVATE_SSBI_PEEK,
-	V4L2_CID_PRIVATE_SSBI_POKE,
-	V4L2_CID_PRIVATE_TX_TONE,
-	V4L2_CID_PRIVATE_RDS_GRP_COUNTERS,
-	V4L2_CID_PRIVATE_SET_NOTCH_FILTER,/* 0x8000028 */
-
-	V4L2_CID_PRIVATE_TAVARUA_SET_AUDIO_PATH,/* 0x8000029 */
-	V4L2_CID_PRIVATE_TAVARUA_DO_CALIBRATION,/* 0x800002A : IRIS */
-	V4L2_CID_PRIVATE_TAVARUA_SRCH_ALGORITHM,/* 0x800002B */
-	V4L2_CID_PRIVATE_IRIS_GET_SINR, /* 0x800002C : IRIS */
-	V4L2_CID_PRIVATE_INTF_LOW_THRESHOLD, /* 0x800002D */
-	V4L2_CID_PRIVATE_INTF_HIGH_THRESHOLD, /* 0x800002E */
-	V4L2_CID_PRIVATE_SINR_THRESHOLD,  /* 0x800002F : IRIS */
-	V4L2_CID_PRIVATE_SINR_SAMPLES,  /* 0x8000030 : IRIS */
-
-};
-
-enum tavarua_buf_t {
-	TAVARUA_BUF_SRCH_LIST,
-	TAVARUA_BUF_EVENTS,
-	TAVARUA_BUF_RT_RDS,
-	TAVARUA_BUF_PS_RDS,
-	TAVARUA_BUF_RAW_RDS,
-	TAVARUA_BUF_AF_LIST,
-	TAVARUA_BUF_MAX
-};
-
-enum tavarua_xfr_t {
-	TAVARUA_XFR_SYNC,
-	TAVARUA_XFR_ERROR,
-	TAVARUA_XFR_SRCH_LIST,
-	TAVARUA_XFR_RT_RDS,
-	TAVARUA_XFR_PS_RDS,
-	TAVARUA_XFR_AF_LIST,
-	TAVARUA_XFR_MAX
-};
-
-enum channel_spacing {
-	FM_CH_SPACE_200KHZ,
-	FM_CH_SPACE_100KHZ,
-	FM_CH_SPACE_50KHZ
-};
-
-enum step_size {
-	NO_SRCH200khz,
-	ENF_SRCH200khz
-};
-
-enum emphasis {
-	EMP_75,
-	EMP_50
-};
-
-enum rds_std {
-	RBDS_STD,
-	RDS_STD
-};
-
-/* offsets */
-#define RAW_RDS		0x0F
-#define RDS_BLOCK 	3
-
-/* registers*/
-#define MARIMBA_XO_BUFF_CNTRL 0x07
-#define RADIO_REGISTERS 0x30
-#define XFR_REG_NUM     16
-#define STATUS_REG_NUM 	3
-
-/* TX constants */
-#define HEADER_SIZE	4
-#define TX_ON		0x80
-#define TAVARUA_TX_RT	RDS_RT_0
-#define TAVARUA_TX_PS	RDS_PS_0
-
-enum register_t {
-	STATUS_REG1 = 0,
-	STATUS_REG2,
-	STATUS_REG3,
-	RDCTRL,
-	FREQ,
-	TUNECTRL,
-	SRCHRDS1,
-	SRCHRDS2,
-	SRCHCTRL,
-	IOCTRL,
-	RDSCTRL,
-	ADVCTRL,
-	AUDIOCTRL,
-	RMSSI,
-	IOVERC,
-	AUDIOIND = 0x1E,
-	XFRCTRL,
-	FM_CTL0 = 0xFF,
-	LEAKAGE_CNTRL = 0xFE,
-};
-#define BAHAMA_RBIAS_CTL1       0x07
-#define	BAHAMA_FM_MODE_REG      0xFD
-#define	BAHAMA_FM_CTL1_REG      0xFE
-#define	BAHAMA_FM_CTL0_REG      0xFF
-#define BAHAMA_FM_MODE_NORMAL   0x00
-#define BAHAMA_LDO_DREG_CTL0    0xF0
-#define BAHAMA_LDO_AREG_CTL0    0xF4
-
-/* Radio Control */
-#define RDCTRL_STATE_OFFSET	0
-#define RDCTRL_STATE_MASK	(3 << RDCTRL_STATE_OFFSET)
-#define RDCTRL_BAND_OFFSET	2
-#define RDCTRL_BAND_MASK	(1 << RDCTRL_BAND_OFFSET)
-#define RDCTRL_CHSPACE_OFFSET	3
-#define RDCTRL_CHSPACE_MASK	(3 << RDCTRL_CHSPACE_OFFSET)
-#define RDCTRL_DEEMPHASIS_OFFSET 5
-#define RDCTRL_DEEMPHASIS_MASK	(1 << RDCTRL_DEEMPHASIS_OFFSET)
-#define RDCTRL_HLSI_OFFSET	6
-#define RDCTRL_HLSI_MASK	(3 << RDCTRL_HLSI_OFFSET)
-#define RDSAF_OFFSET		6
-#define RDSAF_MASK		(1 << RDSAF_OFFSET)
-
-/* Tune Control */
-#define TUNE_STATION	0x01
-#define ADD_OFFSET	(1 << 1)
-#define SIGSTATE	(1 << 5)
-#define MOSTSTATE	(1 << 6)
-#define RDSSYNC		(1 << 7)
-/* Search Control */
-#define SRCH_MODE_OFFSET	0
-#define SRCH_MODE_MASK		(7 << SRCH_MODE_OFFSET)
-#define SRCH_DIR_OFFSET		3
-#define SRCH_DIR_MASK		(1 << SRCH_DIR_OFFSET)
-#define SRCH_DWELL_OFFSET	4
-#define SRCH_DWELL_MASK		(7 << SRCH_DWELL_OFFSET)
-#define SRCH_STATE_OFFSET	7
-#define SRCH_STATE_MASK		(1 << SRCH_STATE_OFFSET)
-
-/* I/O Control */
-#define IOC_HRD_MUTE	0x03
-#define IOC_SFT_MUTE    (1 << 2)
-#define IOC_MON_STR     (1 << 3)
-#define IOC_SIG_BLND    (1 << 4)
-#define IOC_INTF_BLND   (1 << 5)
-#define IOC_ANTENNA     (1 << 6)
-#define IOC_ANTENNA_OFFSET	6
-#define IOC_ANTENNA_MASK     	(1 << IOC_ANTENNA_OFFSET)
-
-/* RDS Control */
-#define RDS_ON		0x01
-#define RDSCTRL_STANDARD_OFFSET 1
-#define RDSCTRL_STANDARD_MASK	(1 << RDSCTRL_STANDARD_OFFSET)
-
-/* Advanced features controls */
-#define RDSRTEN		(1 << 3)
-#define RDSPSEN		(1 << 4)
-
-/* Audio path control */
-#define AUDIORX_ANALOG_OFFSET 	0
-#define AUDIORX_ANALOG_MASK 	(1 << AUDIORX_ANALOG_OFFSET)
-#define AUDIORX_DIGITAL_OFFSET 	1
-#define AUDIORX_DIGITAL_MASK 	(1 << AUDIORX_DIGITAL_OFFSET)
-#define AUDIOTX_OFFSET		2
-#define AUDIOTX_MASK		(1 << AUDIOTX_OFFSET)
-#define I2SCTRL_OFFSET		3
-#define I2SCTRL_MASK		(1 << I2SCTRL_OFFSET)
-
-/* Search options */
-enum search_t {
-	SEEK,
-	SCAN,
-	SCAN_FOR_STRONG,
-	SCAN_FOR_WEAK,
-	RDS_SEEK_PTY,
-	RDS_SCAN_PTY,
-	RDS_SEEK_PI,
-	RDS_AF_JUMP,
-};
-
-enum audio_path {
-	FM_DIGITAL_PATH,
-	FM_ANALOG_PATH
-};
-#define SRCH_MODE	0x07
-#define SRCH_DIR	0x08 /* 0-up 1-down */
-#define SCAN_DWELL	0x70
-#define SRCH_ON		0x80
-
-/* RDS CONFIG */
-#define RDS_CONFIG_PSALL 0x01
-
-#define FM_ENABLE	0x22
-#define SET_REG_FIELD(reg, val, offset, mask) \
-	(reg = (reg & ~mask) | (((val) << offset) & mask))
-#define GET_REG_FIELD(reg, offset, mask) ((reg & mask) >> offset)
-#define RSH_DATA(val, offset)    ((val) >> (offset))
-#define LSH_DATA(val, offset)    ((val) << (offset))
-#define GET_ABS_VAL(val)        ((val) & (0xFF))
-
-enum radio_state_t {
-	FM_OFF,
-	FM_RECV,
-	FM_TRANS,
-	FM_RESET,
-};
-
-#define XFRCTRL_WRITE   (1 << 7)
-
-/* Interrupt status */
-
-/* interrupt register 1 */
-#define	READY		(1 << 0) /* Radio ready after powerup or reset */
-#define	TUNE		(1 << 1) /* Tune completed */
-#define	SEARCH		(1 << 2) /* Search completed (read FREQ) */
-#define	SCANNEXT	(1 << 3) /* Scanning for next station */
-#define	SIGNAL		(1 << 4) /* Signal indicator change (read SIGSTATE) */
-#define	INTF		(1 << 5) /* Interference cnt has fallen outside range */
-#define	SYNC		(1 << 6) /* RDS sync state change (read RDSSYNC) */
-#define	AUDIO		(1 << 7) /* Audio Control indicator (read AUDIOIND) */
-
-/* interrupt register 2 */
-#define	RDSDAT		(1 << 0) /* New unread RDS data group available */
-#define	BLOCKB		(1 << 1) /* Block-B match condition exists */
-#define	PROGID		(1 << 2) /* Block-A or Block-C matched stored PI value*/
-#define	RDSPS		(1 << 3) /* New RDS Program Service Table available */
-#define	RDSRT		(1 << 4) /* New RDS Radio Text available */
-#define	RDSAF		(1 << 5) /* New RDS AF List available */
-#define	TXRDSDAT	(1 << 6) /* Transmitted an RDS group */
-#define	TXRDSDONE	(1 << 7) /* RDS raw group one-shot transmit completed */
-
-/* interrupt register 3 */
-#define	TRANSFER	(1 << 0) /* Data transfer (XFR) completed */
-#define	RDSPROC		(1 << 1) /* Dynamic RDS Processing complete */
-#define	ERROR		(1 << 7) /* Err occurred.Read code to determine cause */
-
-
-#define	FM_TX_PWR_LVL_0		0 /* Lowest power lvl that can be set for Tx */
-#define	FM_TX_PWR_LVL_MAX	7 /* Max power lvl for Tx */
-/* Transfer */
-enum tavarua_xfr_ctrl_t {
-	RDS_PS_0 = 0x01,
-	RDS_PS_1,
-	RDS_PS_2,
-	RDS_PS_3,
-	RDS_PS_4,
-	RDS_PS_5,
-	RDS_PS_6,
-	RDS_RT_0,
-	RDS_RT_1,
-	RDS_RT_2,
-	RDS_RT_3,
-	RDS_RT_4,
-	RDS_AF_0,
-	RDS_AF_1,
-	RDS_CONFIG,
-	RDS_TX_GROUPS,
-	RDS_COUNT_0,
-	RDS_COUNT_1,
-	RDS_COUNT_2,
-	RADIO_CONFIG,
-	RX_CONFIG,
-	RX_TIMERS,
-	RX_STATIONS_0,
-	RX_STATIONS_1,
-	INT_CTRL,
-	ERROR_CODE,
-	CHIPID,
-	CAL_DAT_0 = 0x20,
-	CAL_DAT_1,
-	CAL_DAT_2,
-	CAL_DAT_3,
-	CAL_CFG_0,
-	CAL_CFG_1,
-	DIG_INTF_0,
-	DIG_INTF_1,
-	DIG_AGC_0,
-	DIG_AGC_1,
-	DIG_AGC_2,
-	DIG_AUDIO_0,
-	DIG_AUDIO_1,
-	DIG_AUDIO_2,
-	DIG_AUDIO_3,
-	DIG_AUDIO_4,
-	DIG_RXRDS,
-	DIG_DCC,
-	DIG_SPUR,
-	DIG_MPXDCC,
-	DIG_PILOT,
-	DIG_DEMOD,
-	DIG_MOST,
-	DIG_TX_0,
-	DIG_TX_1,
-	PHY_TXGAIN = 0x3B,
-	PHY_CONFIG,
-	PHY_TXBLOCK,
-	PHY_TCB,
-	XFR_PEEK_MODE = 0x40,
-	XFR_POKE_MODE = 0xC0,
-	TAVARUA_XFR_CTRL_MAX
-};
-
-enum tavarua_evt_t {
-	TAVARUA_EVT_RADIO_READY,
-	TAVARUA_EVT_TUNE_SUCC,
-	TAVARUA_EVT_SEEK_COMPLETE,
-	TAVARUA_EVT_SCAN_NEXT,
-	TAVARUA_EVT_NEW_RAW_RDS,
-	TAVARUA_EVT_NEW_RT_RDS,
-	TAVARUA_EVT_NEW_PS_RDS,
-	TAVARUA_EVT_ERROR,
-	TAVARUA_EVT_BELOW_TH,
-	TAVARUA_EVT_ABOVE_TH,
-	TAVARUA_EVT_STEREO,
-	TAVARUA_EVT_MONO,
-	TAVARUA_EVT_RDS_AVAIL,
-	TAVARUA_EVT_RDS_NOT_AVAIL,
-	TAVARUA_EVT_NEW_SRCH_LIST,
-	TAVARUA_EVT_NEW_AF_LIST,
-	TAVARUA_EVT_TXRDSDAT,
-	TAVARUA_EVT_TXRDSDONE,
-	TAVARUA_EVT_RADIO_DISABLED
-};
-
-enum tavarua_region_t {
-	TAVARUA_REGION_US,
-	TAVARUA_REGION_EU,
-	TAVARUA_REGION_JAPAN,
-	TAVARUA_REGION_JAPAN_WIDE,
-	TAVARUA_REGION_OTHER
-};
-
-#endif /* __LINUX_TAVARUA_H */
--- a/hal/sandbox/PHal.ipdl
+++ b/hal/sandbox/PHal.ipdl
@@ -20,20 +20,16 @@ using mozilla::hal::SensorType;
 using mozilla::hal::SensorAccuracyType;
 using mozilla::hal::WakeLockControl;
 using mozilla::hal::SwitchState;
 using mozilla::hal::SwitchDevice;
 using mozilla::hal::ProcessPriority;
 using nsIntRect;
 using PRTime;
 using mozilla::hal::SystemTimeChange;
-using mozilla::hal::FMRadioCountry;
-using mozilla::hal::FMRadioOperation;
-using mozilla::hal::FMRadioOperationStatus;
-using mozilla::hal::FMRadioSeekDirection;
 
 namespace mozilla {
 
 namespace hal {
 struct BatteryInformation {
   double level;
   bool   charging;
   double remainingTime;
@@ -73,45 +69,30 @@ struct WakeLockInformation {
 
 struct ScreenConfiguration {
   nsIntRect rect;
   ScreenOrientation orientation;
   uint32_t colorDepth;
   uint32_t pixelDepth;
 };
 
-struct FMRadioOperationInformation {
-  FMRadioOperation operation;
-  FMRadioOperationStatus status;
-  uint32_t frequency;
-};
-
-struct FMRadioSettings {
-  FMRadioCountry country;
-  uint32_t upperLimit;
-  uint32_t lowerLimit;
-  uint32_t spaceType;
-  uint32_t preEmphasis;
-};
-
 } // namespace hal
 
 namespace hal_sandbox {
 
 sync protocol PHal {
     manager PContent;
 
 child:
     NotifyBatteryChange(BatteryInformation aBatteryInfo);
     NotifyNetworkChange(NetworkInformation aNetworkInfo);
     NotifyWakeLockChange(WakeLockInformation aWakeLockInfo);
     NotifyScreenConfigurationChange(ScreenConfiguration aScreenOrientation);
     NotifySwitchChange(SwitchEvent aEvent);
     NotifySystemTimeChange(SystemTimeChange aReason); 
-    NotifyFMRadioStatus(FMRadioOperationInformation aInfo);
 
 parent:
     Vibrate(uint32_t[] pattern, uint64_t[] id, PBrowser browser);
     CancelVibrate(uint64_t[] id, PBrowser browser);
 
     EnableBatteryNotifications();
     DisableBatteryNotifications();
     sync GetCurrentBatteryInformation()
@@ -160,34 +141,20 @@ parent:
  
     EnableSwitchNotifications(SwitchDevice aDevice);
     DisableSwitchNotifications(SwitchDevice aDevice);
     sync GetCurrentSwitchState(SwitchDevice aDevice)
       returns (SwitchState aState);
 
     SetProcessPriority(int aPid, ProcessPriority aPriority);
 
-    EnableFMRadio(FMRadioSettings aSettings);
-    DisableFMRadio();
-    FMRadioSeek(FMRadioSeekDirection aDirection);
-    sync GetFMRadioSettings()
-      returns (FMRadioSettings settings);
-    SetFMRadioFrequency(uint32_t frequency);
-    sync GetFMRadioFrequency()
-      returns (uint32_t frequency);
-    sync IsFMRadioOn()
-      returns (bool radioOn);
-    sync GetFMRadioSignalStrength()
-      returns (uint32_t strength);
-    CancelFMRadioSeek();
-
 child:
     NotifySensorChange(SensorData aSensorData);
 
-parent:
+parent:    
     EnableSensorNotifications(SensorType aSensor);
     DisableSensorNotifications(SensorType aSensor);
 
     __delete__();
 };
 
 } // namespace hal
 } // namespace mozilla
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -290,76 +290,16 @@ SetAlarm(int32_t aSeconds, int32_t aNano
 }
 
 void
 SetProcessPriority(int aPid, ProcessPriority aPriority)
 {
   Hal()->SendSetProcessPriority(aPid, aPriority);
 }
 
-void
-EnableFMRadio(const hal::FMRadioSettings& aSettings)
-{
-  Hal()->SendEnableFMRadio(aSettings);
-}
-
-void
-DisableFMRadio()
-{
-  Hal()->SendDisableFMRadio();
-}
-
-void
-FMRadioSeek(const hal::FMRadioSeekDirection& aDirection)
-{
-  Hal()->SendFMRadioSeek(aDirection);
-}
-
-void
-GetFMRadioSettings(FMRadioSettings* aSettings)
-{
-  Hal()->SendGetFMRadioSettings(aSettings);
-}
-
-void
-SetFMRadioFrequency(const uint32_t aFrequency)
-{
-  Hal()->SendSetFMRadioFrequency(aFrequency);
-}
-
-uint32_t
-GetFMRadioFrequency()
-{
-  uint32_t frequency;
-  Hal()->SendGetFMRadioFrequency(&frequency);
-  return frequency;
-}
-
-bool
-IsFMRadioOn()
-{
-  bool FMRadioOn;
-  Hal()->SendIsFMRadioOn(&FMRadioOn);
-  return FMRadioOn;
-}
-
-uint32_t
-GetFMRadioSignalStrength()
-{
-  uint32_t strength;
-  Hal()->SendGetFMRadioSignalStrength(&strength);
-  return strength;
-}
-
-void
-CancelFMRadioSeek()
-{
-  Hal()->SendCancelFMRadioSeek();
-}
-
 class HalParent : public PHalParent
                 , public BatteryObserver
                 , public NetworkObserver
                 , public ISensorObserver
                 , public WakeLockObserver
                 , public ScreenConfigurationObserver
                 , public SwitchObserver
 {
@@ -720,84 +660,16 @@ public:
     hal::SetProcessPriority(aPid, aPriority);
     return true;
   }
 
   void Notify(const SystemTimeChange& aReason)
   {
     unused << SendNotifySystemTimeChange(aReason);
   }
-
-  virtual bool
-  RecvEnableFMRadio(const hal::FMRadioSettings& aSettings)
-  {
-    hal::EnableFMRadio(aSettings);
-    return true;
-  }
-
-  virtual bool
-  RecvDisableFMRadio()
-  {
-    hal::DisableFMRadio();
-    return true;
-  }
-
-  virtual bool
-  RecvFMRadioSeek(const hal::FMRadioSeekDirection& aDirection)
-  {
-    hal::FMRadioSeek(aDirection);
-    return true;
-  }
-
-  virtual bool
-  RecvGetFMRadioSettings(hal::FMRadioSettings* aSettings)
-  {
-    hal::GetFMRadioSettings(aSettings);
-    return true;
-  }
-
-  virtual bool
-  RecvSetFMRadioFrequency(const uint32_t& aFrequency)
-  {
-    hal::SetFMRadioFrequency(aFrequency);
-    return true;
-  }
-
-  virtual bool
-  RecvGetFMRadioFrequency(uint32_t* aFrequency)
-  {
-    *aFrequency = hal::GetFMRadioFrequency();
-    return true;
-  }
-
-  void Notify(const hal::FMRadioOperationInformation& aRadioStatus)
-  {
-    unused << SendNotifyFMRadioStatus(aRadioStatus);
-  }
-
-  virtual bool
-  RecvIsFMRadioOn(bool* radioOn)
-  {
-    *radioOn = hal::IsFMRadioOn();
-    return true;
-  }
-
-  virtual bool
-  RecvGetFMRadioSignalStrength(uint32_t* strength)
-  {
-    *strength = hal::GetFMRadioSignalStrength();
-    return true;
-  }
-
-  virtual bool
-  RecvCancelFMRadioSeek()
-  {
-    hal::CancelFMRadioSeek();
-    return true;
-  }
 };
 
 class HalChild : public PHalChild {
 public:
   virtual bool
   RecvNotifyBatteryChange(const BatteryInformation& aBatteryInfo) MOZ_OVERRIDE {
     hal::NotifyBatteryChange(aBatteryInfo);
     return true;
@@ -830,22 +702,16 @@ public:
     return true;
   }
 
   virtual bool
   RecvNotifySystemTimeChange(const SystemTimeChange& aReason) {
     hal::NotifySystemTimeChange(aReason);
     return true;
   }
-
-  virtual bool
-  RecvNotifyFMRadioStatus(const FMRadioOperationInformation& aRadioStatus) {
-    hal::NotifyFMRadioStatus(aRadioStatus);
-    return true;
-  }
 };
 
 bool
 HalChild::RecvNotifySensorChange(const hal::SensorData &aSensorData) {
   hal::NotifySensorChange(aSensorData);
   
   return true;
 }
--- a/layout/build/Makefile.in
+++ b/layout/build/Makefile.in
@@ -113,22 +113,16 @@ SHARED_LIBRARY_LIBS += \
 	$(DEPTH)/dom/plugins/base/android/$(LIB_PREFIX)gkpluginandroid_s.$(LIB_SUFFIX) \
 	$(NULL)
 LOCAL_INCLUDES	+= \
 	-I$(topsrcdir)/dom/system/android \
 	-I$(topsrcdir)/dom/system \
 	$(NULL)
 endif
 
-ifdef MOZ_B2G_FM #{
-SHARED_LIBRARY_LIBS	+= \
-  $(DEPTH)/dom/fm/$(LIB_PREFIX)domfm_s.$(LIB_SUFFIX) \
-  $(NULL)
-endif #}
-
 ifdef MOZ_B2G_BT #{
 SHARED_LIBRARY_LIBS += $(DEPTH)/dom/bluetooth/$(LIB_PREFIX)dombluetooth_s.$(LIB_SUFFIX)
 endif #}
 
 SHARED_LIBRARY_LIBS	+= $(DEPTH)/dom/camera/$(LIB_PREFIX)domcamera_s.$(LIB_SUFFIX)
 
 ifdef MOZ_B2G_RIL #{
 SHARED_LIBRARY_LIBS	+= \
@@ -276,19 +270,15 @@ LOCAL_INCLUDES	+= -I$(srcdir)/../base \
 		   -I$(topsrcdir)/content/svg/content/src \
 		   -I$(topsrcdir)/extensions/cookie \
 		   $(NULL)
 
 ifdef MOZ_B2G_RIL #{
 LOCAL_INCLUDES	+= -I$(topsrcdir)/dom/system/gonk
 endif #}
 
-ifdef MOZ_B2G_FM #{
-LOCAL_INCLUDES	+= -I$(topsrcdir)/dom/fm
-endif #}
-
 ifdef MOZ_B2G_BT #{
 LOCAL_INCLUDES	+= -I$(topsrcdir)/dom/bluetooth
 endif #}
 
 LOCAL_INCLUDES	+= -I$(topsrcdir)/dom/camera
 
 DEFINES += -D_IMPL_NS_LAYOUT
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -119,22 +119,16 @@ using mozilla::dom::bluetooth::Bluetooth
 #endif
 
 #ifdef MOZ_WIDGET_GONK
 #include "AudioManager.h"
 using mozilla::dom::gonk::AudioManager;
 #include "nsVolumeService.h"
 using mozilla::system::nsVolumeService;
 #endif
-
-#ifdef MOZ_B2G_FM
-#include "FMRadio.h"
-using mozilla::dom::fm::FMRadio;
-#endif
-
 #include "nsDOMMutationObserver.h"
 
 // Editor stuff
 #include "nsEditorCID.h"
 #include "nsEditor.h"
 #include "nsPlaintextEditor.h"
 #include "nsEditorController.h" //CID
 
@@ -292,21 +286,16 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR
                                          BluetoothService::FactoryCreate)
 #endif
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMMutationObserver)
 
 #ifdef MOZ_WIDGET_GONK
 NS_GENERIC_FACTORY_CONSTRUCTOR(AudioManager)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsVolumeService)
 #endif
-
-#ifdef MOZ_B2G_FM
-NS_GENERIC_FACTORY_CONSTRUCTOR(FMRadio)
-#endif
-
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceSensors)
 
 #ifndef MOZ_WIDGET_GONK
 #if defined(ANDROID) || defined(MOZ_PLATFORM_MAEMO)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHapticFeedback)
 #endif
 #endif
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ThirdPartyUtil, Init)
@@ -777,21 +766,16 @@ NS_DEFINE_NAMED_CID(SYSTEMWORKERMANAGER_
 #endif
 #ifdef MOZ_B2G_BT
 NS_DEFINE_NAMED_CID(BLUETOOTHSERVICE_CID);
 #endif
 #ifdef MOZ_WIDGET_GONK
 NS_DEFINE_NAMED_CID(NS_AUDIOMANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_VOLUMESERVICE_CID);
 #endif
-
-#ifdef MOZ_B2G_FM
-NS_DEFINE_NAMED_CID(NS_FMRADIO_CID);
-#endif
-
 #ifdef ENABLE_EDITOR_API_LOG
 NS_DEFINE_NAMED_CID(NS_HTMLEDITOR_CID);
 #else
 NS_DEFINE_NAMED_CID(NS_HTMLEDITOR_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_EDITORCONTROLLER_CID);
 NS_DEFINE_NAMED_CID(NS_EDITINGCONTROLLER_CID);
 NS_DEFINE_NAMED_CID(NS_EDITORCOMMANDTABLE_CID);
@@ -1058,19 +1042,16 @@ static const mozilla::Module::CIDEntry k
 #endif
 #ifdef MOZ_B2G_BT
   { &kBLUETOOTHSERVICE_CID, true, NULL, BluetoothServiceConstructor },
 #endif
 #ifdef MOZ_WIDGET_GONK
   { &kNS_AUDIOMANAGER_CID, true, NULL, AudioManagerConstructor },
   { &kNS_VOLUMESERVICE_CID, true, NULL, nsVolumeServiceConstructor },
 #endif
-#ifdef MOZ_B2G_FM
-  { &kNS_FMRADIO_CID, true, NULL, FMRadioConstructor },
-#endif
 #ifdef ENABLE_EDITOR_API_LOG
   { &kNS_HTMLEDITOR_CID, false, NULL, nsHTMLEditorLogConstructor },
 #else
   { &kNS_HTMLEDITOR_CID, false, NULL, nsHTMLEditorConstructor },
 #endif
   { &kNS_EDITORCONTROLLER_CID, false, NULL, nsEditorControllerConstructor },
   { &kNS_EDITINGCONTROLLER_CID, false, NULL, nsEditingControllerConstructor },
   { &kNS_EDITORCOMMANDTABLE_CID, false, NULL, nsEditorCommandTableConstructor },
@@ -1202,19 +1183,16 @@ static const mozilla::Module::ContractID
 #endif
 #ifdef MOZ_B2G_BT
   { BLUETOOTHSERVICE_CONTRACTID, &kBLUETOOTHSERVICE_CID },
 #endif
 #ifdef MOZ_WIDGET_GONK
   { NS_AUDIOMANAGER_CONTRACTID, &kNS_AUDIOMANAGER_CID },
   { NS_VOLUMESERVICE_CONTRACTID, &kNS_VOLUMESERVICE_CID },
 #endif
-#ifdef MOZ_B2G_FM
-  { NS_FMRADIO_CONTRACTID, &kNS_FMRADIO_CID },
-#endif
 #ifdef ENABLE_EDITOR_API_LOG
   { "@mozilla.org/editor/htmleditor;1", &kNS_HTMLEDITOR_CID },
 #else
   { "@mozilla.org/editor/htmleditor;1", &kNS_HTMLEDITOR_CID },
 #endif
   { "@mozilla.org/editor/editorcontroller;1", &kNS_EDITORCONTROLLER_CID },
   { "@mozilla.org/editor/editingcontroller;1", &kNS_EDITINGCONTROLLER_CID },
   { "@mozilla.org/textservices/textservicesdocument;1", &kNS_TEXTSERVICESDOCUMENT_CID },
--- a/media/libcubeb/src/cubeb_opensl.c
+++ b/media/libcubeb/src/cubeb_opensl.c
@@ -8,30 +8,31 @@
 #include "cubeb/cubeb.h"
 #include <assert.h>
 #include <dlfcn.h>
 #include <stdlib.h>
 #include <SLES/OpenSLES.h>
 
 struct cubeb {
   void * lib;
+  SLInterfaceID SL_IID_OUTPUTMIX;
   SLInterfaceID SL_IID_BUFFERQUEUE;
   SLInterfaceID SL_IID_PLAY;
   SLObjectItf engObj;
   SLEngineItf eng;
-  SLObjectItf outmixObj;
 };
 
 #define NBUFS 4
 
 struct cubeb_stream {
   struct cubeb * context;
   SLObjectItf playerObj;
   SLPlayItf play;
   SLBufferQueueItf bufq;
+  SLObjectItf outmixObj;
   void *queuebuf[NBUFS];
   int queuebuf_idx;
   long queuebuf_len;
   long bytespersec;
   long framesize;
   int draining;
 
   cubeb_data_callback data_callback;
@@ -96,22 +97,22 @@ cubeb_init(cubeb ** context, char const 
                                        SLuint32,
                                        const SLEngineOption *,
                                        SLuint32,
                                        const SLInterfaceID *,
                                        const SLboolean *);
   slCreateEngine_t f_slCreateEngine =
     (slCreateEngine_t)dlsym(ctx->lib, "slCreateEngine");
   SLInterfaceID SL_IID_ENGINE = *(SLInterfaceID *)dlsym(ctx->lib, "SL_IID_ENGINE");
-  SLInterfaceID SL_IID_OUTPUTMIX = *(SLInterfaceID *)dlsym(ctx->lib, "SL_IID_OUTPUTMIX");
+  ctx->SL_IID_OUTPUTMIX = *(SLInterfaceID *)dlsym(ctx->lib, "SL_IID_OUTPUTMIX");
   ctx->SL_IID_BUFFERQUEUE = *(SLInterfaceID *)dlsym(ctx->lib, "SL_IID_BUFFERQUEUE");
   ctx->SL_IID_PLAY = *(SLInterfaceID *)dlsym(ctx->lib, "SL_IID_PLAY");
   if (!f_slCreateEngine ||
       !SL_IID_ENGINE ||
-      !SL_IID_OUTPUTMIX ||
+      !ctx->SL_IID_OUTPUTMIX ||
       !ctx->SL_IID_BUFFERQUEUE ||
       !ctx->SL_IID_PLAY) {
     cubeb_destroy(ctx);
     return CUBEB_ERROR;
   }
 
 
   const SLEngineOption opt[] = {{SL_ENGINEOPTION_THREADSAFE, SL_BOOLEAN_TRUE}};
@@ -130,47 +131,31 @@ cubeb_init(cubeb ** context, char const 
   }
 
   res = (*ctx->engObj)->GetInterface(ctx->engObj, SL_IID_ENGINE, &ctx->eng);
   if (res != SL_RESULT_SUCCESS) {
     cubeb_destroy(ctx);
     return CUBEB_ERROR;
   }
 
-  const SLInterfaceID idsom[] = {SL_IID_OUTPUTMIX};
-  const SLboolean reqom[] = {SL_BOOLEAN_TRUE};
-  res = (*ctx->eng)->CreateOutputMix(ctx->eng, &ctx->outmixObj, 1, idsom, reqom);
-  if (res != SL_RESULT_SUCCESS) {
-    cubeb_destroy(ctx);
-    return CUBEB_ERROR;
-  }
-
-  res = (*ctx->outmixObj)->Realize(ctx->outmixObj, SL_BOOLEAN_FALSE);
-  if (res != SL_RESULT_SUCCESS) {
-    cubeb_destroy(ctx);
-    return CUBEB_ERROR;
-  }
-
   *context = ctx;
 
   return CUBEB_OK;
 }
 
 char const *
 cubeb_get_backend_id(cubeb * ctx)
 {
   return "opensl";
 }
 
 void
 cubeb_destroy(cubeb * ctx)
 {
   dlclose(ctx->lib);
-  if (ctx->outmixObj)
-    (*ctx->outmixObj)->Destroy(ctx->outmixObj);
   if (ctx->engObj)
     (*ctx->engObj)->Destroy(ctx->engObj);
   free(ctx);
 }
 
 int
 cubeb_stream_init(cubeb * ctx, cubeb_stream ** stream, char const * stream_name,
                   cubeb_stream_params stream_params, unsigned int latency,
@@ -232,27 +217,42 @@ cubeb_stream_init(cubeb * ctx, cubeb_str
 
   SLDataLocator_BufferQueue loc_bufq;
   loc_bufq.locatorType = SL_DATALOCATOR_BUFFERQUEUE;
   loc_bufq.numBuffers = NBUFS;
   SLDataSource source;
   source.pLocator = &loc_bufq;
   source.pFormat = &format;
 
+  SLresult res;
+  const SLInterfaceID idsom[] = {ctx->SL_IID_OUTPUTMIX};
+  const SLboolean reqom[] = {SL_BOOLEAN_TRUE};
+  res = (*ctx->eng)->CreateOutputMix(ctx->eng, &stm->outmixObj, 1, idsom, reqom);
+  if (res != SL_RESULT_SUCCESS) {
+    cubeb_stream_destroy(stm);
+    return CUBEB_ERROR;
+  }
+
+  res = (*stm->outmixObj)->Realize(stm->outmixObj, SL_BOOLEAN_FALSE);
+  if (res != SL_RESULT_SUCCESS) {
+    cubeb_stream_destroy(stm);
+    return CUBEB_ERROR;
+  }
+
   SLDataLocator_OutputMix loc_outmix;
   loc_outmix.locatorType = SL_DATALOCATOR_OUTPUTMIX;
-  loc_outmix.outputMix = ctx->outmixObj;
+  loc_outmix.outputMix = stm->outmixObj;
   SLDataSink sink;
   sink.pLocator = &loc_outmix;
   sink.pFormat = NULL;
 
   const SLInterfaceID ids[] = {ctx->SL_IID_BUFFERQUEUE};
   const SLboolean req[] = {SL_BOOLEAN_TRUE};
-  SLresult res = (*ctx->eng)->CreateAudioPlayer(ctx->eng, &stm->playerObj,
-                                                &source, &sink, 1, ids, req);
+  res = (*ctx->eng)->CreateAudioPlayer(ctx->eng, &stm->playerObj,
+                                       &source, &sink, 1, ids, req);
   if (res != SL_RESULT_SUCCESS) {
     cubeb_stream_destroy(stm);
     return CUBEB_ERROR;
   }
 
   res = (*stm->playerObj)->Realize(stm->playerObj, SL_BOOLEAN_FALSE);
   if (res != SL_RESULT_SUCCESS) {
     cubeb_stream_destroy(stm);
@@ -283,16 +283,18 @@ cubeb_stream_init(cubeb * ctx, cubeb_str
   return CUBEB_OK;
 }
 
 void
 cubeb_stream_destroy(cubeb_stream * stm)
 {
   if (stm->playerObj)
     (*stm->playerObj)->Destroy(stm->playerObj);
+  if (stm->outmixObj)
+    (*stm->outmixObj)->Destroy(stm->outmixObj);
   free(stm);
 }
 
 int
 cubeb_stream_start(cubeb_stream * stm)
 {
   SLresult res = (*stm->play)->SetPlayState(stm->play, SL_PLAYSTATE_PLAYING);
   if (res != SL_RESULT_SUCCESS)
--- a/media/libsydneyaudio/src/gonk/AudioSystem.h
+++ b/media/libsydneyaudio/src/gonk/AudioSystem.h
@@ -653,18 +653,16 @@ public:
     static status_t setForceUse(force_use usage, forced_config config);
     static forced_config getForceUse(force_use usage);
     static audio_io_handle_t getOutput(stream_type stream,
                                         uint32_t samplingRate = 0,
                                         uint32_t format = FORMAT_DEFAULT,
                                         uint32_t channels = CHANNEL_OUT_STEREO,
                                         output_flags flags = OUTPUT_FLAG_INDIRECT);
     static status_t setDeviceConnectionState(audio_devices_t device, audio_policy_dev_state_t state, const char *device_address);
-    static status_t setFmVolume(float volume);
-    static audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device, const char *device_address);
 #else
     static status_t setForceUse(force_use usage, forced_config config) __attribute__((weak));
     static forced_config getForceUse(force_use usage) __attribute__((weak));
     static audio_io_handle_t getOutput(stream_type stream,
                                         uint32_t samplingRate = 0,
                                         uint32_t format = FORMAT_DEFAULT,
                                         uint32_t channels = CHANNEL_OUT_STEREO,
                                         output_flags flags = OUTPUT_FLAG_INDIRECT) __attribute__((weak));
@@ -672,18 +670,16 @@ public:
     static status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config) __attribute__((weak));
     static audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage) __attribute__((weak));
     static audio_io_handle_t getOutput(audio_stream_type_t stream,
                                         uint32_t samplingRate = 0,
                                         uint32_t format = AUDIO_FORMAT_DEFAULT,
                                         uint32_t channels = AUDIO_CHANNEL_OUT_STEREO,
                                         audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_INDIRECT) __attribute__((weak));
     static status_t setDeviceConnectionState(audio_devices_t device, audio_policy_dev_state_t state, const char *device_address) __attribute__((weak));
-    static status_t setFmVolume(float volume) __attribute__((weak));
-    static audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device, const char *device_address) __attribute__((weak));
 
 #endif
     static status_t startOutput(audio_io_handle_t output,
                                 AudioSystem::stream_type stream,
                                 int session = 0);
     static status_t stopOutput(audio_io_handle_t output,
                                AudioSystem::stream_type stream,
                                int session = 0);
--- a/mobile/android/base/gfx/GeckoLayerClient.java
+++ b/mobile/android/base/gfx/GeckoLayerClient.java
@@ -120,29 +120,35 @@ public class GeckoLayerClient
 
     /** Attaches to root layer so that Gecko appears. */
     public void notifyGeckoReady() {
         mGeckoIsReady = true;
 
         mRootLayer = new VirtualLayer(new IntSize(mView.getWidth(), mView.getHeight()));
         mLayerRenderer = new LayerRenderer(mView);
 
+        registerEventListener("Viewport:Update");
+        registerEventListener("Viewport:PageSize");
+        registerEventListener("Viewport:CalculateDisplayPort");
         registerEventListener("Checkerboard:Toggle");
 
         mView.setListener(this);
         mView.setLayerRenderer(mLayerRenderer);
 
         sendResizeEventIfNecessary(true);
 
         DisplayPortCalculator.initPrefs();
         PluginLayer.initPrefs();
     }
 
     public void destroy() {
         mPanZoomController.destroy();
+        unregisterEventListener("Viewport:Update");
+        unregisterEventListener("Viewport:PageSize");
+        unregisterEventListener("Viewport:CalculateDisplayPort");
         unregisterEventListener("Checkerboard:Toggle");
     }
 
     private void registerEventListener(String event) {
         mEventDispatcher.registerEventListener(event, this);
     }
 
     private void unregisterEventListener(String event) {
@@ -299,17 +305,18 @@ public class GeckoLayerClient
      * returned.
      */
     private enum ViewportMessageType {
         UPDATE,       // The viewport has changed and should be entirely updated
         PAGE_SIZE     // The viewport's page-size has changed
     }
 
     /** Viewport message handler. */
-    private DisplayPortMetrics handleViewportMessage(ViewportMetrics messageMetrics, ViewportMessageType type) {
+    private void handleViewportMessage(JSONObject message, ViewportMessageType type) throws JSONException {
+        ViewportMetrics messageMetrics = new ViewportMetrics(message);
         synchronized (this) {
             final ViewportMetrics newMetrics;
             ImmutableViewportMetrics oldMetrics = getViewportMetrics();
 
             switch (type) {
             default:
             case UPDATE:
                 newMetrics = messageMetrics;
@@ -330,40 +337,30 @@ public class GeckoLayerClient
             post(new Runnable() {
                 public void run() {
                     mGeckoViewport = newMetrics;
                 }
             });
             setViewportMetrics(newMetrics, type == ViewportMessageType.UPDATE);
             mDisplayPort = DisplayPortCalculator.calculate(getViewportMetrics(), null);
         }
-        return mDisplayPort;
-    }
-
-    public DisplayPortMetrics getDisplayPort(boolean pageSizeUpdate, boolean isBrowserContentDisplayed, int tabId, ViewportMetrics metrics) {
-        Tabs tabs = Tabs.getInstance();
-        if (tabs.isSelectedTab(tabs.getTab(tabId)) && isBrowserContentDisplayed) {
-            // for foreground tabs, send the viewport update unless the document
-            // displayed is different from the content document. In that case, just
-            // calculate the display port.
-            return handleViewportMessage(metrics, pageSizeUpdate ? ViewportMessageType.UPDATE : ViewportMessageType.PAGE_SIZE);
-        } else {
-            // for background tabs, request a new display port calculation, so that
-            // when we do switch to that tab, we have the correct display port and
-            // don't need to draw twice (once to allow the first-paint viewport to
-            // get to java, and again once java figures out the display port).
-            ImmutableViewportMetrics newMetrics = new ImmutableViewportMetrics(metrics);
-            return DisplayPortCalculator.calculate(newMetrics, null);
-        }
+        mReturnDisplayPort = mDisplayPort;
     }
 
     /** Implementation of GeckoEventResponder/GeckoEventListener. */
     public void handleMessage(String event, JSONObject message) {
         try {
-            if ("Checkerboard:Toggle".equals(event)) {
+            if ("Viewport:Update".equals(event)) {
+                handleViewportMessage(message, ViewportMessageType.UPDATE);
+            } else if ("Viewport:PageSize".equals(event)) {
+                handleViewportMessage(message, ViewportMessageType.PAGE_SIZE);
+            } else if ("Viewport:CalculateDisplayPort".equals(event)) {
+                ImmutableViewportMetrics newMetrics = new ImmutableViewportMetrics(new ViewportMetrics(message));
+                mReturnDisplayPort = DisplayPortCalculator.calculate(newMetrics, null);
+            } else if ("Checkerboard:Toggle".equals(event)) {
                 mView.setCheckerboardShouldShowChecks(message.getBoolean("value"));
             }
         } catch (JSONException e) {
             Log.e(LOGTAG, "Error decoding JSON in " + event + " handler", e);
         }
     }
 
     /** Implementation of GeckoEventResponder. */
--- a/mobile/android/base/gfx/ViewportMetrics.java
+++ b/mobile/android/base/gfx/ViewportMetrics.java
@@ -72,26 +72,16 @@ public class ViewportMetrics {
         float zoom = (float)json.getDouble("zoom");
 
         mPageRect = new RectF(pageLeft, pageTop, pageRight, pageBottom);
         mCssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom);
         mViewportRect = new RectF(x, y, x + width, y + height);
         mZoomFactor = zoom;
     }
 
-    public ViewportMetrics(float x, float y, float width, float height,
-                           float pageLeft, float pageTop, float pageRight, float pageBottom,
-                           float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom,
-                           float zoom) {
-        mPageRect = new RectF(pageLeft, pageTop, pageRight, pageBottom);
-        mCssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom);
-        mViewportRect = new RectF(x, y, x + width, y + height);
-        mZoomFactor = zoom;
-    }
-
     public PointF getOrigin() {
         return new PointF(mViewportRect.left, mViewportRect.top);
     }
 
     public FloatSize getSize() {
         return new FloatSize(mViewportRect.width(), mViewportRect.height());
     }
 
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2638,20 +2638,34 @@ Tab.prototype = {
         viewport.pageBottom = (viewport.cssPageBottom * viewport.zoom);
       }
     }
 
     return viewport;
   },
 
   sendViewportUpdate: function(aPageSizeUpdate) {
-    let viewport = this.getViewport();
-    let displayPort = getBridge().getDisplayPort(aPageSizeUpdate, BrowserApp.isBrowserContentDocumentDisplayed(), this.id, viewport);
+    let message;
+    // for foreground tabs, send the viewport update unless the document
+    // displayed is different from the content document. In that case, just
+    // calculate the display port.
+    if (BrowserApp.selectedTab == this && BrowserApp.isBrowserContentDocumentDisplayed()) {
+      message = this.getViewport();
+      message.type = aPageSizeUpdate ? "Viewport:PageSize" : "Viewport:Update";
+    } else {
+      // for background tabs, request a new display port calculation, so that
+      // when we do switch to that tab, we have the correct display port and
+      // don't need to draw twice (once to allow the first-paint viewport to
+      // get to java, and again once java figures out the display port).
+      message = this.getViewport();
+      message.type = "Viewport:CalculateDisplayPort";
+    }
+    let displayPort = sendMessageToJava({ gecko: message });
     if (displayPort != null)
-      this.setDisplayPort(displayPort);
+      this.setDisplayPort(JSON.parse(displayPort));
   },
 
   handleEvent: function(aEvent) {
     switch (aEvent.type) {
       case "DOMContentLoaded": {
         let target = aEvent.originalTarget;
 
         // ignore on frames and other documents
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -1214,22 +1214,16 @@ if [ "$MOZ_B2G_RIL" ]; then
 fi
 
 if [ "$MOZ_PAY" ]; then
   add_makefiles "
     dom/payment/Makefile
   "
 fi
 
-if [ "$MOZ_B2G_FM" ]; then
-  add_makefiles "
-    dom/fm/Makefile
-  "
-fi
-
 if [ "$MOZ_CRASHREPORTER" ]; then
   add_makefiles "
     toolkit/crashreporter/Makefile
   "
   MAKEFILES_crashreporter_shared="
     toolkit/crashreporter/google-breakpad/src/client/Makefile
     toolkit/crashreporter/google-breakpad/src/common/Makefile
     toolkit/crashreporter/google-breakpad/src/common/dwarf/Makefile
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -2523,34 +2523,16 @@ nsresult AndroidBridge::TakeScreenshot(n
     context->Scale(scale * dstW / srcW, scale * dstH / srcH);
     rv = presShell->RenderDocument(r, renderDocFlags, bgColor, context);
     NS_ENSURE_SUCCESS(rv, rv);
     env->CallStaticVoidMethod(AndroidBridge::Bridge()->mGeckoAppShellClass, AndroidBridge::Bridge()->jNotifyScreenShot,
                               buffer, tabId, dstX, dstY, dstX + dstW, dstY + dstH, bufW, bufH, token);
     return NS_OK;
 }
 
-nsresult
-nsAndroidBridge::GetDisplayPort(bool aPageSizeUpdate, bool aIsBrowserContentDisplayed, int32_t tabId, nsIAndroidViewport* metrics, nsIAndroidDisplayport** displayPort)
-{
-    return AndroidBridge::Bridge()->GetDisplayPort(aPageSizeUpdate, aIsBrowserContentDisplayed, tabId, metrics, displayPort);
-}
-
-nsresult
-AndroidBridge::GetDisplayPort(bool aPageSizeUpdate, bool aIsBrowserContentDisplayed, int32_t tabId, nsIAndroidViewport* metrics, nsIAndroidDisplayport** displayPort)
-{
-    JNIEnv* env = GetJNIEnv();
-    if (!env || !mLayerClient)
-        return NS_OK;
-    AutoLocalJNIFrame jniFrame(env, 0);
-    mLayerClient->GetDisplayPort(&jniFrame, aPageSizeUpdate, aIsBrowserContentDisplayed, tabId, metrics, displayPort);
-
-    return NS_OK;
-}
-
 void
 AndroidBridge::NotifyPaintedRect(float top, float left, float bottom, float right)
 {
     JNIEnv* env = GetJNIEnv();
     if (!env)
         return;
 
     AutoLocalJNIFrame jniFrame(env, 0);
--- a/widget/android/AndroidBridge.h
+++ b/widget/android/AndroidBridge.h
@@ -149,17 +149,16 @@ public:
     static void NotifyIME(int aType, int aState);
 
     static void NotifyIMEEnabled(int aState, const nsAString& aTypeHint,
                                  const nsAString& aModeHint, const nsAString& aActionHint);
 
     static void NotifyIMEChange(const PRUnichar *aText, uint32_t aTextLen, int aStart, int aEnd, int aNewEnd);
 
     nsresult TakeScreenshot(nsIDOMWindow *window, int32_t srcX, int32_t srcY, int32_t srcW, int32_t srcH, int32_t dstY, int32_t dstX, int32_t dstW, int32_t dstH, int32_t bufW, int32_t bufH, int32_t tabId, int32_t token, jobject buffer);
-    nsresult GetDisplayPort(bool aPageSizeUpdate, bool aIsBrowserContentDisplayed, int32_t tabId, nsIAndroidViewport* metrics, nsIAndroidDisplayport** displayPort);
 
     static void NotifyPaintedRect(float top, float left, float bottom, float right);
 
     void AcknowledgeEventSync();
 
     void EnableLocation(bool aEnable);
     void EnableLocationHighAccuracy(bool aEnable);
 
--- a/widget/android/AndroidJavaWrappers.cpp
+++ b/widget/android/AndroidJavaWrappers.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: c++; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * 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 "AndroidJavaWrappers.h"
 #include "AndroidBridge.h"
-#include "nsIAndroidBridge.h"
 
 using namespace mozilla;
 
 jclass AndroidGeckoEvent::jGeckoEventClass = 0;
 jfieldID AndroidGeckoEvent::jActionField = 0;
 jfieldID AndroidGeckoEvent::jTypeField = 0;
 jfieldID AndroidGeckoEvent::jTimeField = 0;
 jfieldID AndroidGeckoEvent::jPoints = 0;
@@ -51,44 +50,32 @@ jfieldID AndroidPoint::jXField = 0;
 jfieldID AndroidPoint::jYField = 0;
 
 jclass AndroidRect::jRectClass = 0;
 jfieldID AndroidRect::jBottomField = 0;
 jfieldID AndroidRect::jLeftField = 0;
 jfieldID AndroidRect::jRightField = 0;
 jfieldID AndroidRect::jTopField = 0;
 
-jclass AndroidRectF::jRectClass = 0;
-jfieldID AndroidRectF::jBottomField = 0;
-jfieldID AndroidRectF::jLeftField = 0;
-jfieldID AndroidRectF::jRightField = 0;
-jfieldID AndroidRectF::jTopField = 0;
-
 jclass AndroidLocation::jLocationClass = 0;
 jmethodID AndroidLocation::jGetLatitudeMethod = 0;
 jmethodID AndroidLocation::jGetLongitudeMethod = 0;
 jmethodID AndroidLocation::jGetAltitudeMethod = 0;
 jmethodID AndroidLocation::jGetAccuracyMethod = 0;
 jmethodID AndroidLocation::jGetBearingMethod = 0;
 jmethodID AndroidLocation::jGetSpeedMethod = 0;
 jmethodID AndroidLocation::jGetTimeMethod = 0;
 
 jclass AndroidGeckoLayerClient::jGeckoLayerClientClass = 0;
-jclass AndroidGeckoLayerClient::jViewportClass = 0;
-jclass AndroidGeckoLayerClient::jDisplayportClass = 0;
 jmethodID AndroidGeckoLayerClient::jSetFirstPaintViewport = 0;
 jmethodID AndroidGeckoLayerClient::jSetPageRect = 0;
 jmethodID AndroidGeckoLayerClient::jSyncViewportInfoMethod = 0;
 jmethodID AndroidGeckoLayerClient::jCreateFrameMethod = 0;
 jmethodID AndroidGeckoLayerClient::jActivateProgramMethod = 0;
 jmethodID AndroidGeckoLayerClient::jDeactivateProgramMethod = 0;
-jmethodID AndroidGeckoLayerClient::jGetDisplayPort = 0;
-jmethodID AndroidGeckoLayerClient::jViewportCtor = 0;
-jfieldID AndroidGeckoLayerClient::jDisplayportPosition = 0;
-jfieldID AndroidGeckoLayerClient::jDisplayportResolution = 0;
 
 jclass AndroidLayerRendererFrame::jLayerRendererFrameClass = 0;
 jmethodID AndroidLayerRendererFrame::jBeginDrawingMethod = 0;
 jmethodID AndroidLayerRendererFrame::jDrawBackgroundMethod = 0;
 jmethodID AndroidLayerRendererFrame::jDrawForegroundMethod = 0;
 jmethodID AndroidLayerRendererFrame::jEndDrawingMethod = 0;
 
 jclass AndroidViewTransform::jViewTransformClass = 0;
@@ -177,17 +164,16 @@ RefCountedJavaObject::~RefCountedJavaObj
 
 void
 mozilla::InitAndroidJavaWrappers(JNIEnv *jEnv)
 {
     AndroidGeckoEvent::InitGeckoEventClass(jEnv);
     AndroidPoint::InitPointClass(jEnv);
     AndroidLocation::InitLocationClass(jEnv);
     AndroidRect::InitRectClass(jEnv);
-    AndroidRectF::InitRectFClass(jEnv);
     AndroidGeckoLayerClient::InitGeckoLayerClientClass(jEnv);
     AndroidLayerRendererFrame::InitLayerRendererFrameClass(jEnv);
     AndroidViewTransform::InitViewTransformClass(jEnv);
     AndroidGeckoSurfaceView::InitGeckoSurfaceViewClass(jEnv);
 }
 
 void
 AndroidGeckoEvent::InitGeckoEventClass(JNIEnv *jEnv)
@@ -311,52 +297,30 @@ AndroidRect::InitRectClass(JNIEnv *jEnv)
 
     jBottomField = getField("bottom", "I");
     jLeftField = getField("left", "I");
     jTopField = getField("top", "I");
     jRightField = getField("right", "I");
 }
 
 void
-AndroidRectF::InitRectFClass(JNIEnv *jEnv)
-{
-    initInit();
-
-    jRectClass = getClassGlobalRef("android/graphics/RectF");
-
-    jBottomField = getField("bottom", "F");
-    jLeftField = getField("left", "F");
-    jTopField = getField("top", "F");
-    jRightField = getField("right", "F");
-}
-
-void
 AndroidGeckoLayerClient::InitGeckoLayerClientClass(JNIEnv *jEnv)
 {
 #ifdef MOZ_JAVA_COMPOSITOR
     initInit();
 
     jGeckoLayerClientClass = getClassGlobalRef("org/mozilla/gecko/gfx/GeckoLayerClient");
 
     jSetFirstPaintViewport = getMethod("setFirstPaintViewport", "(FFFFFFFFFFF)V");
     jSetPageRect = getMethod("setPageRect", "(FFFF)V");
     jSyncViewportInfoMethod = getMethod("syncViewportInfo",
                                         "(IIIIFZ)Lorg/mozilla/gecko/gfx/ViewTransform;");
     jCreateFrameMethod = getMethod("createFrame", "()Lorg/mozilla/gecko/gfx/LayerRenderer$Frame;");
     jActivateProgramMethod = getMethod("activateProgram", "()V");
     jDeactivateProgramMethod = getMethod("deactivateProgram", "()V");
-    jGetDisplayPort = getMethod("getDisplayPort", "(ZZILorg/mozilla/gecko/gfx/ViewportMetrics;)Lorg/mozilla/gecko/gfx/DisplayPortMetrics;");
-
-    jViewportClass = GetClassGlobalRef(jEnv, "org/mozilla/gecko/gfx/ViewportMetrics");
-    jViewportCtor = GetMethodID(jEnv, jViewportClass, "<init>", "(FFFFFFFFFFFFF)V");
-
-    jDisplayportClass = GetClassGlobalRef(jEnv, "org/mozilla/gecko/gfx/DisplayPortMetrics");
-    jDisplayportPosition = GetFieldID(jEnv, jDisplayportClass, "mPosition", "Landroid/graphics/RectF;");
-    jDisplayportResolution = GetFieldID(jEnv, jDisplayportClass, "mResolution", "F");
-
 #endif
 }
 
 void
 AndroidLayerRendererFrame::InitLayerRendererFrameClass(JNIEnv *jEnv)
 {
 #ifdef MOZ_JAVA_COMPOSITOR
     initInit();
@@ -798,89 +762,16 @@ AndroidGeckoLayerClient::SyncViewportInf
 
     AndroidViewTransform viewTransform;
     viewTransform.Init(viewTransformJObj);
 
     aScrollOffset = nsIntPoint(viewTransform.GetX(env), viewTransform.GetY(env));
     aScaleX = aScaleY = viewTransform.GetScale(env);
 }
 
-jobject ConvertToJavaViewportMetrics(JNIEnv* env, nsIAndroidViewport* metrics) {
-    float x, y, width, height,
-        pageLeft, pageTop, pageRight, pageBottom,
-        cssPageLeft, cssPageTop, cssPageRight, cssPageBottom,
-        zoom;
-    metrics->GetX(&x);
-    metrics->GetY(&y);
-    metrics->GetWidth(&width);
-    metrics->GetHeight(&height);
-    metrics->GetPageLeft(&pageLeft);
-    metrics->GetPageTop(&pageTop);
-    metrics->GetPageRight(&pageRight);
-    metrics->GetPageBottom(&pageBottom);
-    metrics->GetCssPageLeft(&cssPageLeft);
-    metrics->GetCssPageTop(&cssPageTop);
-    metrics->GetCssPageRight(&cssPageRight);
-    metrics->GetCssPageBottom(&cssPageBottom);
-    metrics->GetZoom(&zoom);
-
-    jobject jobj = env->NewObject(AndroidGeckoLayerClient::jViewportClass, AndroidGeckoLayerClient::jViewportCtor,
-                                  x, y, width, height,
-                                  pageLeft, pageTop, pageRight, pageBottom,
-                                  cssPageLeft, cssPageTop, cssPageRight, cssPageBottom, zoom);
-    return jobj;
-}
-
-class nsAndroidDisplayport : public nsIAndroidDisplayport
-{
-public:
-    NS_DECL_ISUPPORTS
-    virtual nsresult GetLeft(float *aLeft) { *aLeft = mLeft; return NS_OK; }
-    virtual nsresult GetTop(float *aTop) { *aTop = mTop; return NS_OK; }
-    virtual nsresult GetRight(float *aRight) { *aRight = mRight; return NS_OK; }
-    virtual nsresult GetBottom(float *aBottom) { *aBottom = mBottom; return NS_OK; }
-    virtual nsresult GetResolution(float *aResolution) { *aResolution = mResolution; return NS_OK; }
-    virtual nsresult SetLeft(float aLeft) { mLeft = aLeft; return NS_OK; }
-    virtual nsresult SetTop(float aTop) { mTop = aTop; return NS_OK; }
-    virtual nsresult SetRight(float aRight) { mRight = aRight; return NS_OK; }
-    virtual nsresult SetBottom(float aBottom) { mBottom = aBottom; return NS_OK; }
-    virtual nsresult SetResolution(float aResolution) { mResolution = aResolution; return NS_OK; }
-
-    nsAndroidDisplayport(AndroidRectF aRect, float aResolution):
-        mLeft(aRect.Left()), mTop(aRect.Top()), mRight(aRect.Right()), mBottom(aRect.Bottom()), mResolution(aResolution) {}
-
-private:
-    ~nsAndroidDisplayport() {}
-    float mLeft, mTop, mRight, mBottom, mResolution;
-};
-
-NS_IMPL_ISUPPORTS1(nsAndroidDisplayport, nsIAndroidDisplayport)
-
-void createDisplayPort(AutoLocalJNIFrame *jniFrame, jobject jobj, nsIAndroidDisplayport** displayPort) {
-    JNIEnv* env = jniFrame->GetEnv();
-    AndroidRectF rect(env, env->GetObjectField(jobj, AndroidGeckoLayerClient::jDisplayportPosition));
-    if (jniFrame->CheckForException()) return;
-    float resolution = env->GetFloatField(jobj, AndroidGeckoLayerClient::jDisplayportResolution);
-    if (jniFrame->CheckForException()) return;
-    *displayPort = new nsAndroidDisplayport(rect, resolution);
-}
-
-void
-AndroidGeckoLayerClient::GetDisplayPort(AutoLocalJNIFrame *jniFrame, bool aPageSizeUpdate, bool aIsBrowserContentDisplayed, int32_t tabId, nsIAndroidViewport* metrics, nsIAndroidDisplayport** displayPort)
-{
-    jobject jmetrics = ConvertToJavaViewportMetrics(jniFrame->GetEnv(), metrics);
-    if (jniFrame->CheckForException()) return;
-    if (!jmetrics)
-        return;
-    jobject jobj = jniFrame->GetEnv()->CallObjectMethod(wrapped_obj, jGetDisplayPort, aPageSizeUpdate, aIsBrowserContentDisplayed, tabId, jmetrics);
-    if (jniFrame->CheckForException()) return;
-    createDisplayPort(jniFrame, jobj, displayPort);
-    NS_IF_ADDREF(*displayPort);
-}
-
 jobject
 AndroidGeckoSurfaceView::GetSoftwareDrawBitmap(AutoLocalJNIFrame *jniFrame)
 {
     if (!jniFrame || !jniFrame->GetEnv())
         return nullptr;
 
     jobject ret = jniFrame->GetEnv()->CallObjectMethod(wrapped_obj, jGetSoftwareDrawBitmapMethod);
     if (jniFrame->CheckForException())
@@ -1060,36 +951,16 @@ AndroidRect::Init(JNIEnv *jenv, jobject 
     } else {
         mTop = 0;
         mLeft = 0;
         mRight = 0;
         mBottom = 0;
     }
 }
 
-void
-AndroidRectF::Init(JNIEnv *jenv, jobject jobj)
-{
-    NS_ASSERTION(wrapped_obj == nullptr, "Init called on non-null wrapped_obj!");
-
-    wrapped_obj = jobj;
-
-    if (jobj) {
-        mTop = jenv->GetFloatField(jobj, jTopField);
-        mLeft = jenv->GetFloatField(jobj, jLeftField);
-        mRight = jenv->GetFloatField(jobj, jRightField);
-        mBottom = jenv->GetFloatField(jobj, jBottomField);
-    } else {
-        mTop = 0;
-        mLeft = 0;
-        mRight = 0;
-        mBottom = 0;
-    }
-}
-
 nsJNIString::nsJNIString(jstring jstr, JNIEnv *jenv)
 {
     if (!jstr) {
         SetIsVoid(true);
         return;
     }
     JNIEnv *jni = jenv;
     if (!jni) {
--- a/widget/android/AndroidJavaWrappers.h
+++ b/widget/android/AndroidJavaWrappers.h
@@ -20,20 +20,16 @@
 #ifndef ALOG
 #if defined(DEBUG) || defined(FORCE_ALOG)
 #define ALOG(args...)  __android_log_print(ANDROID_LOG_INFO, "Gecko" , ## args)
 #else
 #define ALOG(args...)
 #endif
 #endif
 
-class nsIAndroidDisplayport;
-class nsIAndroidViewport;
-
-
 namespace mozilla {
 
 class AndroidGeckoLayerClient;
 class AutoLocalJNIFrame;
 
 void InitAndroidJavaWrappers(JNIEnv *jEnv);
 
 /*
@@ -143,48 +139,16 @@ protected:
 
     static jclass jRectClass;
     static jfieldID jBottomField;
     static jfieldID jLeftField;
     static jfieldID jRightField;
     static jfieldID jTopField;
 };
 
-class AndroidRectF : public WrappedJavaObject
-{
-public:
-    static void InitRectFClass(JNIEnv *jEnv);
-
-    AndroidRectF() { }
-    AndroidRectF(JNIEnv *jenv, jobject jobj) {
-        Init(jenv, jobj);
-    }
-
-    void Init(JNIEnv *jenv, jobject jobj);
-
-    float Bottom() { return mBottom; }
-    float Left() { return mLeft; }
-    float Right() { return mRight; }
-    float Top() { return mTop; }
-    float Width() { return mRight - mLeft; }
-    float Height() { return mBottom - mTop; }
-
-protected:
-    float mBottom;
-    float mLeft;
-    float mRight;
-    float mTop;
-
-    static jclass jRectClass;
-    static jfieldID jBottomField;
-    static jfieldID jLeftField;
-    static jfieldID jRightField;
-    static jfieldID jTopField;
-};
-
 class AndroidViewTransform : public WrappedJavaObject {
 public:
     static void InitViewTransformClass(JNIEnv *jEnv);
 
     void Init(jobject jobj);
 
     AndroidViewTransform() {}
     AndroidViewTransform(jobject jobj) { Init(jobj); }
@@ -231,34 +195,25 @@ public:
 
     void SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect);
     void SetPageRect(const gfx::Rect& aCssPageRect);
     void SyncViewportInfo(const nsIntRect& aDisplayPort, float aDisplayResolution, bool aLayersUpdated,
                           nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
     bool CreateFrame(AutoLocalJNIFrame *jniFrame, AndroidLayerRendererFrame& aFrame);
     bool ActivateProgram(AutoLocalJNIFrame *jniFrame);
     bool DeactivateProgram(AutoLocalJNIFrame *jniFrame);
-    void GetDisplayPort(AutoLocalJNIFrame *jniFrame, bool aPageSizeUpdate, bool aIsBrowserContentDisplayed, int32_t tabId, nsIAndroidViewport* metrics, nsIAndroidDisplayport** displayPort);
 
 protected:
     static jclass jGeckoLayerClientClass;
     static jmethodID jSetFirstPaintViewport;
     static jmethodID jSetPageRect;
     static jmethodID jSyncViewportInfoMethod;
     static jmethodID jCreateFrameMethod;
     static jmethodID jActivateProgramMethod;
     static jmethodID jDeactivateProgramMethod;
-    static jmethodID jGetDisplayPort;
-
-public:
-    static jclass jViewportClass;
-    static jclass jDisplayportClass;
-    static jmethodID jViewportCtor;
-    static jfieldID jDisplayportPosition;
-    static jfieldID jDisplayportResolution;
 };
 
 class AndroidGeckoSurfaceView : public WrappedJavaObject
 {
 public:
     static void InitGeckoSurfaceViewClass(JNIEnv *jEnv);
 
     AndroidGeckoSurfaceView() { }
--- a/widget/android/nsIAndroidBridge.idl
+++ b/widget/android/nsIAndroidBridge.idl
@@ -10,41 +10,15 @@ interface nsIBrowserTab : nsISupports {
   readonly attribute nsIDOMWindow window;
   readonly attribute float scale;
 };
 
 [scriptable, uuid(d10377b4-1c90-493a-a532-63cb3f16ee2b)]
 interface nsIAndroidBrowserApp : nsISupports {
   nsIBrowserTab getBrowserTab(in int32_t tabId);
 };
-[scriptable, uuid(59cfcb35-69b7-47b2-8155-32b193272666)]
-interface nsIAndroidViewport : nsISupports {
-  readonly attribute float x;
-  readonly attribute float y;
-  readonly attribute float width;
-  readonly attribute float height;
-  readonly attribute float pageLeft;
-  readonly attribute float pageTop;
-  readonly attribute float pageRight;
-  readonly attribute float pageBottom;
-  readonly attribute float cssPageLeft;
-  readonly attribute float cssPageTop;
-  readonly attribute float cssPageRight;
-  readonly attribute float cssPageBottom;
-  readonly attribute float zoom;
-};
-
-[scriptable, uuid(e1bfbc07-dbae-409d-a5b5-ef57522c1f15)]
-interface nsIAndroidDisplayport : nsISupports {
-  attribute float left;
-  attribute float top;
-  attribute float right;
-  attribute float bottom;
-  attribute float resolution;
-};
 
 [scriptable, uuid(bbb8e0d7-5cca-4ad0-88be-538ce6d04f63)]
 interface nsIAndroidBridge : nsISupports
 {
   AString handleGeckoMessage(in AString message);
   attribute nsIAndroidBrowserApp browserApp;
-  nsIAndroidDisplayport getDisplayPort(in boolean aPageSizeUpdate, in boolean isBrowserContentDisplayed, in int32_t tabId, in nsIAndroidViewport metrics);
 };