Bug 1307525 - Remove MOZ_B2G_RIL-protected code. r=jst
authorMichelangelo De Simone <mdesimone@mozilla.com>
Mon, 07 Nov 2016 13:16:07 -0800
changeset 351524 476aca2782fef12f2cec84e2d68254716f1d1c56
parent 351523 b8386ff9818fd5682b32a4ea8e0a516c9d78d586
child 351525 08811364762917e139d7459faf3b324f076c5e95
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs1307525
milestone52.0a1
Bug 1307525 - Remove MOZ_B2G_RIL-protected code. r=jst MozReview-Commit-ID: 6llGI50d37q
dom/base/moz.build
dom/network/moz.build
dom/permission/moz.build
dom/secureelement/moz.build
dom/system/gonk/AudioManager.cpp
dom/system/gonk/AudioManager.h
dom/system/gonk/GonkGPSGeolocationProvider.cpp
dom/system/gonk/GonkGPSGeolocationProvider.h
dom/system/gonk/SystemWorkerManager.cpp
dom/system/gonk/moz.build
ipc/moz.build
modules/libpref/init/all.js
old-configure.in
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -464,20 +464,16 @@ if CONFIG['MOZ_WEBRTC']:
     LOCAL_INCLUDES += [
         '/netwerk/sctp/datachannel',
     ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
-for var in ('MOZ_B2G_RIL'):
-    if CONFIG[var]:
-        DEFINES[var] = True
-
 if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
     DEFINES['HAVE_SIDEBAR'] = True
 
 if CONFIG['MOZ_X11']:
     CXXFLAGS += CONFIG['TK_CFLAGS']
 
 GENERATED_FILES += [
     'PropertyUseCounterMap.inc',
--- a/dom/network/moz.build
+++ b/dom/network/moz.build
@@ -1,19 +1,16 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 DIRS += ['interfaces']
 
-if CONFIG['MOZ_B2G_RIL']:
-    XPCSHELL_TESTS_MANIFESTS += ['tests/unit_stats/xpcshell.ini']
-
 MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
 MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
 
 EXPORTS.mozilla.dom += [
     'TCPServerSocket.h',
     'TCPSocket.h',
     'UDPSocket.h',
 ]
--- a/dom/permission/moz.build
+++ b/dom/permission/moz.build
@@ -26,17 +26,14 @@ EXTRA_COMPONENTS += [
 EXTRA_JS_MODULES += [
     'PermissionSettings.jsm',
 ]
 
 XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
 
 MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
 
-if CONFIG['MOZ_B2G_RIL']:
-    MOCHITEST_MANIFESTS += ['tests/mochitest-ril.ini']
-
 if CONFIG['MOZ_TIME_MANAGER']:
     MOCHITEST_MANIFESTS += ['tests/mochitest-time.ini']
 
 FINAL_LIBRARY = 'xul'
 
 include('/ipc/chromium/chromium-config.mozbuild')
--- a/dom/secureelement/moz.build
+++ b/dom/secureelement/moz.build
@@ -29,17 +29,12 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk
     EXTRA_JS_MODULES += [
         'gonk/gp_consts.js',
         'gonk/se_consts.js',
         'SEUtils.jsm'
     ]
     XPCSHELL_TESTS_MANIFESTS += [
         'tests/unit/xpcshell.ini'
     ]
-    if CONFIG['MOZ_B2G_RIL']:
-        EXTRA_COMPONENTS += [
-            'gonk/UiccConnector.js',
-            'gonk/UiccConnector.manifest',
-        ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
--- a/dom/system/gonk/AudioManager.cpp
+++ b/dom/system/gonk/AudioManager.cpp
@@ -16,19 +16,16 @@
 #include <android/log.h>
 #include <cutils/properties.h>
 #include <binder/IServiceManager.h>
 
 #include "AudioChannelService.h"
 #include "AudioManager.h"
 
 #include "nsIObserverService.h"
-#ifdef MOZ_B2G_RIL
-#include "nsIRadioInterfaceLayer.h"
-#endif
 #include "nsISettingsService.h"
 #include "nsPrintfCString.h"
 
 #include "mozilla/Hal.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/MozPromise.h"
@@ -689,19 +686,16 @@ AudioManager::AudioManager()
   , mSwitchDone(true)
 #if defined(MOZ_B2G_BT) || ANDROID_VERSION >= 17
   , mBluetoothA2dpEnabled(false)
 #endif
 #ifdef MOZ_B2G_BT
   , mA2dpSwitchDone(true)
 #endif
   , mObserver(new HeadphoneSwitchObserver())
-#ifdef MOZ_B2G_RIL
-  , mMuteCallToRIL(false)
-#endif
 {
   for (uint32_t idx = 0; idx < MOZ_ARRAY_LENGTH(kAudioDeviceInfos); ++idx) {
     mAudioDeviceTableIdMaps.Put(kAudioDeviceInfos[idx].value, idx);
   }
 
   AudioSystem::setErrorCallback(BinderDeadCallback);
 #if ANDROID_VERSION >= 21
   android::sp<GonkAudioPortCallback> callback = new GonkAudioPortCallback();
@@ -749,23 +743,16 @@ AudioManager::AudioManager()
   }
   if (NS_FAILED(obs->AddObserver(this, MOZ_SETTINGS_CHANGE_ID, false))) {
     NS_WARNING("Failed to add mozsettings-changed observer!");
   }
   if (NS_FAILED(obs->AddObserver(this, AUDIO_CHANNEL_PROCESS_CHANGED, false))) {
     NS_WARNING("Failed to add audio-channel-process-changed observer!");
   }
 
-#ifdef MOZ_B2G_RIL
-  char value[PROPERTY_VALUE_MAX];
-  property_get("ro.moz.mute.call.to_ril", value, "false");
-  if (!strcmp(value, "true")) {
-    mMuteCallToRIL = true;
-  }
-#endif
 }
 
 AudioManager::~AudioManager() {
   AudioSystem::setErrorCallback(nullptr);
 #if ANDROID_VERSION >= 21
   AudioSystem::setAudioPortCallback(nullptr);
 #endif
   hal::UnregisterSwitchObserver(hal::SWITCH_HEADPHONES, mObserver);
@@ -810,43 +797,27 @@ AudioManager::GetInstance()
 
   RefPtr<AudioManager> audioMgr = sAudioManager.get();
   return audioMgr.forget();
 }
 
 NS_IMETHODIMP
 AudioManager::GetMicrophoneMuted(bool* aMicrophoneMuted)
 {
-#ifdef MOZ_B2G_RIL
-  if (mMuteCallToRIL) {
-    // Simply return cached mIsMicMuted if mute call go via RIL.
-    *aMicrophoneMuted = mIsMicMuted;
-    return NS_OK;
-  }
-#endif
 
   if (AudioSystem::isMicrophoneMuted(aMicrophoneMuted)) {
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 AudioManager::SetMicrophoneMuted(bool aMicrophoneMuted)
 {
   if (!AudioSystem::muteMicrophone(aMicrophoneMuted)) {
-#ifdef MOZ_B2G_RIL
-    if (mMuteCallToRIL) {
-      // Extra mute request to RIL for specific platform.
-      nsCOMPtr<nsIRadioInterfaceLayer> ril = do_GetService("@mozilla.org/ril;1");
-      NS_ENSURE_TRUE(ril, NS_ERROR_FAILURE);
-      ril->SetMicrophoneMuted(aMicrophoneMuted);
-      mIsMicMuted = aMicrophoneMuted;
-    }
-#endif
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 AudioManager::GetPhoneState(int32_t* aState)
 {
--- a/dom/system/gonk/AudioManager.h
+++ b/dom/system/gonk/AudioManager.h
@@ -136,21 +136,16 @@ protected:
   void UpdateCachedActiveDevicesForStreams();
   uint32_t GetDevicesForStream(int32_t aStream, bool aFromCache = true);
   uint32_t GetDeviceForStream(int32_t aStream);
   // Choose one device as representative of active devices.
   static uint32_t SelectDeviceFromDevices(uint32_t aOutDevices);
 
 private:
   nsAutoPtr<mozilla::hal::SwitchObserver> mObserver;
-#ifdef MOZ_B2G_RIL
-  bool                                    mMuteCallToRIL;
-  // mIsMicMuted is only used for toggling mute call to RIL.
-  bool                                    mIsMicMuted;
-#endif
 
   void HandleBluetoothStatusChanged(nsISupports* aSubject,
                                     const char* aTopic,
                                     const nsCString aAddress);
   void HandleAudioChannelProcessChanged();
 
   // Append the audio output device to the volume setting string.
   nsAutoCString AppendDeviceToVolumeSetting(const char* aName,
--- a/dom/system/gonk/GonkGPSGeolocationProvider.cpp
+++ b/dom/system/gonk/GonkGPSGeolocationProvider.cpp
@@ -34,28 +34,16 @@
 #include "nsPrintfCString.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "prtime.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/SettingChangeNotificationBinding.h"
 
-#ifdef MOZ_B2G_RIL
-#include "mozstumbler/MozStumbler.h"
-#include "nsIIccInfo.h"
-#include "nsIMobileConnectionInfo.h"
-#include "nsIMobileConnectionService.h"
-#include "nsIMobileCellInfo.h"
-#include "nsIMobileNetworkInfo.h"
-#include "nsIRadioInterfaceLayer.h"
-#include "nsIIccService.h"
-#include "nsIDataCallManager.h"
-#endif
-
 #ifdef AGPS_TYPE_INVALID
 #define AGPS_HAVE_DUAL_APN
 #endif
 
 #define FLUSH_AIDE_DATA 0
 
 #undef LOG
 #undef ERR
@@ -65,44 +53,32 @@
 #define DBG(args...)  __android_log_print(ANDROID_LOG_DEBUG, "GonkGPSGeolocationProvider" , ## args)
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 static const int kDefaultPeriod = 1000; // ms
 static bool gDebug_isLoggingEnabled = false;
 static bool gDebug_isGPSLocationIgnored = false;
-#ifdef MOZ_B2G_RIL
-static const char* kNetworkConnStateChangedTopic = "network-connection-state-changed";
-#endif
 static const char* kMozSettingsChangedTopic = "mozsettings-changed";
-#ifdef MOZ_B2G_RIL
-static const char* kPrefRilNumRadioInterfaces = "ril.numRadioInterfaces";
-static const char* kSettingRilDefaultServiceId = "ril.data.defaultServiceId";
-#endif
 // Both of these settings can be toggled in the Gaia Developer settings screen.
 static const char* kSettingDebugEnabled = "geolocation.debugging.enabled";
 static const char* kSettingDebugGpsIgnored = "geolocation.debugging.gps-locations-ignored";
 
 // While most methods of GonkGPSGeolocationProvider should only be
 // called from main thread, we deliberately put the Init and ShutdownGPS
 // methods off main thread to avoid blocking.
 NS_IMPL_ISUPPORTS(GonkGPSGeolocationProvider,
                   nsIGeolocationProvider,
                   nsIObserver,
                   nsISettingsServiceCallback)
 
 /* static */ GonkGPSGeolocationProvider* GonkGPSGeolocationProvider::sSingleton = nullptr;
 GpsCallbacks GonkGPSGeolocationProvider::mCallbacks;
 
-#ifdef MOZ_B2G_RIL
-AGpsCallbacks GonkGPSGeolocationProvider::mAGPSCallbacks;
-AGpsRilCallbacks GonkGPSGeolocationProvider::mAGPSRILCallbacks;
-#endif // MOZ_B2G_RIL
-
 
 void
 GonkGPSGeolocationProvider::LocationCallback(GpsLocation* location)
 {
   if (gDebug_isGPSLocationIgnored) {
     return;
   }
 
@@ -151,19 +127,16 @@ GonkGPSGeolocationProvider::LocationCall
         location->latitude,
         location->longitude,
         location->accuracy);
   }
 
   RefPtr<UpdateLocationEvent> event = new UpdateLocationEvent(somewhere);
   NS_DispatchToMainThread(event);
 
-#ifdef MOZ_B2G_RIL
-  MozStumble(somewhere);
-#endif
 }
 
 class NotifyObserversGPSTask final : public Runnable
 {
 public:
   explicit NotifyObserversGPSTask(const char16_t* aData)
     : mData(aData)
   {}
@@ -275,20 +248,16 @@ GonkGPSGeolocationProvider::SetCapabilit
     UpdateCapabilitiesEvent(uint32_t aCapabilities)
       : mCapabilities(aCapabilities)
     {}
     NS_IMETHOD Run() override {
       RefPtr<GonkGPSGeolocationProvider> provider =
         GonkGPSGeolocationProvider::GetSingleton();
 
       provider->mSupportsScheduling = mCapabilities & GPS_CAPABILITY_SCHEDULING;
-#ifdef MOZ_B2G_RIL
-      provider->mSupportsMSB = mCapabilities & GPS_CAPABILITY_MSB;
-      provider->mSupportsMSA = mCapabilities & GPS_CAPABILITY_MSA;
-#endif
       provider->mSupportsSingleShot = mCapabilities & GPS_CAPABILITY_SINGLE_SHOT;
 #ifdef GPS_CAPABILITY_ON_DEMAND_TIME
       provider->mSupportsTimeInjection = mCapabilities & GPS_CAPABILITY_ON_DEMAND_TIME;
 #endif
       return NS_OK;
     }
   private:
     uint32_t mCapabilities;
@@ -327,100 +296,19 @@ GonkGPSGeolocationProvider::CreateThread
   return thread;
 }
 
 void
 GonkGPSGeolocationProvider::RequestUtcTimeCallback()
 {
 }
 
-#ifdef MOZ_B2G_RIL
-void
-GonkGPSGeolocationProvider::AGPSStatusCallback(AGpsStatus* status)
-{
-  MOZ_ASSERT(status);
-
-  class AGPSStatusEvent : public Runnable {
-  public:
-    AGPSStatusEvent(AGpsStatusValue aStatus)
-      : mStatus(aStatus)
-    {}
-    NS_IMETHOD Run() override {
-      RefPtr<GonkGPSGeolocationProvider> provider =
-        GonkGPSGeolocationProvider::GetSingleton();
-
-      switch (mStatus) {
-        case GPS_REQUEST_AGPS_DATA_CONN:
-          provider->RequestDataConnection();
-          break;
-        case GPS_RELEASE_AGPS_DATA_CONN:
-          provider->ReleaseDataConnection();
-          break;
-      }
-      return NS_OK;
-    }
-  private:
-    AGpsStatusValue mStatus;
-  };
-
-  NS_DispatchToMainThread(new AGPSStatusEvent(status->status));
-}
-
-void
-GonkGPSGeolocationProvider::AGPSRILSetIDCallback(uint32_t flags)
-{
-  class RequestSetIDEvent : public Runnable {
-  public:
-    RequestSetIDEvent(uint32_t flags)
-      : mFlags(flags)
-    {}
-    NS_IMETHOD Run() override {
-      RefPtr<GonkGPSGeolocationProvider> provider =
-        GonkGPSGeolocationProvider::GetSingleton();
-      provider->RequestSetID(mFlags);
-      return NS_OK;
-    }
-  private:
-    uint32_t mFlags;
-  };
-
-  NS_DispatchToMainThread(new RequestSetIDEvent(flags));
-}
-
-void
-GonkGPSGeolocationProvider::AGPSRILRefLocCallback(uint32_t flags)
-{
-  class RequestRefLocEvent : public Runnable {
-  public:
-    RequestRefLocEvent()
-    {}
-    NS_IMETHOD Run() override {
-      RefPtr<GonkGPSGeolocationProvider> provider =
-        GonkGPSGeolocationProvider::GetSingleton();
-      provider->SetReferenceLocation();
-      return NS_OK;
-    }
-  };
-
-  if (flags & AGPS_RIL_REQUEST_REFLOC_CELLID) {
-    NS_DispatchToMainThread(new RequestRefLocEvent());
-  }
-}
-#endif // MOZ_B2G_RIL
-
 GonkGPSGeolocationProvider::GonkGPSGeolocationProvider()
   : mStarted(false)
   , mSupportsScheduling(false)
-#ifdef MOZ_B2G_RIL
-  , mSupportsMSB(false)
-  , mSupportsMSA(false)
-  , mRilDataServiceId(0)
-  , mNumberOfRilServices(1)
-  , mObservingNetworkConnStateChange(false)
-#endif
   , mObservingSettingsChange(false)
   , mSupportsSingleShot(false)
   , mSupportsTimeInjection(false)
   , mGpsInterface(nullptr)
 {
 }
 
 GonkGPSGeolocationProvider::~GonkGPSGeolocationProvider()
@@ -459,76 +347,16 @@ GonkGPSGeolocationProvider::GetGPSInterf
   const GpsInterface* result = gps_device->get_gps_interface(gps_device);
 
   if (result->size != sizeof(GpsInterface)) {
     return nullptr;
   }
   return result;
 }
 
-#ifdef MOZ_B2G_RIL
-int32_t
-GonkGPSGeolocationProvider::GetDataConnectionState()
-{
-  if (!mRadioInterface) {
-    return nsINetworkInfo::NETWORK_STATE_UNKNOWN;
-  }
-
-  int32_t state;
-  mRadioInterface->GetDataCallStateByType(
-    nsINetworkInfo::NETWORK_TYPE_MOBILE_SUPL, &state);
-  return state;
-}
-
-void
-GonkGPSGeolocationProvider::SetAGpsDataConn(nsAString& aApn)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(mAGpsInterface);
-
-  bool hasUpdateNetworkAvailability = false;
-  if (mAGpsRilInterface &&
-      mAGpsRilInterface->size >= sizeof(AGpsRilInterface) &&
-      mAGpsRilInterface->update_network_availability) {
-    hasUpdateNetworkAvailability = true;
-  }
-
-  int32_t connectionState = GetDataConnectionState();
-  NS_ConvertUTF16toUTF8 apn(aApn);
-  if (connectionState == nsINetworkInfo::NETWORK_STATE_CONNECTED) {
-    // The definition of availability is
-    // 1. The device is connected to the home network
-    // 2. The device is connected to a foreign network and data
-    //    roaming is enabled
-    // RIL turns on/off data connection automatically when the data
-    // roaming setting changes.
-    if (hasUpdateNetworkAvailability) {
-      mAGpsRilInterface->update_network_availability(true, apn.get());
-    }
-#ifdef AGPS_HAVE_DUAL_APN
-    mAGpsInterface->data_conn_open(AGPS_TYPE_SUPL,
-                                   apn.get(),
-                                   AGPS_APN_BEARER_IPV4);
-#else
-    mAGpsInterface->data_conn_open(apn.get());
-#endif
-  } else if (connectionState == nsINetworkInfo::NETWORK_STATE_DISCONNECTED) {
-    if (hasUpdateNetworkAvailability) {
-      mAGpsRilInterface->update_network_availability(false, apn.get());
-    }
-#ifdef AGPS_HAVE_DUAL_APN
-    mAGpsInterface->data_conn_closed(AGPS_TYPE_SUPL);
-#else
-    mAGpsInterface->data_conn_closed();
-#endif
-  }
-}
-
-#endif // MOZ_B2G_RIL
-
 void
 GonkGPSGeolocationProvider::RequestSettingValue(const char* aKey)
 {
   MOZ_ASSERT(aKey);
   nsCOMPtr<nsISettingsService> ss = do_GetService("@mozilla.org/settingsService;1");
   if (!ss) {
     MOZ_ASSERT(ss);
     return;
@@ -543,209 +371,16 @@ GonkGPSGeolocationProvider::RequestSetti
 
   rv = lock->Get(aKey, this);
   if (NS_FAILED(rv)) {
     ERR("error while get setting '%s': %d\n", aKey, uint32_t(rv));
     return;
   }
 }
 
-#ifdef MOZ_B2G_RIL
-void
-GonkGPSGeolocationProvider::RequestDataConnection()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!mRadioInterface) {
-    return;
-  }
-
-  if (GetDataConnectionState() == nsINetworkInfo::NETWORK_STATE_CONNECTED) {
-    // Connection is already established, we don't need to setup again.
-    // We just get supl APN and make AGPS data connection state updated.
-    RequestSettingValue("ril.supl.apn");
-  } else {
-    mRadioInterface->SetupDataCallByType(nsINetworkInfo::NETWORK_TYPE_MOBILE_SUPL);
-  }
-}
-
-void
-GonkGPSGeolocationProvider::ReleaseDataConnection()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!mRadioInterface) {
-    return;
-  }
-
-  mRadioInterface->DeactivateDataCallByType(nsINetworkInfo::NETWORK_TYPE_MOBILE_SUPL);
-}
-
-void
-GonkGPSGeolocationProvider::RequestSetID(uint32_t flags)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!mRadioInterface ||
-      !mAGpsInterface) {
-    return;
-  }
-
-  AGpsSetIDType type = AGPS_SETID_TYPE_NONE;
-
-  nsCOMPtr<nsIIccService> iccService =
-    do_GetService(ICC_SERVICE_CONTRACTID);
-  NS_ENSURE_TRUE_VOID(iccService);
-
-  nsCOMPtr<nsIIcc> icc;
-  iccService->GetIccByServiceId(mRilDataServiceId, getter_AddRefs(icc));
-  NS_ENSURE_TRUE_VOID(icc);
-
-  nsAutoString id;
-
-  if (flags & AGPS_RIL_REQUEST_SETID_IMSI) {
-    type = AGPS_SETID_TYPE_IMSI;
-    icc->GetImsi(id);
-  }
-
-  if (flags & AGPS_RIL_REQUEST_SETID_MSISDN) {
-    nsCOMPtr<nsIIccInfo> iccInfo;
-    icc->GetIccInfo(getter_AddRefs(iccInfo));
-    if (iccInfo) {
-      nsCOMPtr<nsIGsmIccInfo> gsmIccInfo = do_QueryInterface(iccInfo);
-      if (gsmIccInfo) {
-        type = AGPS_SETID_TYPE_MSISDN;
-        gsmIccInfo->GetMsisdn(id);
-      }
-    }
-  }
-
-  NS_ConvertUTF16toUTF8 idBytes(id);
-  mAGpsRilInterface->set_set_id(type, idBytes.get());
-}
-
-namespace {
-int
-ConvertToGpsRefLocationType(const nsAString& aConnectionType)
-{
-  const char* GSM_TYPES[] = { "gsm", "gprs", "edge" };
-  const char* UMTS_TYPES[] = { "umts", "hspda", "hsupa", "hspa", "hspa+" };
-
-  for (auto type: GSM_TYPES) {
-    if (aConnectionType.EqualsASCII(type)) {
-        return AGPS_REF_LOCATION_TYPE_GSM_CELLID;
-    }
-  }
-
-  for (auto type: UMTS_TYPES) {
-    if (aConnectionType.EqualsASCII(type)) {
-      return AGPS_REF_LOCATION_TYPE_UMTS_CELLID;
-    }
-  }
-
-  if (gDebug_isLoggingEnabled) {
-    DBG("geo: Unsupported connection type %s\n",
-        NS_ConvertUTF16toUTF8(aConnectionType).get());
-  }
-  return AGPS_REF_LOCATION_TYPE_GSM_CELLID;
-}
-} // namespace
-
-void
-GonkGPSGeolocationProvider::SetReferenceLocation()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!mRadioInterface ||
-      !mAGpsRilInterface) {
-    return;
-  }
-
-  AGpsRefLocation location;
-
-  nsCOMPtr<nsIMobileConnectionService> service =
-    do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
-  if (!service) {
-    NS_WARNING("Cannot get MobileConnectionService");
-    return;
-  }
-
-  nsCOMPtr<nsIMobileConnection> connection;
-  service->GetItemByServiceId(mRilDataServiceId, getter_AddRefs(connection));
-  NS_ENSURE_TRUE_VOID(connection);
-
-  nsCOMPtr<nsIMobileConnectionInfo> voice;
-  connection->GetVoice(getter_AddRefs(voice));
-  if (voice) {
-    nsAutoString connectionType;
-    nsresult rv = voice->GetType(connectionType);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return;
-    }
-    location.type = ConvertToGpsRefLocationType(connectionType);
-
-    nsCOMPtr<nsIMobileNetworkInfo> networkInfo;
-    voice->GetNetwork(getter_AddRefs(networkInfo));
-    if (networkInfo) {
-      nsresult result;
-      nsAutoString mcc, mnc;
-
-      networkInfo->GetMcc(mcc);
-      networkInfo->GetMnc(mnc);
-
-      location.u.cellID.mcc = mcc.ToInteger(&result);
-      if (result != NS_OK) {
-        NS_WARNING("Cannot parse mcc to integer");
-        location.u.cellID.mcc = 0;
-      }
-
-      location.u.cellID.mnc = mnc.ToInteger(&result);
-      if (result != NS_OK) {
-        NS_WARNING("Cannot parse mnc to integer");
-        location.u.cellID.mnc = 0;
-      }
-    } else {
-      NS_WARNING("Cannot get mobile network info.");
-      location.u.cellID.mcc = 0;
-      location.u.cellID.mnc = 0;
-    }
-
-    nsCOMPtr<nsIMobileCellInfo> cell;
-    voice->GetCell(getter_AddRefs(cell));
-    if (cell) {
-      int32_t lac;
-      int64_t cid;
-
-      cell->GetGsmLocationAreaCode(&lac);
-      // The valid range of LAC is 0x0 to 0xffff which is defined in
-      // hardware/ril/include/telephony/ril.h
-      if (lac >= 0x0 && lac <= 0xffff) {
-        location.u.cellID.lac = lac;
-      }
-
-      cell->GetGsmCellId(&cid);
-      // The valid range of cell id is 0x0 to 0xffffffff which is defined in
-      // hardware/ril/include/telephony/ril.h
-      if (cid >= 0x0 && cid <= 0xffffffff) {
-        location.u.cellID.cid = cid;
-      }
-    } else {
-      NS_WARNING("Cannot get mobile gell info.");
-      location.u.cellID.lac = -1;
-      location.u.cellID.cid = -1;
-    }
-  } else {
-    NS_WARNING("Cannot get mobile connection info.");
-    return;
-  }
-  mAGpsRilInterface->set_ref_location(&location, sizeof(location));
-}
-
-#endif // MOZ_B2G_RIL
-
 void
 GonkGPSGeolocationProvider::InjectLocation(double latitude,
                                            double longitude,
                                            float accuracy)
 {
   if (gDebug_isLoggingEnabled) {
     DBG("injecting location (%f, %f) accuracy: %f", latitude, longitude, accuracy);
   }
@@ -779,125 +414,50 @@ GonkGPSGeolocationProvider::Init()
     mCallbacks.acquire_wakelock_cb = AcquireWakelockCallback;
     mCallbacks.release_wakelock_cb = ReleaseWakelockCallback;
     mCallbacks.create_thread_cb = CreateThreadCallback;
 
 #ifdef GPS_CAPABILITY_ON_DEMAND_TIME
     mCallbacks.request_utc_time_cb = RequestUtcTimeCallback;
 #endif
 
-#ifdef MOZ_B2G_RIL
-    mAGPSCallbacks.status_cb = AGPSStatusCallback;
-    mAGPSCallbacks.create_thread_cb = CreateThreadCallback;
-
-    mAGPSRILCallbacks.request_setid = AGPSRILSetIDCallback;
-    mAGPSRILCallbacks.request_refloc = AGPSRILRefLocCallback;
-    mAGPSRILCallbacks.create_thread_cb = CreateThreadCallback;
-#endif
   }
 
   if (mGpsInterface->init(&mCallbacks) != 0) {
     return;
   }
 
