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
|
int32_t
|
||||||
GonkGPSGeolocationProvider::GetDataConnectionState()
|
GonkGPSGeolocationProvider::GetDataConnectionState()
|
||||||
{
|
{
|
||||||
if (!mRIL) {
|
if (!mRadioInterface) {
|
||||||
return nsINetworkInterface::NETWORK_STATE_UNKNOWN;
|
return nsINetworkInterface::NETWORK_STATE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t state;
|
int32_t state;
|
||||||
mRIL->GetDataCallStateByType(NS_LITERAL_STRING("supl"), &state);
|
mRadioInterface->GetDataCallStateByType(NS_LITERAL_STRING("supl"), &state);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ GonkGPSGeolocationProvider::RequestDataConnection()
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
if (!mRIL) {
|
if (!mRadioInterface) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ GonkGPSGeolocationProvider::RequestDataConnection()
|
|||||||
// We just get supl APN and make AGPS data connection state updated.
|
// We just get supl APN and make AGPS data connection state updated.
|
||||||
RequestSettingValue("ril.supl.apn");
|
RequestSettingValue("ril.supl.apn");
|
||||||
} else {
|
} else {
|
||||||
mRIL->SetupDataCallByType(NS_LITERAL_STRING("supl"));
|
mRadioInterface->SetupDataCallByType(NS_LITERAL_STRING("supl"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,11 +393,11 @@ GonkGPSGeolocationProvider::ReleaseDataConnection()
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
if (!mRIL) {
|
if (!mRadioInterface) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mRIL->DeactivateDataCallByType(NS_LITERAL_STRING("supl"));
|
mRadioInterface->DeactivateDataCallByType(NS_LITERAL_STRING("supl"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -405,14 +405,14 @@ GonkGPSGeolocationProvider::RequestSetID(uint32_t flags)
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
if (!mRIL) {
|
if (!mRadioInterface) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AGpsSetIDType type = AGPS_SETID_TYPE_NONE;
|
AGpsSetIDType type = AGPS_SETID_TYPE_NONE;
|
||||||
|
|
||||||
nsCOMPtr<nsIRilContext> rilCtx;
|
nsCOMPtr<nsIRilContext> rilCtx;
|
||||||
mRIL->GetRilContext(getter_AddRefs(rilCtx));
|
mRadioInterface->GetRilContext(getter_AddRefs(rilCtx));
|
||||||
|
|
||||||
if (rilCtx) {
|
if (rilCtx) {
|
||||||
nsAutoString id;
|
nsAutoString id;
|
||||||
@ -440,12 +440,12 @@ GonkGPSGeolocationProvider::SetReferenceLocation()
|
|||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
if (!mRIL) {
|
if (!mRadioInterface) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIRilContext> rilCtx;
|
nsCOMPtr<nsIRilContext> rilCtx;
|
||||||
mRIL->GetRilContext(getter_AddRefs(rilCtx));
|
mRadioInterface->GetRilContext(getter_AddRefs(rilCtx));
|
||||||
|
|
||||||
AGpsRefLocation location;
|
AGpsRefLocation location;
|
||||||
|
|
||||||
@ -572,9 +572,14 @@ GonkGPSGeolocationProvider::SetupAGPS()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup network state listener
|
// Setup network state listener
|
||||||
mRIL = do_GetService("@mozilla.org/ril;1");
|
nsCOMPtr<nsIRadioInterfaceLayer> ril = do_GetService("@mozilla.org/ril;1");
|
||||||
if (mRIL) {
|
if (ril) {
|
||||||
mRIL->RegisterDataCallCallback(this);
|
// 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;
|
return;
|
||||||
@ -620,8 +625,8 @@ GonkGPSGeolocationProvider::Shutdown()
|
|||||||
}
|
}
|
||||||
mStarted = false;
|
mStarted = false;
|
||||||
|
|
||||||
if (mRIL) {
|
if (mRadioInterface) {
|
||||||
mRIL->UnregisterDataCallCallback(this);
|
mRadioInterface->UnregisterDataCallCallback(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
mInitThread->Dispatch(NS_NewRunnableMethod(this, &GonkGPSGeolocationProvider::ShutdownGPS),
|
mInitThread->Dispatch(NS_NewRunnableMethod(this, &GonkGPSGeolocationProvider::ShutdownGPS),
|
||||||
|
@ -98,7 +98,7 @@ private:
|
|||||||
const AGpsRilInterface* mAGpsRilInterface;
|
const AGpsRilInterface* mAGpsRilInterface;
|
||||||
nsCOMPtr<nsIGeolocationUpdate> mLocationCallback;
|
nsCOMPtr<nsIGeolocationUpdate> mLocationCallback;
|
||||||
nsCOMPtr<nsIThread> mInitThread;
|
nsCOMPtr<nsIThread> mInitThread;
|
||||||
nsCOMPtr<nsIRadioInterfaceLayer> mRIL;
|
nsCOMPtr<nsIRadioInterface> mRadioInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* GonkGPSGeolocationProvider_h */
|
#endif /* GonkGPSGeolocationProvider_h */
|
||||||
|
Loading…
Reference in New Issue
Block a user