Bug 711671 - Rename nsTelephonyWorker / nsITelephone to nsIRadioInterfaceLayer
authorPhilipp von Weitershausen <philipp@weitershausen.de>
Thu, 19 Jan 2012 12:53:32 -0800
changeset 86157 3bb96b5ee587e7dd7af3a8b5613a128b90b25fc9
parent 86156 4cc27651eef809b8f40f0e6dd1d49183873e52dd
child 86158 8ddf161732065f72503773b56c6f10245bb4c666
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs711671
milestone12.0a1
Bug 711671 - Rename nsTelephonyWorker / nsITelephone to nsIRadioInterfaceLayer
dom/sms/src/ril/SmsService.h
dom/system/b2g/Makefile.in
dom/system/b2g/RadioInterfaceLayer.js
dom/system/b2g/RadioInterfaceLayer.manifest
dom/system/b2g/SystemWorkerManager.cpp
dom/system/b2g/SystemWorkerManager.h
dom/system/b2g/nsIRadioInterfaceLayer.idl
dom/system/b2g/nsRadioInterfaceLayer.h
dom/system/b2g/ril_consts.js
dom/system/b2g/ril_worker.js
dom/telephony/Makefile.in
dom/telephony/Telephony.cpp
dom/telephony/Telephony.h
dom/telephony/TelephonyCall.cpp
dom/telephony/TelephonyCall.h
dom/telephony/nsITelephone.idl
dom/telephony/nsTelephonyWorker.h
dom/telephony/nsTelephonyWorker.js
dom/telephony/nsTelephonyWorker.manifest
dom/telephony/ril_consts.js
dom/telephony/ril_worker.js
--- a/dom/sms/src/ril/SmsService.h
+++ b/dom/sms/src/ril/SmsService.h
@@ -35,30 +35,30 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef mozilla_dom_sms_SmsService_h
 #define mozilla_dom_sms_SmsService_h
 
 #include "nsISmsService.h"
 #include "nsCOMPtr.h"
-#include "nsITelephone.h"
+#include "nsIRadioInterfaceLayer.h"
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
 class SmsService : public nsISmsService
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISMSSERVICE
   SmsService();
 
 protected:
-  nsCOMPtr<nsITelephone> mRIL;
+  nsCOMPtr<nsIRadioInterfaceLayer> mRIL;
 };
 
 } // namespace sms
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_sms_SmsService_h
--- a/dom/system/b2g/Makefile.in
+++ b/dom/system/b2g/Makefile.in
@@ -58,20 +58,31 @@ ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += \
   AudioManager.cpp \
   GonkGPSGeolocationProvider.cpp \
   $(NULL)
 endif
 
 XPIDLSRCS = \
   nsIAudioManager.idl \
+  nsIRadioInterfaceLayer.idl \
   nsIWorkerHolder.idl \
   $(NULL)
 
 LOCAL_INCLUDES = \
   -I$(topsrcdir)/dom/base \
   -I$(topsrcdir)/dom/src/geolocation \
   -I$(topsrcdir)/dom/telephony \
   -I$(topsrcdir)/dom/wifi \
   -I$(topsrcdir)/content/events/src \
   $(NULL)
 
+EXTRA_COMPONENTS = \
+  RadioInterfaceLayer.manifest \
+  RadioInterfaceLayer.js \
+  $(NULL)
+
+EXTRA_JS_MODULES = \
+  ril_consts.js \
+  ril_worker.js \
+  $(NULL)
+
 include $(topsrcdir)/config/rules.mk
rename from dom/telephony/nsTelephonyWorker.js
rename to dom/system/b2g/RadioInterfaceLayer.js
--- a/dom/telephony/nsTelephonyWorker.js
+++ b/dom/system/b2g/RadioInterfaceLayer.js
@@ -9,23 +9,24 @@
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
  *
  * The Original Code is Telephony.
  *
  * The Initial Developer of the Original Code is
- *   The Mozilla Foundation.
+ * the Mozilla Foundation.
  * Portions created by the Initial Developer are Copyright (C) 2011
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
  *   Ben Turner <bent.mozilla@gmail.com> (Original Author)
  *   Philipp von Weitershausen <philipp@weitershausen.de>