-#ifdef MOZ_B2G_RIL
-  mAGpsInterface =
-    static_cast<const AGpsInterface*>(mGpsInterface->get_extension(AGPS_INTERFACE));
-  if (mAGpsInterface) {
-    mAGpsInterface->init(&mAGPSCallbacks);
-  }
-
-  mAGpsRilInterface =
-    static_cast<const AGpsRilInterface*>(mGpsInterface->get_extension(AGPS_RIL_INTERFACE));
-  if (mAGpsRilInterface) {
-    mAGpsRilInterface->init(&mAGPSRILCallbacks);
-  }
-#endif
-
   NS_DispatchToMainThread(NewRunnableMethod(this, &GonkGPSGeolocationProvider::StartGPS));
 }
 
 void
 GonkGPSGeolocationProvider::StartGPS()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mGpsInterface);
 
   int32_t update = Preferences::GetInt("geo.default.update", kDefaultPeriod);
 
-#ifdef MOZ_B2G_RIL
-  if (mSupportsMSA || mSupportsMSB) {
-    SetupAGPS();
-  }
-#endif
-
   int positionMode = GPS_POSITION_MODE_STANDALONE;
 
-#ifdef MOZ_B2G_RIL
-  bool singleShot = false;
-
-  // XXX: If we know this is a single shot request, use MSA can be faster.
-  if (singleShot && mSupportsMSA) {
-    positionMode = GPS_POSITION_MODE_MS_ASSISTED;
-  } else if (mSupportsMSB) {
-    positionMode = GPS_POSITION_MODE_MS_BASED;
-  }
-#endif
   if (!mSupportsScheduling) {
     update = kDefaultPeriod;
   }
 
   mGpsInterface->set_position_mode(positionMode,
                                    GPS_POSITION_RECURRENCE_PERIODIC,
                                    update, 0, 0);
 #if FLUSH_AIDE_DATA
   // Delete cached data
   mGpsInterface->delete_aiding_data(GPS_DELETE_ALL);
 #endif
 
   mGpsInterface->start();
 }
 
