mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 814581 - Part 4/8: fix GonkGPSGeolocationProvider. r=kanru
This commit is contained in:
parent
836b77b5e8
commit
71655e9ca4
@ -322,12 +322,12 @@ GonkGPSGeolocationProvider::GetGPSInterface()
|
||||
int32_t
|
||||
GonkGPSGeolocationProvider::GetDataConnectionState()
|
||||
{
|
||||
if (!mRIL) {
|
||||
if (!mRadioInterface) {
|
||||
return nsINetworkInterface::NETWORK_STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
int32_t state;
|
||||
mRIL->GetDataCallStateByType(NS_LITERAL_STRING("supl"), &state);
|
||||
mRadioInterface->GetDataCallStateByType(NS_LITERAL_STRING("supl"), &state);
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ GonkGPSGeolocationProvider::RequestDataConnection()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mRIL) {
|
||||
if (!mRadioInterface) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -384,7 +384,7 @@ GonkGPSGeolocationProvider::RequestDataConnection()
|
||||
// We just get supl APN and make AGPS data connection state updated.
|
||||
RequestSettingValue("ril.supl.apn");
|
||||
} else {
|
||||
mRIL->SetupDataCallByType(NS_LITERAL_STRING("supl"));
|
||||
mRadioInterface->SetupDataCallByType(NS_LITERAL_STRING("supl"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -393,11 +393,11 @@ GonkGPSGeolocationProvider::ReleaseDataConnection()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mRIL) {
|
||||
if (!mRadioInterface) {
|
||||
return;
|
||||
}
|
||||
|
||||
mRIL->DeactivateDataCallByType(NS_LITERAL_STRING("supl"));
|
||||
mRadioInterface->DeactivateDataCallByType(NS_LITERAL_STRING("supl"));
|
||||
}
|
||||
|
||||
void
|
||||
@ -405,14 +405,14 @@ GonkGPSGeolocationProvider::RequestSetID(uint32_t flags)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mRIL) {
|
||||
if (!mRadioInterface) {
|
||||
return;
|
||||
}
|
||||
|
||||
AGpsSetIDType type = AGPS_SETID_TYPE_NONE;
|
||||
|
||||
nsCOMPtr<nsIRilContext> rilCtx;
|
||||
mRIL->GetRilContext(getter_AddRefs(rilCtx));
|
||||
mRadioInterface->GetRilContext(getter_AddRefs(rilCtx));
|
||||
|
||||
if (rilCtx) {
|
||||
nsAutoString id;
|
||||
@ -440,12 +440,12 @@ GonkGPSGeolocationProvider::SetReferenceLocation()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mRIL) {
|
||||
if (!mRadioInterface) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRilContext> rilCtx;
|
||||
mRIL->GetRilContext(getter_AddRefs(rilCtx));
|
||||
mRadioInterface->GetRilContext(getter_AddRefs(rilCtx));
|
||||
|
||||
AGpsRefLocation location;
|
||||
|
||||
@ -572,9 +572,14 @@ GonkGPSGeolocationProvider::SetupAGPS()
|
||||
}
|
||||
|
||||
// Setup network state listener
|
||||
mRIL = do_GetService("@mozilla.org/ril;1");
|
||||
if (mRIL) {
|
||||
mRIL->RegisterDataCallCallback(this);
|
||||
nsCOMPtr<nsIRadioInterfaceLayer> ril = do_GetService("@mozilla.org/ril;1");
|
||||
if (ril) {
|
||||
// TODO: Bug 878748 - B2G GPS: acquire correct RadioInterface instance in
|
||||
// MultiSIM configuration
|
||||
ril->GetRadioInterface(0 /* clientId */, getter_AddRefs(mRadioInterface));
|
||||
if (mRadioInterface) {
|
||||
mRadioInterface->RegisterDataCallCallback(this);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
@ -620,8 +625,8 @@ GonkGPSGeolocationProvider::Shutdown()
|
||||
}
|
||||
mStarted = false;
|
||||
|
||||
if (mRIL) {
|
||||
mRIL->UnregisterDataCallCallback(this);
|
||||
if (mRadioInterface) {
|
||||
mRadioInterface->UnregisterDataCallCallback(this);
|
||||
}
|
||||
|
||||
mInitThread->Dispatch(NS_NewRunnableMethod(this, &GonkGPSGeolocationProvider::ShutdownGPS),
|
||||
|
@ -98,7 +98,7 @@ private:
|
||||
const AGpsRilInterface* mAGpsRilInterface;
|
||||
nsCOMPtr<nsIGeolocationUpdate> mLocationCallback;
|
||||
nsCOMPtr<nsIThread> mInitThread;
|
||||
nsCOMPtr<nsIRadioInterfaceLayer> mRIL;
|
||||
nsCOMPtr<nsIRadioInterface> mRadioInterface;
|
||||
};
|
||||
|
||||
#endif /* GonkGPSGeolocationProvider_h */
|
||||
|
Loading…
Reference in New Issue
Block a user