+ *   Sinker Li <thinker@codemud.net>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -43,45 +44,45 @@ const {classes: Cc, interfaces: Ci, util
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 var RIL = {};
 Cu.import("resource://gre/modules/ril_consts.js", RIL);
 
 const DEBUG = true; // set to false to suppress debug messages
 
-const TELEPHONYWORKER_CID =
+const RADIOINTERFACELAYER_CID =
   Components.ID("{2d831c8d-6017-435b-a80c-e5d422810cea}");
 const DATACALLINFO_CID =
   Components.ID("{ef474cd9-94f7-4c05-a31b-29b9de8a10d2}");
 
 const nsIAudioManager = Ci.nsIAudioManager;
-const nsITelephone = Ci.nsITelephone;
+const nsIRadioInterfaceLayer = Ci.nsIRadioInterfaceLayer;
 
 const kSmsReceivedObserverTopic          = "sms-received";
 const DOM_SMS_DELIVERY_RECEIVED          = "received";
 
 XPCOMUtils.defineLazyServiceGetter(this, "gSmsService",
                                    "@mozilla.org/sms/smsservice;1",
                                    "nsISmsService");
 
 function convertRILCallState(state) {
   switch (state) {
     case RIL.CALL_STATE_ACTIVE:
-      return nsITelephone.CALL_STATE_CONNECTED;
+      return nsIRadioInterfaceLayer.CALL_STATE_CONNECTED;
     case RIL.CALL_STATE_HOLDING:
-      return nsITelephone.CALL_STATE_HELD;
+      return nsIRadioInterfaceLayer.CALL_STATE_HELD;
     case RIL.CALL_STATE_DIALING:
-      return nsITelephone.CALL_STATE_DIALING;
+      return nsIRadioInterfaceLayer.CALL_STATE_DIALING;
     case RIL.CALL_STATE_ALERTING:
-      return nsITelephone.CALL_STATE_RINGING;
+      return nsIRadioInterfaceLayer.CALL_STATE_RINGING;
     case RIL.CALL_STATE_INCOMING:
-      return nsITelephone.CALL_STATE_INCOMING;
+      return nsIRadioInterfaceLayer.CALL_STATE_INCOMING;
     case RIL.CALL_STATE_WAITING:
-      return nsITelephone.CALL_STATE_HELD; // XXX This may not be right...
+      return nsIRadioInterfaceLayer.CALL_STATE_HELD; // XXX This may not be right...
     default:
       throw new Error("Unknown rilCallState: " + state);
   }
 }
 
 /**
  * Fake nsIAudioManager implementation so that we can run the telephony
  * code in a non-Gonk build.
@@ -121,38 +122,38 @@ DataCallInfo.protoptype = {
   classID:      DATACALLINFO_CID,
   classInfo:    XPCOMUtils.generateCI({classID: DATACALLINFO_CID,
                                        classDescription: "DataCallInfo",
                                        interfaces: [Ci.nsIDataCallInfo]}),
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIDataCallInfo]),
 };
 
 
-function nsTelephonyWorker() {
+function RadioInterfaceLayer() {
   this.worker = new ChromeWorker("resource://gre/modules/ril_worker.js");
   this.worker.onerror = this.onerror.bind(this);
   this.worker.onmessage = this.onmessage.bind(this);
   debug("Starting Worker\n");
   this.currentState = {
     signalStrength: null,
     operator:       null,
     radioState:     null,
     cardState:      null
   };
 }
-nsTelephonyWorker.prototype = {
+RadioInterfaceLayer.prototype = {
 
-  classID:   TELEPHONYWORKER_CID,
-  classInfo: XPCOMUtils.generateCI({classID: TELEPHONYWORKER_CID,
-                                    classDescription: "Telephone",
+  classID:   RADIOINTERFACELAYER_CID,
+  classInfo: XPCOMUtils.generateCI({classID: RADIOINTERFACELAYER_CID,
+                                    classDescription: "RadioInterfaceLayer",
                                     interfaces: [Ci.nsIWorkerHolder,
-                                                 Ci.nsITelephone]}),
+                                                 Ci.nsIRadioInterfaceLayer]}),
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIWorkerHolder,
-                                         Ci.nsITelephone]),
+                                         Ci.nsIRadioInterfaceLayer]),
 
   onerror: function onerror(event) {
     debug("Got an error: " + event.filename + ":" +
           event.lineno + ": " + event.message + "\n");
     event.preventDefault();
   },
 
   /**
@@ -214,38 +215,38 @@ nsTelephonyWorker.prototype = {
   updateCallAudioState: function updateCallAudioState() {
     if (!this._activeCall) {
       // Disable audio.
       gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_NORMAL;
       debug("No active call, put audio system into PHONE_STATE_NORMAL.");
       return;
     }
     switch (this._activeCall.state) {
-      case nsITelephone.CALL_STATE_INCOMING:
+      case nsIRadioInterfaceLayer.CALL_STATE_INCOMING:
         gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_RINGTONE;
         debug("Incoming call, put audio system into PHONE_STATE_RINGTONE.");
         break;
-      case nsITelephone.CALL_STATE_DIALING: // Fall through...
-      case nsITelephone.CALL_STATE_CONNECTED:
+      case nsIRadioInterfaceLayer.CALL_STATE_DIALING: // Fall through...
+      case nsIRadioInterfaceLayer.CALL_STATE_CONNECTED:
         gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_IN_CALL;
         gAudioManager.setForceForUse(nsIAudioManager.USE_COMMUNICATION,
                                      nsIAudioManager.FORCE_NONE);
         debug("Active call, put audio system into PHONE_STATE_IN_CALL.");
         break;
     }
   },
 
   /**
    * Handle call state changes by updating our current state and the audio
    * system.
    */
   handleCallStateChange: function handleCallStateChange(call) {
     debug("handleCallStateChange: " + JSON.stringify(call));
     call.state = convertRILCallState(call.state);
-    if (call.state == nsITelephone.CALL_STATE_CONNECTED) {
+    if (call.state == nsIRadioInterfaceLayer.CALL_STATE_CONNECTED) {
       // This is now the active call.
       this._activeCall = call;
     }
     this.updateCallAudioState();
     this._deliverCallback("callStateChanged",
                           [call.callIndex, call.state, call.number]);
   },
 
@@ -254,17 +255,18 @@ nsTelephonyWorker.prototype = {
    */
   handleCallDisconnected: function handleCallDisconnected(call) {
     debug("handleCallDisconnected: " + JSON.stringify(call));
     if (this._activeCall.callIndex == call.callIndex) {
       this._activeCall = null;
     }
     this.updateCallAudioState();
     this._deliverCallback("callStateChanged",
-                          [call.callIndex, nsITelephone.CALL_STATE_DISCONNECTED,
+                          [call.callIndex,
+                           nsIRadioInterfaceLayer.CALL_STATE_DISCONNECTED,
                            call.number]);
   },
 
   /**
    * Handle calls delivered in response to a 'enumerateCalls' request.
    */
   handleEnumerateCalls: function handleEnumerateCalls(calls) {
     debug("handleEnumerateCalls: " + JSON.stringify(calls));
@@ -322,17 +324,17 @@ nsTelephonyWorker.prototype = {
     this._deliverDataCallCallback("receiveDataCallList",
                                   [datacalls, datacalls.length]);
   },
 
   // nsIRadioWorker
 
   worker: null,
 
-  // nsITelephone
+  // nsIRadioInterfaceLayer
 
   currentState: null,
 
   dial: function dial(number) {
     debug("Dialing " + number);
     this.worker.postMessage({type: "dial", number: number});
   },
 
@@ -535,18 +537,18 @@ nsTelephonyWorker.prototype = {
   },
 
   getDataCallList: function getDataCallList() {
     this.worker.postMessage({type: "getDataCallList"});
   },
 
 };
 
-const NSGetFactory = XPCOMUtils.generateNSGetFactory([nsTelephonyWorker]);
+const NSGetFactory = XPCOMUtils.generateNSGetFactory([RadioInterfaceLayer]);
 
 let debug;
 if (DEBUG) {
   debug = function (s) {
-    dump("-*- TelephonyWorker component: " + s + "\n");
+    dump("-*- RadioInterfaceLayer: " + s + "\n");
   };
 } else {
   debug = function (s) {};
 }
rename from dom/telephony/nsTelephonyWorker.manifest
rename to dom/system/b2g/RadioInterfaceLayer.manifest
--- a/dom/telephony/nsTelephonyWorker.manifest
+++ b/dom/system/b2g/RadioInterfaceLayer.manifest
@@ -1,1 +1,1 @@
-component {2d831c8d-6017-435b-a80c-e5d422810cea} nsTelephonyWorker.js
+component {2d831c8d-6017-435b-a80c-e5d422810cea} RadioInterfaceLayer.js
--- a/dom/system/b2g/SystemWorkerManager.cpp
+++ b/dom/system/b2g/SystemWorkerManager.cpp
@@ -36,37 +36,37 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "SystemWorkerManager.h"
 
 #include "nsIObserverService.h"
 #include "nsIJSContextStack.h"
-#include "nsITelephone.h"
+#include "nsIRadioInterfaceLayer.h"
 #include "nsIWifi.h"
 #include "nsIWorkerHolder.h"
 #include "nsIXPConnect.h"
 
 #include "jstypedarray.h"
 #include "mozilla/dom/workers/Workers.h"
 #include "mozilla/ipc/Ril.h"
 #include "nsContentUtils.h"
 #include "nsServiceManagerUtils.h"
-#include "nsTelephonyWorker.h"
 #include "nsThreadUtils.h"
+#include "nsRadioInterfaceLayer.h"
 #include "nsWifiWorker.h"
 
 USING_TELEPHONY_NAMESPACE
 USING_WORKERS_NAMESPACE
 using namespace mozilla::ipc;
 
 namespace {
 
-NS_DEFINE_CID(kTelephonyWorkerCID, NS_TELEPHONYWORKER_CID);
+NS_DEFINE_CID(kRadioInterfaceLayerCID, NS_RADIOINTERFACELAYER_CID);
 NS_DEFINE_CID(kWifiWorkerCID, NS_WIFIWORKER_CID);
 
 // Doesn't carry a reference, we're owned by services.
 SystemWorkerManager *gInstance = nsnull;
 
 class ConnectWorkerToRIL : public WorkerTask
 {
 public:
@@ -219,17 +219,17 @@ SystemWorkerManager::Init()
   nsresult rv = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&cx);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCxPusher pusher;
   if (!cx || !pusher.Push(cx, false)) {
     return NS_ERROR_FAILURE;
   }
 
-  rv = InitTelephone(cx);
+  rv = InitRIL(cx);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = InitWifi(cx);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIObserverService> obs =
     do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
   if (!obs) {
@@ -247,17 +247,17 @@ void
 SystemWorkerManager::Shutdown()
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
   mShutdown = true;
 
   StopRil();
 
-  mTelephoneWorker = nsnull;
+  mRILWorker = nsnull;
   mWifiWorker = nsnull;
 
   nsCOMPtr<nsIObserverService> obs =
     do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
   if (obs) {
     obs->RemoveObserver(this, WORKERS_SHUTDOWN_TOPIC);
   }
 }
@@ -290,37 +290,37 @@ SystemWorkerManager::GetInterfaceRequest
   return gInstance;
 }
 
 NS_IMETHODIMP
 SystemWorkerManager::GetInterface(const nsIID &aIID, void **aResult)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
-  if (aIID.Equals(NS_GET_IID(nsITelephone))) {
-    return CallQueryInterface(mTelephoneWorker,
-                              reinterpret_cast<nsITelephone**>(aResult));
+  if (aIID.Equals(NS_GET_IID(nsIRadioInterfaceLayer))) {
+    return CallQueryInterface(mRILWorker,
+                              reinterpret_cast<nsIRadioInterfaceLayer**>(aResult));
   }
 
   if (aIID.Equals(NS_GET_IID(nsIWifi))) {
     return CallQueryInterface(mWifiWorker,
                               reinterpret_cast<nsIWifi**>(aResult));
   }
 
   NS_WARNING("Got nothing for the requested IID!");
   return NS_ERROR_NO_INTERFACE;
 }
 
 nsresult
-SystemWorkerManager::InitTelephone(JSContext *cx)
+SystemWorkerManager::InitRIL(JSContext *cx)
 {
   // We're keeping as much of this implementation as possible in JS, so the real
-  // worker lives in nsTelephonyWorker.js. All we do here is hold it alive and
+  // worker lives in RadioInterfaceLayer.js. All we do here is hold it alive and
   // hook it up to the RIL thread.
-  nsCOMPtr<nsIWorkerHolder> worker = do_CreateInstance(kTelephonyWorkerCID);
+  nsCOMPtr<nsIWorkerHolder> worker = do_CreateInstance(kRadioInterfaceLayerCID);
   NS_ENSURE_TRUE(worker, NS_ERROR_FAILURE);
 
   jsval workerval;
   nsresult rv = worker->GetWorker(&workerval);
   NS_ENSURE_SUCCESS(rv, rv);
 
   NS_ENSURE_TRUE(!JSVAL_IS_PRIMITIVE(workerval), NS_ERROR_UNEXPECTED);
 
@@ -340,17 +340,17 @@ SystemWorkerManager::InitTelephone(JSCon
   if (!wctd->PostTask(connection)) {
     return NS_ERROR_UNEXPECTED;
   }
 
   // Now that we're set up, connect ourselves to the RIL thread.
   mozilla::RefPtr<RILReceiver> receiver = new RILReceiver(wctd);
   StartRil(receiver);
 
-  mTelephoneWorker = worker;
+  mRILWorker = worker;
   return NS_OK;
 }
 
 nsresult
 SystemWorkerManager::InitWifi(JSContext *cx)
 {
   nsCOMPtr<nsIWorkerHolder> worker = do_CreateInstance(kWifiWorkerCID);
   NS_ENSURE_TRUE(worker, NS_ERROR_FAILURE);
--- a/dom/system/b2g/SystemWorkerManager.h
+++ b/dom/system/b2g/SystemWorkerManager.h
@@ -65,20 +65,20 @@ public:
 
   static nsIInterfaceRequestor*
   GetInterfaceRequestor();
 
 private:
   SystemWorkerManager();
   ~SystemWorkerManager();
 
-  nsresult InitTelephone(JSContext *cx);
+  nsresult InitRIL(JSContext *cx);
   nsresult InitWifi(JSContext *cx);
 
-  nsCOMPtr<nsIWorkerHolder> mTelephoneWorker;
+  nsCOMPtr<nsIWorkerHolder> mRILWorker;
   nsCOMPtr<nsIWorkerHolder> mWifiWorker;
 
   bool mShutdown;
 };
 
 END_TELEPHONY_NAMESPACE
 
 #endif // mozilla_dom_system_b2g_systemworkermanager_h__
rename from dom/telephony/nsITelephone.idl
rename to dom/system/b2g/nsIRadioInterfaceLayer.idl
--- a/dom/telephony/nsITelephone.idl
+++ b/dom/system/b2g/nsIRadioInterfaceLayer.idl
@@ -14,17 +14,19 @@
  * The Original Code is Telephony.
  *
  * The Initial Developer of the Original Code is
  * the Mozilla Foundation.
  * Portions created by the Initial Developer are Copyright (C) 2011
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
- *  Philipp von Weitershausen <philipp@weitershausen.de>
+ *   Philipp von Weitershausen <philipp@weitershausen.de>
+ *   Ben Turner <bent.mozilla@gmail.com>
+ *   Sinker Li <thinker@codemud.net>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -32,58 +34,95 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
 
-[scriptable, uuid(9b7e3a01-9c45-4af3-81bb-1bf08a842226)]
-interface nsITelephoneCallback : nsISupports
+[scriptable, uuid(03eafd60-d138-4f09-81b4-90cd4996b3c7)]
+interface nsIRILTelephonyCallback : nsISupports
 {
-  // 'callState' uses the CALL_STATE values from nsITelephone.
+  /**
+   * Notified when a telephony call changes state.
+   *
+   * @param callIndex
+   *        Call identifier assigned by the RIL.
+   * @param callState
+   *        One of the nsIRadioInterfaceLayer::CALL_STATE_* values.
+   * @param number
+   *        Number of the other party.
+   */
   void callStateChanged(in unsigned long callIndex,
                         in unsigned short callState,
                         in AString number);
 
-  // 'callState' uses the CALL_STATE values from nsITelephone. Return true to
-  // continue enumeration or false to cancel.
+  /**
+   * Called when nsIRadioInterfaceLayer is asked to enumerate the current
+   * telephony call state (nsIRadioInterfaceLayer::enumerateCalls). This is
+   * called once per call that is currently managed by the RIL.
+   *
+   * @param callIndex
+   *        Call identifier assigned by the RIL.
+   * @param callState
+   *        One of the nsIRadioInterfaceLayer::CALL_STATE_* values.
+   * @param number
+   *        Number of the other party.
+   * @param isActive
+   *        Indicates whether this call is the active one.
+   *
+   * @return true to continue enumeration or false to cancel.
+   */
   boolean enumerateCallState(in unsigned long callIndex,
                              in unsigned short callState,
                              in AString number,
                              in boolean isActive);
 };
 
-[scriptable, uuid(8399fddd-471c-41ac-8f35-99f7dbb738ec)]
-interface nsIDataCallInfo : nsISupports
+[scriptable, uuid(66a55943-e63b-4731-aece-9c04bfc14019)]
+interface nsIRILDataCallInfo : nsISupports
 {
   readonly attribute unsigned long callState;
   readonly attribute AString cid;
   readonly attribute AString apn;
 };
 
-[scriptable, uuid(36cc4b89-0338-4ff7-a3c2-d78e60f2ea98)]
-interface nsIPhoneDataCallCallback : nsISupports
+[scriptable, uuid(cea91bcb-3cfb-42bb-8638-dae89e8870fc)]
+interface nsIRILDataCallback : nsISupports
 {
   /**
-   * This method is called when the state of a data call is changed.
+   * Notified when a data call changes state.
    *
-   * @param dataState use DATACALL_STATE_* values from nsITelephone.
+   * @param cid
+   *        The CID of the data call.
+   * @param interfaceName
+   *        Name of the associated network interface.
+   * @param dataState
+   *        One of the nsIRadioInterfaceLayer::DATACALL_STATE_* values.
    */
   void dataCallStateChanged(in AString cid,
                             in AString interfaceName,
                             in unsigned short callState);
 
-  void receiveDataCallList([array,size_is(aLength)] in nsIDataCallInfo aDataCalls,
-                           in unsigned long aLength);
+  /**
+   * Called when nsIRadioInterfaceLayer is asked to enumerate the current
+   * data call state.
+   *
+   * @param datacalls
+   *        Array of nsIRILDataCallInfo objects.
+   * @param length
+   *        Lenght of the aforementioned array.
+   */
+  void receiveDataCallList([array,size_is(length)] in nsIRILDataCallInfo dataCalls,
+                           in unsigned long length);
 };
 
-[scriptable, uuid(78ed0beb-d6ad-42f8-929a-8d003285784f)]
-interface nsITelephone : nsISupports
+[scriptable, uuid(9b7e3a01-9c45-4af3-81bb-1bf08a842226)]
+interface nsIRadioInterfaceLayer : nsISupports
 {
   const unsigned short CALL_STATE_UNKNOWN = 0;
   const unsigned short CALL_STATE_DIALING = 1;
   const unsigned short CALL_STATE_RINGING = 2;
   const unsigned short CALL_STATE_BUSY = 3;
   const unsigned short CALL_STATE_CONNECTING = 4;
   const unsigned short CALL_STATE_CONNECTED = 5;
   const unsigned short CALL_STATE_HOLDING = 6;
@@ -97,52 +136,54 @@ interface nsITelephone : nsISupports
   const unsigned short DATACALL_STATE_UNKNOWN = 0;
   const unsigned short DATACALL_STATE_CONNECTING = 1;
   const unsigned short DATACALL_STATE_CONNECTED = 2;
   const unsigned short DATACALL_STATE_DISCONNECTING = 3;
   const unsigned short DATACALL_STATE_DISCONNECTED = 4;
 
   readonly attribute jsval currentState;
 
-  void registerCallback(in nsITelephoneCallback callback);
-  void unregisterCallback(in nsITelephoneCallback callback);
+  void registerCallback(in nsIRILTelephonyCallback callback);
+  void unregisterCallback(in nsIRILTelephonyCallback callback);
 
   /**
    * Will continue calling callback.enumerateCallState until the callback
    * returns false.
    */
-  void enumerateCalls(in nsITelephoneCallback callback);
+  void enumerateCalls(in nsIRILTelephonyCallback callback);
 
   /**
    * Functionality for making and managing phone calls.
    */
   void dial(in DOMString number);
   void hangUp(in unsigned long callIndex);
 
   void startTone(in DOMString dtmfChar);
   void stopTone();
 
   void answerCall(in unsigned long callIndex);
   void rejectCall(in unsigned long callIndex);
 
   attribute bool microphoneMuted;
   attribute bool speakerEnabled;
 
-  // PDP APIs
+  /**
+   * PDP APIs
+   */
   void setupDataCall(in long radioTech,
                      in DOMString apn,
                      in DOMString user,
                      in DOMString passwd,
                      in long chappap,
                      in DOMString pdptype);
   void deactivateDataCall(in DOMString cid,
                           in DOMString reason);
   void getDataCallList();
   
-  void registerDataCallCallback(in nsIPhoneDataCallCallback callback);
-  void unregisterDataCallCallback(in nsIPhoneDataCallCallback callback);
+  void registerDataCallCallback(in nsIRILDataCallback callback);
+  void unregisterDataCallCallback(in nsIRILDataCallback callback);
 
   /**
    * SMS-related functionality.
    */
   unsigned short getNumberOfMessagesForText(in DOMString text);
   void sendSMS(in DOMString number, in DOMString message);
 };
rename from dom/telephony/nsTelephonyWorker.h
rename to dom/system/b2g/nsRadioInterfaceLayer.h
--- a/dom/telephony/nsTelephonyWorker.h
+++ b/dom/system/b2g/nsRadioInterfaceLayer.h
@@ -30,12 +30,12 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-// This must always match the CID given in nsTelephonyWorker.manifest!
-#define NS_TELEPHONYWORKER_CID \
+// This must always match the CID given in RadioInterfaceLayer.manifest!
+#define NS_RADIOINTERFACELAYER_CID \
     { 0x2d831c8d, 0x6017, 0x435b, \
       { 0xa8, 0x0c, 0xe5, 0xd4, 0x22, 0x81, 0x0c, 0xea } }
rename from dom/telephony/ril_consts.js
rename to dom/system/b2g/ril_consts.js
rename from dom/telephony/ril_worker.js
rename to dom/system/b2g/ril_worker.js
--- a/dom/telephony/Makefile.in
+++ b/dom/telephony/Makefile.in
@@ -56,23 +56,17 @@ CPPSRCS = \
   CallEvent.cpp \
   $(NULL)
 
 XPIDLSRCS = \
   nsIDOMNavigatorTelephony.idl \
   nsIDOMTelephony.idl \
   nsIDOMTelephonyCall.idl \
   nsIDOMCallEvent.idl \
-  nsITelephone.idl \
-  $(NULL)
-
-EXTRA_COMPONENTS = \
-  nsTelephonyWorker.manifest \
-  nsTelephonyWorker.js \
   $(NULL)
 
-EXTRA_JS_MODULES = \
-  ril_consts.js \
-  ril_worker.js \
-  $(NULL)
+#LOCAL_INCLUDES = \
+#  -I$(topsrcdir)/dom/base \
+#  -I$(topsrcdir)/dom/system/b2g \
+#  -I$(topsrcdir)/content/events/src \
+#  $(NULL)
 
 include $(topsrcdir)/config/rules.mk
-
--- a/dom/telephony/Telephony.cpp
+++ b/dom/telephony/Telephony.cpp
@@ -107,49 +107,49 @@ nsTArrayToJSArray(JSContext* aCx, JSObje
   *aResultArray = arrayObj;
   return NS_OK;
 }
 
 } // anonymous namespace
 
 Telephony::~Telephony()
 {
-  if (mTelephone && mTelephoneCallback) {
-    mTelephone->UnregisterCallback(mTelephoneCallback);
+  if (mRIL && mRILTelephonyCallback) {
+    mRIL->UnregisterCallback(mRILTelephonyCallback);
   }
 
   if (mRooted) {
     NS_DROP_JS_OBJECTS(this, Telephony);
   }
 }
 
 // static
 already_AddRefed<Telephony>
-Telephony::Create(nsPIDOMWindow* aOwner, nsITelephone* aTelephone)
+Telephony::Create(nsPIDOMWindow* aOwner, nsIRadioInterfaceLayer* aRIL)
 {
   NS_ASSERTION(aOwner, "Null owner!");
-  NS_ASSERTION(aTelephone, "Null telephone!");
+  NS_ASSERTION(aRIL, "Null RIL!");
 
   nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aOwner);
   NS_ENSURE_TRUE(sgo, nsnull);
 
   nsCOMPtr<nsIScriptContext> scriptContext = sgo->GetContext();
   NS_ENSURE_TRUE(scriptContext, nsnull);
 
   nsRefPtr<Telephony> telephony = new Telephony();
 
   telephony->mOwner = aOwner;
   telephony->mScriptContext.swap(scriptContext);
-  telephony->mTelephone = aTelephone;
-  telephony->mTelephoneCallback = new TelephoneCallback(telephony);
+  telephony->mRIL = aRIL;
+  telephony->mRILTelephonyCallback = new RILTelephonyCallback(telephony);
 
-  nsresult rv = aTelephone->EnumerateCalls(telephony->mTelephoneCallback);
+  nsresult rv = aRIL->EnumerateCalls(telephony->mRILTelephonyCallback);
   NS_ENSURE_SUCCESS(rv, nsnull);
 
-  rv = aTelephone->RegisterCallback(telephony->mTelephoneCallback);
+  rv = aRIL->RegisterCallback(telephony->mRILTelephonyCallback);
   NS_ENSURE_SUCCESS(rv, nsnull);
 
   return telephony.forget();
 }
 
 void
 Telephony::SwitchActiveCall(TelephonyCall* aCall)
 {
@@ -190,78 +190,78 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Telephony)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
 
 NS_IMPL_ADDREF_INHERITED(Telephony, nsDOMEventTargetWrapperCache)
 NS_IMPL_RELEASE_INHERITED(Telephony, nsDOMEventTargetWrapperCache)
 
 DOMCI_DATA(Telephony, Telephony)
 
-NS_IMPL_ISUPPORTS1(Telephony::TelephoneCallback, nsITelephoneCallback)
+NS_IMPL_ISUPPORTS1(Telephony::RILTelephonyCallback, nsIRILTelephonyCallback)
 
 NS_IMETHODIMP
 Telephony::Dial(const nsAString& aNumber, nsIDOMTelephonyCall** aResult)
 {
   NS_ENSURE_ARG(!aNumber.IsEmpty());
 
   for (PRUint32 index = 0; index < mCalls.Length(); index++) {
     const nsRefPtr<TelephonyCall>& tempCall = mCalls[index];
     if (tempCall->IsOutgoing() &&
-        tempCall->CallState() < nsITelephone::CALL_STATE_CONNECTED) {
+        tempCall->CallState() < nsIRadioInterfaceLayer::CALL_STATE_CONNECTED) {
       // One call has been dialed already and we only support one outgoing call
       // at a time.
       NS_WARNING("Only permitted to dial one call at a time!");
       return NS_ERROR_NOT_AVAILABLE;
     }
   }
 
-  nsresult rv = mTelephone->Dial(aNumber);
+  nsresult rv = mRIL->Dial(aNumber);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsRefPtr<TelephonyCall> call =
-    TelephonyCall::Create(this, aNumber, nsITelephone::CALL_STATE_DIALING);
+    TelephonyCall::Create(this, aNumber, nsIRadioInterfaceLayer::CALL_STATE_DIALING);
   NS_ASSERTION(call, "This should never fail!");
 
   NS_ASSERTION(mCalls.Contains(call), "Should have auto-added new call!");
 
   call.forget(aResult);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Telephony::GetMuted(bool* aMuted)
 {
-  nsresult rv = mTelephone->GetMicrophoneMuted(aMuted);
+  nsresult rv = mRIL->GetMicrophoneMuted(aMuted);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Telephony::SetMuted(bool aMuted)
 {
-  nsresult rv = mTelephone->SetMicrophoneMuted(aMuted);
+  nsresult rv = mRIL->SetMicrophoneMuted(aMuted);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Telephony::GetSpeakerEnabled(bool* aSpeakerEnabled)
 {
-  nsresult rv = mTelephone->GetSpeakerEnabled(aSpeakerEnabled);
+  nsresult rv = mRIL->GetSpeakerEnabled(aSpeakerEnabled);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Telephony::SetSpeakerEnabled(bool aSpeakerEnabled)
 {
-  nsresult rv = mTelephone->SetSpeakerEnabled(aSpeakerEnabled);
+  nsresult rv = mRIL->SetSpeakerEnabled(aSpeakerEnabled);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Telephony::GetActive(jsval* aActive)
 {
@@ -334,26 +334,26 @@ Telephony::StartTone(const nsAString& aD
     NS_WARNING("Empty tone string will be ignored");
     return NS_OK;
   }
 
   if (aDTMFChar.Length() > 1) {
     return NS_ERROR_INVALID_ARG;
   }
 
-  nsresult rv = mTelephone->StartTone(aDTMFChar);
+  nsresult rv = mRIL->StartTone(aDTMFChar);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Telephony::StopTone()
 {
-  nsresult rv = mTelephone->StopTone();
+  nsresult rv = mRIL->StopTone();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Telephony::SendTones(const nsAString& aTones, PRUint32 aToneDuration,
                      PRUint32 aIntervalDuration)
@@ -373,53 +373,53 @@ Telephony::CallStateChanged(PRUint32 aCa
 
   nsRefPtr<TelephonyCall> modifiedCall;
   nsRefPtr<TelephonyCall> outgoingCall;
 
   for (PRUint32 index = 0; index < mCalls.Length(); index++) {
     nsRefPtr<TelephonyCall>& tempCall = mCalls[index];
     if (tempCall->CallIndex() == kOutgoingPlaceholderCallIndex) {
       NS_ASSERTION(!outgoingCall, "More than one outgoing call not supported!");
-      NS_ASSERTION(tempCall->CallState() == nsITelephone::CALL_STATE_DIALING,
+      NS_ASSERTION(tempCall->CallState() == nsIRadioInterfaceLayer::CALL_STATE_DIALING,
                    "Something really wrong here!");
       // Stash this for later, we may need it if aCallIndex doesn't match one of
       // our other calls.
       outgoingCall = tempCall;
     } else if (tempCall->CallIndex() == aCallIndex) {
       // We already know about this call so just update its state.
       modifiedCall = tempCall;
       outgoingCall = nsnull;
       break;
     }
   }
 
   // If nothing matched above and the call state isn't incoming but we do have
   // an outgoing call then we must be seeing a status update for our outgoing
   // call.
   if (!modifiedCall &&
-      aCallState != nsITelephone::CALL_STATE_INCOMING &&
+      aCallState != nsIRadioInterfaceLayer::CALL_STATE_INCOMING &&
       outgoingCall) {
     outgoingCall->UpdateCallIndex(aCallIndex);
     modifiedCall.swap(outgoingCall);
   }
 
   if (modifiedCall) {
     // Change state.
     modifiedCall->ChangeState(aCallState);
 
     // See if this should replace our current active call.
-    if (aCallState == nsITelephone::CALL_STATE_CONNECTED) {
+    if (aCallState == nsIRadioInterfaceLayer::CALL_STATE_CONNECTED) {
       SwitchActiveCall(modifiedCall);
     }
 
     return NS_OK;
   }
 
   // Didn't know anything about this call before now, must be incoming.
-  NS_ASSERTION(aCallState == nsITelephone::CALL_STATE_INCOMING,
+  NS_ASSERTION(aCallState == nsIRadioInterfaceLayer::CALL_STATE_INCOMING,
                "Serious logic problem here!");
 
   nsRefPtr<TelephonyCall> call =
     TelephonyCall::Create(this, aNumber, aCallState, aCallIndex);
   NS_ASSERTION(call, "This should never fail!");
 
   NS_ASSERTION(mCalls.Contains(call), "Should have auto-added new call!");
 
@@ -506,17 +506,17 @@ NS_NewTelephony(nsPIDOMWindow* aWindow, 
       return NS_OK;
     }
   }
 
   // Security checks passed, make a telephony object.
   nsIInterfaceRequestor* ireq = SystemWorkerManager::GetInterfaceRequestor();
   NS_ENSURE_TRUE(ireq, NS_ERROR_UNEXPECTED);
 
-  nsCOMPtr<nsITelephone> telephone = do_GetInterface(ireq);
-  NS_ENSURE_TRUE(telephone, NS_ERROR_UNEXPECTED);
+  nsCOMPtr<nsIRadioInterfaceLayer> ril = do_GetInterface(ireq);
+  NS_ENSURE_TRUE(ril, NS_ERROR_UNEXPECTED);
 
-  nsRefPtr<Telephony> telephony = Telephony::Create(innerWindow, telephone);
+  nsRefPtr<Telephony> telephony = Telephony::Create(innerWindow, ril);
   NS_ENSURE_TRUE(telephony, NS_ERROR_UNEXPECTED);
 
   telephony.forget(aTelephony);
   return NS_OK;
 }
--- a/dom/telephony/Telephony.h
+++ b/dom/telephony/Telephony.h
@@ -39,51 +39,51 @@
 
 #ifndef mozilla_dom_telephony_telephony_h__
 #define mozilla_dom_telephony_telephony_h__
 
 #include "TelephonyCommon.h"
 
 #include "nsIDOMTelephony.h"
 #include "nsIDOMTelephonyCall.h"
-#include "nsITelephone.h"
+#include "nsIRadioInterfaceLayer.h"
 
 class nsIScriptContext;
 class nsPIDOMWindow;
 
 BEGIN_TELEPHONY_NAMESPACE
 
 class Telephony : public nsDOMEventTargetWrapperCache,
                   public nsIDOMTelephony
 {
-  nsCOMPtr<nsITelephone> mTelephone;
-  nsCOMPtr<nsITelephoneCallback> mTelephoneCallback;
+  nsCOMPtr<nsIRadioInterfaceLayer> mRIL;
+  nsCOMPtr<nsIRILTelephonyCallback> mRILTelephonyCallback;
 
   NS_DECL_EVENT_HANDLER(incoming);
 
   TelephonyCall* mActiveCall;
   nsTArray<nsRefPtr<TelephonyCall> > mCalls;
 
   // Cached calls array object. Cleared whenever mCalls changes and then rebuilt
   // once a page looks for the liveCalls attribute.
   JSObject* mCallsArray;
 
   bool mRooted;
 
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMTELEPHONY
-  NS_DECL_NSITELEPHONECALLBACK
+  NS_DECL_NSIRILTELEPHONYCALLBACK
   NS_FORWARD_NSIDOMEVENTTARGET(nsDOMEventTargetWrapperCache::)
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
                                                    Telephony,
                                                    nsDOMEventTargetWrapperCache)
 
   static already_AddRefed<Telephony>
-  Create(nsPIDOMWindow* aOwner, nsITelephone* aTelephone);
+  Create(nsPIDOMWindow* aOwner, nsIRadioInterfaceLayer* aRIL);
 
   nsIDOMEventTarget*
   ToIDOMEventTarget() const
   {
     return static_cast<nsDOMEventTargetWrapperCache*>(
              const_cast<Telephony*>(this));
   }
 
@@ -104,20 +104,20 @@ public:
   void
   RemoveCall(TelephonyCall* aCall)
   {
     NS_ASSERTION(mCalls.Contains(aCall), "Didn't know about this one!");
     mCalls.RemoveElement(aCall);
     mCallsArray = nsnull;
   }
 
-  nsITelephone*
-  Telephone() const
+  nsIRadioInterfaceLayer*
+  RIL() const
   {
-    return mTelephone;
+    return mRIL;
   }
 
   nsPIDOMWindow*
   Owner() const
   {
     return mOwner;
   }
 
@@ -132,25 +132,25 @@ private:
   : mActiveCall(nsnull), mCallsArray(nsnull), mRooted(false)
   { }
 
   ~Telephony();
 
   void
   SwitchActiveCall(TelephonyCall* aCall);
 
-  class TelephoneCallback : public nsITelephoneCallback
+  class RILTelephonyCallback : public nsIRILTelephonyCallback
   {
     Telephony* mTelephony;
 
   public:
     NS_DECL_ISUPPORTS
-    NS_FORWARD_NSITELEPHONECALLBACK(mTelephony->)
+    NS_FORWARD_NSIRILTELEPHONYCALLBACK(mTelephony->)
 
-    TelephoneCallback(Telephony* aTelephony)
+    RILTelephonyCallback(Telephony* aTelephony)
     : mTelephony(aTelephony)
     {
       NS_ASSERTION(mTelephony, "Null pointer!");
     }
   };
 };
 
 END_TELEPHONY_NAMESPACE
--- a/dom/telephony/TelephonyCall.cpp
+++ b/dom/telephony/TelephonyCall.cpp
@@ -70,61 +70,61 @@ TelephonyCall::Create(Telephony* aTeleph
 
 void
 TelephonyCall::ChangeStateInternal(PRUint16 aCallState, bool aFireEvents)
 {
   nsRefPtr<TelephonyCall> kungFuDeathGrip(this);
 
   nsString stateString;
   switch (aCallState) {
-    case nsITelephone::CALL_STATE_DIALING:
+    case nsIRadioInterfaceLayer::CALL_STATE_DIALING:
       stateString.AssignLiteral("dialing");
       break;
-    case nsITelephone::CALL_STATE_RINGING:
+    case nsIRadioInterfaceLayer::CALL_STATE_RINGING:
       stateString.AssignLiteral("ringing");
       break;
-    case nsITelephone::CALL_STATE_BUSY:
+    case nsIRadioInterfaceLayer::CALL_STATE_BUSY:
       stateString.AssignLiteral("busy");
       break;
-    case nsITelephone::CALL_STATE_CONNECTING:
+    case nsIRadioInterfaceLayer::CALL_STATE_CONNECTING:
       stateString.AssignLiteral("connecting");
       break;
-    case nsITelephone::CALL_STATE_CONNECTED:
+    case nsIRadioInterfaceLayer::CALL_STATE_CONNECTED:
       stateString.AssignLiteral("connected");
       break;
-    case nsITelephone::CALL_STATE_HOLDING:
+    case nsIRadioInterfaceLayer::CALL_STATE_HOLDING:
       stateString.AssignLiteral("holding");
       break;
-    case nsITelephone::CALL_STATE_HELD:
+    case nsIRadioInterfaceLayer::CALL_STATE_HELD:
       stateString.AssignLiteral("held");
       break;
-    case nsITelephone::CALL_STATE_RESUMING:
+    case nsIRadioInterfaceLayer::CALL_STATE_RESUMING:
       stateString.AssignLiteral("resuming");
       break;
-    case nsITelephone::CALL_STATE_DISCONNECTING:
+    case nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTING:
       stateString.AssignLiteral("disconnecting");
       break;
-    case nsITelephone::CALL_STATE_DISCONNECTED:
+    case nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTED:
       stateString.AssignLiteral("disconnected");
       break;
-    case nsITelephone::CALL_STATE_INCOMING:
+    case nsIRadioInterfaceLayer::CALL_STATE_INCOMING:
       stateString.AssignLiteral("incoming");
       break;
     default:
       NS_NOTREACHED("Unknown state!");
   }
 
   mState = stateString;
   mCallState = aCallState;
 
-  if (aCallState == nsITelephone::CALL_STATE_DIALING) {
+  if (aCallState == nsIRadioInterfaceLayer::CALL_STATE_DIALING) {
     mOutgoing = true;
   }
 
-  if (aCallState == nsITelephone::CALL_STATE_DISCONNECTED) {
+  if (aCallState == nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTED) {
     NS_ASSERTION(mLive, "Should be live!");
     mTelephony->RemoveCall(this);
     mLive = false;
   } else if (!mLive) {
     mTelephony->AddCall(this);
     mLive = true;
   }
 
@@ -203,43 +203,43 @@ TelephonyCall::GetState(nsAString& aStat
 {
   aState.Assign(mState);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TelephonyCall::Answer()
 {
-  if (mCallState != nsITelephone::CALL_STATE_INCOMING) {
+  if (mCallState != nsIRadioInterfaceLayer::CALL_STATE_INCOMING) {
     NS_WARNING("Answer on non-incoming call ignored!");
     return NS_OK;
   }
 
-  nsresult rv = mTelephony->Telephone()->AnswerCall(mCallIndex);
+  nsresult rv = mTelephony->RIL()->AnswerCall(mCallIndex);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  ChangeStateInternal(nsITelephone::CALL_STATE_CONNECTING, true);
+  ChangeStateInternal(nsIRadioInterfaceLayer::CALL_STATE_CONNECTING, true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 TelephonyCall::HangUp()
 {
-  if (mCallState == nsITelephone::CALL_STATE_DISCONNECTING ||
-      mCallState == nsITelephone::CALL_STATE_DISCONNECTED) {
+  if (mCallState == nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTING ||
+      mCallState == nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTED) {
     NS_WARNING("HangUp on previously disconnected call ignored!");
     return NS_OK;
   }
 
-  nsresult rv = mCallState == nsITelephone::CALL_STATE_INCOMING ?
-                mTelephony->Telephone()->RejectCall(mCallIndex) :
-                mTelephony->Telephone()->HangUp(mCallIndex);
+  nsresult rv = mCallState == nsIRadioInterfaceLayer::CALL_STATE_INCOMING ?
+                mTelephony->RIL()->RejectCall(mCallIndex) :
+                mTelephony->RIL()->HangUp(mCallIndex);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  ChangeStateInternal(nsITelephone::CALL_STATE_DISCONNECTING, true);
+  ChangeStateInternal(nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTING, true);
   return NS_OK;
 }
 
 NS_IMPL_EVENT_HANDLER(TelephonyCall, statechange)
 NS_IMPL_EVENT_HANDLER(TelephonyCall, dialing)
 NS_IMPL_EVENT_HANDLER(TelephonyCall, ringing)
 NS_IMPL_EVENT_HANDLER(TelephonyCall, busy)
 NS_IMPL_EVENT_HANDLER(TelephonyCall, connecting)
--- a/dom/telephony/TelephonyCall.h
+++ b/dom/telephony/TelephonyCall.h
@@ -38,17 +38,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef mozilla_dom_telephony_telephonycall_h__
 #define mozilla_dom_telephony_telephonycall_h__
 
 #include "TelephonyCommon.h"
 
 #include "nsIDOMTelephonyCall.h"
-#include "nsITelephone.h"
+#include "nsIRadioInterfaceLayer.h"
 
 class nsPIDOMWindow;
 
 BEGIN_TELEPHONY_NAMESPACE
 
 class TelephonyCall : public nsDOMEventTargetWrapperCache,
                       public nsIDOMTelephonyCall
 {
@@ -126,17 +126,17 @@ public:
   IsOutgoing() const
   {
     return mOutgoing;
   }
 
 private:
   TelephonyCall()
   : mCallIndex(kOutgoingPlaceholderCallIndex),
-    mCallState(nsITelephone::CALL_STATE_UNKNOWN), mLive(false), mOutgoing(false)
+    mCallState(nsIRadioInterfaceLayer::CALL_STATE_UNKNOWN), mLive(false), mOutgoing(false)
   { }
 
   ~TelephonyCall()
   { }
 
   void
   ChangeStateInternal(PRUint16 aCallState, bool aFireEvents);
 };