-#ifdef MOZ_B2G_RIL
-void
-GonkGPSGeolocationProvider::SetupAGPS()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(mAGpsInterface);
-
-  const nsAdoptingCString& suplServer = Preferences::GetCString("geo.gps.supl_server");
-  int32_t suplPort = Preferences::GetInt("geo.gps.supl_port", -1);
-  if (!suplServer.IsEmpty() && suplPort > 0) {
-    mAGpsInterface->set_server(AGPS_TYPE_SUPL, suplServer.get(), suplPort);
-  } else {
-    NS_WARNING("Cannot get SUPL server settings");
-    return;
-  }
-
-  // Request RIL date service ID for correct RadioInterface object first due to
-  // multi-SIM case needs it to handle AGPS related stuffs. For single SIM, 0
-  // will be returned as default RIL data service ID.
-  RequestSettingValue(kSettingRilDefaultServiceId);
-}
-
-void
-GonkGPSGeolocationProvider::UpdateRadioInterface()
-{
-  nsCOMPtr<nsIRadioInterfaceLayer> ril = do_GetService("@mozilla.org/ril;1");
-  NS_ENSURE_TRUE_VOID(ril);
-  ril->GetRadioInterface(mRilDataServiceId, getter_AddRefs(mRadioInterface));
-}
-
-bool
-GonkGPSGeolocationProvider::IsValidRilServiceId(uint32_t aServiceId)
-{
-  return aServiceId < mNumberOfRilServices;
-}
-#endif // MOZ_B2G_RIL
-
 
 NS_IMPL_ISUPPORTS(GonkGPSGeolocationProvider::NetworkLocationUpdate,
                   nsIGeolocationUpdate)
 
 NS_IMETHODIMP
 GonkGPSGeolocationProvider::NetworkLocationUpdate::Update(nsIDOMGeoPosition *position)
 {
   RefPtr<GonkGPSGeolocationProvider> provider =
@@ -1008,19 +568,16 @@ GonkGPSGeolocationProvider::Startup()
     nsresult rv = mNetworkLocationProvider->Startup();
     if (NS_SUCCEEDED(rv)) {
       RefPtr<NetworkLocationUpdate> update = new NetworkLocationUpdate();
       mNetworkLocationProvider->Watch(update);
     }
   }
 
   mStarted = true;
