author | Edgar Chen <echen@mozilla.com> |
Tue, 01 Jul 2014 18:46:05 +0800 | |
changeset 203337 | 40b544b38924df29e89e1fb015f25aefb43f1b4c |
parent 203336 | 3b97cf01b88a5f1be7e1c1ed682834663a3f4e14 |
child 203338 | 580e30e552d4fbc189748aa6d68478bd12589a6e |
push id | 48665 |
push user | ryanvm@gmail.com |
push date | Wed, 03 Sep 2014 20:40:15 +0000 |
treeherder | mozilla-inbound@0da762e6868a [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | kchen |
bugs | 843452 |
milestone | 35.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/system/gonk/GonkGPSGeolocationProvider.cpp +++ b/dom/system/gonk/GonkGPSGeolocationProvider.cpp @@ -31,16 +31,17 @@ #include "nsPrintfCString.h" #include "nsServiceManagerUtils.h" #include "nsThreadUtils.h" #include "prtime.h" #ifdef MOZ_B2G_RIL #include "nsIDOMIccInfo.h" #include "nsIMobileConnectionInfo.h" +#include "nsIMobileConnectionService.h" #include "nsIMobileCellInfo.h" #include "nsIRadioInterfaceLayer.h" #endif #define SETTING_DEBUG_ENABLED "geolocation.debugging.enabled" #ifdef AGPS_TYPE_INVALID #define AGPS_HAVE_DUAL_APN @@ -504,18 +505,28 @@ GonkGPSGeolocationProvider::SetReference } location.u.cellID.mnc = mnc.ToInteger(&result); if (result != NS_OK) { NS_WARNING("Cannot parse mnc to integer"); location.u.cellID.mnc = 0; } } + + nsCOMPtr<nsIMobileConnectionService> service = + do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID); + if (!service) { + NS_WARNING("Cannot get MobileConnectionService"); + return; + } + nsCOMPtr<nsIMobileConnectionInfo> voice; - rilCtx->GetVoice(getter_AddRefs(voice)); + // TODO: Bug 878748 - B2G GPS: acquire correct RadioInterface instance in + // MultiSIM configuration + service->GetVoiceConnectionInfo(0 /* Client Id */, getter_AddRefs(voice)); if (voice) { nsCOMPtr<nsIMobileCellInfo> cell; voice->GetCell(getter_AddRefs(cell)); if (cell) { int32_t lac; int64_t cid; cell->GetGsmLocationAreaCode(&lac); @@ -915,25 +926,25 @@ GonkGPSGeolocationProvider::Observe(nsIS int32_t state; int32_t type; iface->GetState(&state); iface->GetType(&type); bool connected = (state == nsINetworkInterface::NETWORK_STATE_CONNECTED); bool roaming = false; int gpsNetworkType = ConvertToGpsNetworkType(type); if (gpsNetworkType >= 0) { - if (rilface && mRadioInterface) { - nsCOMPtr<nsIRilContext> rilCtx; - mRadioInterface->GetRilContext(getter_AddRefs(rilCtx)); - if (rilCtx) { - nsCOMPtr<nsIMobileConnectionInfo> voice; - rilCtx->GetVoice(getter_AddRefs(voice)); - if (voice) { - voice->GetRoaming(&roaming); - } + nsCOMPtr<nsIMobileConnectionService> service = + do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID); + if (rilface && service) { + nsCOMPtr<nsIMobileConnectionInfo> voice; + // TODO: Bug 878748 - B2G GPS: acquire correct RadioInterface instance in + // MultiSIM configuration + service->GetVoiceConnectionInfo(0 /* Client Id */, getter_AddRefs(voice)); + if (voice) { + voice->GetRoaming(&roaming); } } mAGpsRilInterface->update_network_state( connected, gpsNetworkType, roaming, /* extra_info = */ nullptr); }