-#ifdef MOZ_B2G_RIL
-  mNumberOfRilServices = Preferences::GetUint(kPrefRilNumRadioInterfaces, 1);
-#endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
 GonkGPSGeolocationProvider::Watch(nsIGeolocationUpdate* aCallback)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
@@ -1041,24 +598,16 @@ GonkGPSGeolocationProvider::Shutdown()
   if (mNetworkLocationProvider) {
     mNetworkLocationProvider->Shutdown();
     mNetworkLocationProvider = nullptr;
   }
 
   nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
   if (obs) {
     nsresult rv;
-#ifdef MOZ_B2G_RIL
-    rv = obs->RemoveObserver(this, kNetworkConnStateChangedTopic);
-    if (NS_FAILED(rv)) {
-      NS_WARNING("geo: Gonk GPS network state RemoveObserver failed");
-    } else {
-      mObservingNetworkConnStateChange = false;
-    }
-#endif
     rv = obs->RemoveObserver(this, kMozSettingsChangedTopic);
     if (NS_FAILED(rv)) {
       NS_WARNING("geo: Gonk GPS mozsettings RemoveObserver failed");
     } else {
       mObservingSettingsChange = false;
     }
   }
 
@@ -1110,69 +659,16 @@ ConvertToGpsNetworkType(int aNetworkInte
 
 NS_IMETHODIMP
 GonkGPSGeolocationProvider::Observe(nsISupports* aSubject,
                                     const char* aTopic,
                                     const char16_t* aData)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-#ifdef MOZ_B2G_RIL
-  if (!strcmp(aTopic, kNetworkConnStateChangedTopic)) {
-    nsCOMPtr<nsINetworkInfo> info = do_QueryInterface(aSubject);
-    if (!info) {
-      return NS_OK;
-    }
-    nsCOMPtr<nsIRilNetworkInfo> rilInfo = do_QueryInterface(aSubject);
-    if (mAGpsRilInterface && mAGpsRilInterface->update_network_state) {
-      int32_t state;
-      int32_t type;
-      info->GetState(&state);
-      info->GetType(&type);
-      bool connected = (state == nsINetworkInfo::NETWORK_STATE_CONNECTED);
-      bool roaming = false;
-      int gpsNetworkType = ConvertToGpsNetworkType(type);
-      if (gpsNetworkType >= 0) {
-        if (rilInfo) {
-          do {
-            nsCOMPtr<nsIMobileConnectionService> service =
-              do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
-            if (!service) {
-              break;
-            }
-
-            nsCOMPtr<nsIMobileConnection> connection;
-            service->GetItemByServiceId(mRilDataServiceId, getter_AddRefs(connection));
-            if (!connection) {
-              break;
-            }
-
-            nsCOMPtr<nsIMobileConnectionInfo> voice;
-            connection->GetVoice(getter_AddRefs(voice));
-            if (voice) {
-              voice->GetRoaming(&roaming);
-            }
-          } while (0);
-        }
-        mAGpsRilInterface->update_network_state(
-          connected,
-          gpsNetworkType,
-          roaming,
-          /* extra_info = */ nullptr);
-      }
-    }
-    // No data connection
-    if (!rilInfo) {
-      return NS_OK;
-    }
-
-    RequestSettingValue("ril.supl.apn");
-  }
-#endif
-
   if (!strcmp(aTopic, kMozSettingsChangedTopic)) {
     // Read changed setting value
     RootedDictionary<SettingChangeNotification> setting(RootingCx());
     if (!WrappedJSToDictionary(aSubject, setting)) {
       return NS_OK;
     }
 
     if (setting.mKey.EqualsASCII(kSettingDebugGpsIgnored)) {
@@ -1184,83 +680,27 @@ GonkGPSGeolocationProvider::Observe(nsIS
       }
       return NS_OK;
     } else if (setting.mKey.EqualsASCII(kSettingDebugEnabled)) {
       LOG("received mozsettings-changed: logging\n");
       gDebug_isLoggingEnabled =
         setting.mValue.isBoolean() ? setting.mValue.toBoolean() : false;
       return NS_OK;
     }
-#ifdef MOZ_B2G_RIL
-    else if (setting.mKey.EqualsASCII(kSettingRilDefaultServiceId)) {
-      if (!setting.mValue.isNumber() ||
-          !IsValidRilServiceId(setting.mValue.toNumber())) {
-        return NS_ERROR_UNEXPECTED;
-      }
-
-      mRilDataServiceId = setting.mValue.toNumber();
-      UpdateRadioInterface();
-      return NS_OK;
-    }
-#endif
   }
 
   return NS_OK;
 }
 
 /** nsISettingsServiceCallback **/
 
 NS_IMETHODIMP
 GonkGPSGeolocationProvider::Handle(const nsAString& aName,
                                    JS::Handle<JS::Value> aResult)
 {
-#ifdef MOZ_B2G_RIL
-  if (aName.EqualsLiteral("ril.supl.apn")) {
-    // When we get the APN, we attempt to call data_call_open of AGPS.
-    if (aResult.isString()) {
-      JSContext *cx = nsContentUtils::GetCurrentJSContext();
-      NS_ENSURE_TRUE(cx, NS_OK);
-
-      // NB: No need to enter a compartment to read the contents of a string.
-      nsAutoJSString apn;
-      if (!apn.init(cx, aResult.toString())) {
-        return NS_ERROR_FAILURE;
-      }
-      if (!apn.IsEmpty()) {
-        SetAGpsDataConn(apn);
-      }
-    }
-  } else if (aName.EqualsASCII(kSettingRilDefaultServiceId)) {
-    uint32_t id = 0;
-    JSContext *cx = nsContentUtils::GetCurrentJSContext();
-    NS_ENSURE_TRUE(cx, NS_OK);
-    if (!JS::ToUint32(cx, aResult, &id)) {
-      return NS_ERROR_FAILURE;
-    }
-
-    if (!IsValidRilServiceId(id)) {
-      return NS_ERROR_UNEXPECTED;
-    }
-
-    mRilDataServiceId = id;
-    UpdateRadioInterface();
-
-    MOZ_ASSERT(!mObservingNetworkConnStateChange);
-
-    // Now we know which service ID to deal with, observe necessary topic then
-    nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
-    NS_ENSURE_TRUE(obs, NS_OK);
-
-    if (NS_FAILED(obs->AddObserver(this, kNetworkConnStateChangedTopic, false))) {
-      NS_WARNING("Failed to add network state changed observer!");
-    } else {
-      mObservingNetworkConnStateChange = true;
-    }
-  }
-#endif // MOZ_B2G_RIL
   return NS_OK;
 }
 
 NS_IMETHODIMP
 GonkGPSGeolocationProvider::HandleError(const nsAString& aErrorMessage)
 {
   return NS_OK;
 }
--- a/dom/system/gonk/GonkGPSGeolocationProvider.h
+++ b/dom/system/gonk/GonkGPSGeolocationProvider.h
@@ -17,19 +17,16 @@
 #ifndef GonkGPSGeolocationProvider_h
 #define GonkGPSGeolocationProvider_h
 
 #include <hardware/gps.h> // for GpsInterface
 #include "nsCOMPtr.h"
 #include "nsIGeolocationProvider.h"
 #include "nsIObserver.h"
 #include "nsIDOMGeoPosition.h"
-#ifdef MOZ_B2G_RIL
-#include "nsIRadioInterfaceLayer.h"
-#endif
 #include "nsISettingsService.h"
 
 class nsIThread;
 
 #define GONK_GPS_GEOLOCATION_PROVIDER_CID \
 { 0x48525ec5, 0x5a7f, 0x490a, { 0x92, 0x77, 0xba, 0x66, 0xe0, 0xd2, 0x2c, 0x8b } }
 
 #define GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID \
@@ -59,72 +56,37 @@ private:
   static void StatusCallback(GpsStatus* status);
   static void SvStatusCallback(GpsSvStatus* sv_info);
   static void NmeaCallback(GpsUtcTime timestamp, const char* nmea, int length);
   static void SetCapabilitiesCallback(uint32_t capabilities);
   static void AcquireWakelockCallback();
   static void ReleaseWakelockCallback();
   static pthread_t CreateThreadCallback(const char* name, void (*start)(void*), void* arg);
   static void RequestUtcTimeCallback();
-#ifdef MOZ_B2G_RIL
-  static void AGPSStatusCallback(AGpsStatus* status);
-  static void AGPSRILSetIDCallback(uint32_t flags);
-  static void AGPSRILRefLocCallback(uint32_t flags);
-#endif
 
   static GpsCallbacks mCallbacks;
-#ifdef MOZ_B2G_RIL
-  static AGpsCallbacks mAGPSCallbacks;
-  static AGpsRilCallbacks mAGPSRILCallbacks;
-#endif
 
   void Init();
   void StartGPS();
   void ShutdownGPS();
   void InjectLocation(double latitude, double longitude, float accuracy);
   void RequestSettingValue(const char* aKey);
-#ifdef MOZ_B2G_RIL
-  void UpdateRadioInterface();
-  bool IsValidRilServiceId(uint32_t aServiceId);
-  void SetupAGPS();
-  int32_t GetDataConnectionState();
-  void SetAGpsDataConn(nsAString& aApn);
-  void RequestDataConnection();
-  void ReleaseDataConnection();
-  void RequestSetID(uint32_t flags);
-  void SetReferenceLocation();
-#endif
 
   const GpsInterface* GetGPSInterface();
 
   static GonkGPSGeolocationProvider* sSingleton;
 
   bool mStarted;
 
   bool mSupportsScheduling;
-#ifdef MOZ_B2G_RIL
-  bool mSupportsMSB;
-  bool mSupportsMSA;
-  uint32_t mRilDataServiceId;
-  // mNumberOfRilServices indicates how many SIM slots supported on device, and
-  // RadioInterfaceLayer.js takes responsibility to set up the corresponding
-  // preference value.
-  uint32_t mNumberOfRilServices;
-  bool mObservingNetworkConnStateChange;
-#endif
   bool mObservingSettingsChange;
   bool mSupportsSingleShot;
   bool mSupportsTimeInjection;
 
   const GpsInterface* mGpsInterface;
-#ifdef MOZ_B2G_RIL
-  const AGpsInterface* mAGpsInterface;
-  const AGpsRilInterface* mAGpsRilInterface;
-  nsCOMPtr<nsIRadioInterface> mRadioInterface;
-#endif
   nsCOMPtr<nsIGeolocationUpdate> mLocationCallback;
   nsCOMPtr<nsIThread> mInitThread;
   nsCOMPtr<nsIGeolocationProvider> mNetworkLocationProvider;
   nsCOMPtr<nsIDOMGeoPosition> mLastGPSPosition;
 
   class NetworkLocationUpdate : public nsIGeolocationUpdate
   {
     public:
--- a/dom/system/gonk/SystemWorkerManager.cpp
+++ b/dom/system/gonk/SystemWorkerManager.cpp
@@ -23,19 +23,16 @@
 #include "nsIXPConnect.h"
 
 #include "jsfriendapi.h"
 #include "mozilla/dom/workers/Workers.h"
 #include "AutoMounter.h"
 #include "TimeZoneSettingObserver.h"
 #include "AudioManager.h"
 #include "mozilla/dom/ScriptSettings.h"
-#ifdef MOZ_B2G_RIL
-#include "mozilla/ipc/Ril.h"
-#endif
 #include "mozilla/ipc/KeyStore.h"
 #include "nsIObserverService.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "WifiWorker.h"
 #include "mozilla/Services.h"
 
 USING_WORKERS_NAMESPACE
@@ -110,20 +107,16 @@ void
 SystemWorkerManager::Shutdown()
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
   mShutdown = true;
 
   ShutdownAutoMounter();
 
-#ifdef MOZ_B2G_RIL
-  RilWorker::Shutdown();
-#endif
-
   nsCOMPtr<nsIWifi> wifi(do_QueryInterface(mWifiWorker));
   if (wifi) {
     wifi->Shutdown();
     wifi = nullptr;
   }
   mWifiWorker = nullptr;
 
   if (mKeyStore) {
@@ -179,32 +172,17 @@ SystemWorkerManager::GetInterface(const 
   return NS_ERROR_NO_INTERFACE;
 }
 
 nsresult
 SystemWorkerManager::RegisterRilWorker(unsigned int aClientId,
                                        JS::Handle<JS::Value> aWorker,
                                        JSContext *aCx)
 {
-#ifndef MOZ_B2G_RIL
   return NS_ERROR_NOT_IMPLEMENTED;
-#else
-  NS_ENSURE_TRUE(aWorker.isObject(), NS_ERROR_UNEXPECTED);
-
-  JSAutoCompartment ac(aCx, &aWorker.toObject());
-
-  WorkerCrossThreadDispatcher *wctd =
-    GetWorkerCrossThreadDispatcher(aCx, aWorker);
-  if (!wctd) {
-    NS_WARNING("Failed to GetWorkerCrossThreadDispatcher for ril");
-    return NS_ERROR_FAILURE;
-  }
-
-  return RilWorker::Register(aClientId, wctd);
-#endif // MOZ_B2G_RIL
 }
 
 nsresult
 SystemWorkerManager::InitWifi()
 {
   nsCOMPtr<nsIWorkerHolder> worker = do_CreateInstance(kWifiWorkerCID);
   NS_ENSURE_TRUE(worker, NS_ERROR_FAILURE);
 
--- a/dom/system/gonk/moz.build
+++ b/dom/system/gonk/moz.build
@@ -84,53 +84,16 @@ EXTRA_COMPONENTS += [
     'NetworkService.manifest',
     'TetheringService.js',
     'TetheringService.manifest',
 ]
 EXTRA_JS_MODULES += [
     'systemlibs.js',
 ]
 
-if CONFIG['MOZ_B2G_RIL']:
-    EXPORTS += [
-         'mozstumbler/MozStumbler.h',
-    ]
-    UNIFIED_SOURCES += [
-          'mozstumbler/MozStumbler.cpp',
-          'mozstumbler/StumblerLogging.cpp',
-          'mozstumbler/UploadStumbleRunnable.cpp',
-          'mozstumbler/WriteStumbleOnThread.cpp'
-    ]
-    XPIDL_SOURCES += [
-        'nsIDataCallInterfaceService.idl',
-        'nsIDataCallManager.idl',
-        'nsIGonkDataCallInterfaceService.idl',
-        'nsIRadioInterfaceLayer.idl',
-    ]
-    EXTRA_COMPONENTS += [
-        'DataCallManager.js',
-        'DataCallManager.manifest',
-        'RILSystemMessengerHelper.js',
-        'RILSystemMessengerHelper.manifest',
-    ]
-    EXTRA_JS_MODULES += [
-        'ril_consts.js',
-        'ril_worker.js',
-        'ril_worker_buf_object.js',
-        'ril_worker_telephony_request_queue.js',
-        'RILSystemMessenger.jsm',
-    ]
-    if not CONFIG['DISABLE_MOZ_RIL_GEOLOC']:
-        EXTRA_COMPONENTS += [
-            'DataCallInterfaceService.js',
-            'DataCallInterfaceService.manifest',
-            'RadioInterfaceLayer.js',
-            'RadioInterfaceLayer.manifest',
-        ]
-
 include('/ipc/chromium/chromium-config.mozbuild')
 
 DEFINES['HAVE_ANDROID_OS'] = True
 
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/bluetooth/common',
     '/dom/geolocation',
--- a/ipc/moz.build
+++ b/ipc/moz.build
@@ -6,23 +6,20 @@
 
 DIRS += [
     'chromium',
     'glue',
     'ipdl',
     'testshell',
 ]
 
-if CONFIG['MOZ_B2G_RIL']:
-    DIRS += ['ril']
-
 if CONFIG['MOZ_ENABLE_DBUS']:
     DIRS += ['dbus']
 
-if CONFIG['MOZ_B2G_RIL'] or CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     DIRS += ['unixfd', 'unixsocket']
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     DIRS += ['hal', 'keystore', 'netd']
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
     DIRS += ['contentproc']
 
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5026,23 +5026,16 @@ pref("dom.forms.inputmode", false);
 pref("dom.forms.inputmode", true);
 #endif
 
 // InputMethods for soft keyboards in B2G
 pref("dom.mozInputMethod.enabled", false);
 
 pref("dom.flyweb.enabled", false);
 
-// ICC API
-#ifdef MOZ_B2G_RIL
-pref("dom.icc.enabled", true);
-#else
-pref("dom.icc.enabled", false);
-#endif
-
 // Enable mapped array buffer by default.
 pref("dom.mapped_arraybuffer.enabled", true);
 
 // The tables used for Safebrowsing phishing and malware checks.
 pref("urlclassifier.malwareTable", "goog-malware-shavar,goog-unwanted-shavar,test-malware-simple,test-unwanted-simple");
 
 #ifdef MOZILLA_OFFICIAL
 // In the official build, we are allowed to use google's private
--- a/old-configure.in
+++ b/old-configure.in
@@ -4709,33 +4709,16 @@ if test x"$MOZ_WIDGET_TOOLKIT" != x"gonk
 
     if test -n "$FXOS_SIMULATOR" ; then
         AC_DEFINE(FXOS_SIMULATOR)
         AC_SUBST(FXOS_SIMULATOR)
     fi
 fi
 
 dnl ========================================================
-dnl = Enable Radio Interface for B2G (Gonk usually)
-dnl ========================================================
-MOZ_ARG_ENABLE_BOOL(b2g-ril,
-[  --enable-b2g-ril      Set compile flags necessary for testing B2G Radio Interface Layer via network sockets ],
-    MOZ_B2G_RIL=1,
-    MOZ_B2G_RIL=,
-    MOZ_B2G_RIL=$_PLATFORM_HAVE_RIL )
-if test -n "$MOZ_B2G_RIL"; then
-    if test -n "$_PLATFORM_HAVE_RIL"; then
-        AC_DEFINE(MOZ_B2G_RIL)
-    else
-        AC_MSG_ERROR([b2g-ril cannot be enabled because target platform doesn't support it.])
-    fi
-fi
-AC_SUBST(MOZ_B2G_RIL)
-
-dnl ========================================================
 dnl = Enable Pico Speech Synthesis (Gonk usually)
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(synth-pico,
 [  --enable-synth-pico  Set compile flags necessary for compiling Pico Web Speech API ],
     MOZ_SYNTH_PICO=1,
     MOZ_SYNTH_PICO= )
 if test -n "$MOZ_SYNTH_PICO"; then
     AC_DEFINE(MOZ_SYNTH_PICO)