From 4831beb8e34c473ad613ed636936ee7abd3dec8f Mon Sep 17 00:00:00 2001 From: Bevis Tseng Date: Thu, 15 Jan 2015 18:22:08 +0800 Subject: [PATCH] Bug 1114935 - Part 6.3: Migration in Bluetooth. r=btian --- dom/bluetooth/BluetoothRilListener.cpp | 17 ++++++++++------- dom/bluetooth/BluetoothRilListener.h | 2 +- .../bluedroid/hfp/BluetoothHfpManager.cpp | 13 ++++++++----- dom/bluetooth/bluez/BluetoothHfpManager.cpp | 13 ++++++++----- dom/bluetooth2/BluetoothRilListener.cpp | 17 ++++++++++------- dom/bluetooth2/BluetoothRilListener.h | 2 +- .../bluedroid/hfp/BluetoothHfpManager.cpp | 13 ++++++++----- dom/bluetooth2/bluez/BluetoothHfpManager.cpp | 13 ++++++++----- 8 files changed, 54 insertions(+), 36 deletions(-) diff --git a/dom/bluetooth/BluetoothRilListener.cpp b/dom/bluetooth/BluetoothRilListener.cpp index cfade813bfb..716c6b4f634 100644 --- a/dom/bluetooth/BluetoothRilListener.cpp +++ b/dom/bluetooth/BluetoothRilListener.cpp @@ -7,12 +7,11 @@ #include "BluetoothRilListener.h" #include "BluetoothHfpManager.h" -#include "nsIIccProvider.h" +#include "nsIIccService.h" #include "nsIMobileConnectionInfo.h" #include "nsIMobileConnectionService.h" #include "nsITelephonyCallInfo.h" #include "nsITelephonyService.h" -#include "nsRadioInterfaceLayer.h" // For NS_RILCONTENTHELPER_CONTRACTID. #include "nsServiceManagerUtils.h" #include "nsString.h" @@ -60,15 +59,19 @@ IccListener::Listen(bool aStart) { NS_ENSURE_TRUE(mOwner, false); - nsCOMPtr provider = - do_GetService(NS_RILCONTENTHELPER_CONTRACTID); - NS_ENSURE_TRUE(provider, false); + nsCOMPtr service = + do_GetService(ICC_SERVICE_CONTRACTID); + NS_ENSURE_TRUE(service, false); + + nsCOMPtr icc; + service->GetIccByServiceId(mOwner->mClientId, getter_AddRefs(icc)); + NS_ENSURE_TRUE(icc, false); nsresult rv; if (aStart) { - rv = provider->RegisterIccMsg(mOwner->mClientId, this); + rv = icc->RegisterListener(this); } else { - rv = provider->UnregisterIccMsg(mOwner->mClientId, this); + rv = icc->UnregisterListener(this); } return NS_SUCCEEDED(rv); diff --git a/dom/bluetooth/BluetoothRilListener.h b/dom/bluetooth/BluetoothRilListener.h index 76d6cb83895..3fae176bfb1 100644 --- a/dom/bluetooth/BluetoothRilListener.h +++ b/dom/bluetooth/BluetoothRilListener.h @@ -11,7 +11,7 @@ #include "nsAutoPtr.h" -#include "nsIIccProvider.h" +#include "nsIIccService.h" #include "nsIMobileConnectionService.h" #include "nsITelephonyCallInfo.h" #include "nsITelephonyService.h" diff --git a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp index 1121c070492..f066dc9843d 100644 --- a/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp +++ b/dom/bluetooth/bluedroid/hfp/BluetoothHfpManager.cpp @@ -17,14 +17,13 @@ #include "nsContentUtils.h" #include "nsIAudioManager.h" #include "nsIIccInfo.h" -#include "nsIIccProvider.h" +#include "nsIIccService.h" #include "nsIMobileConnectionInfo.h" #include "nsIMobileConnectionService.h" #include "nsIMobileNetworkInfo.h" #include "nsIObserverService.h" #include "nsISettingsService.h" #include "nsITelephonyService.h" -#include "nsRadioInterfaceLayer.h" #include "nsServiceManagerUtils.h" #include "nsThreadUtils.h" #include "mozilla/dom/BindingUtils.h" @@ -725,12 +724,16 @@ BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId) void BluetoothHfpManager::HandleIccInfoChanged(uint32_t aClientId) { - nsCOMPtr icc = - do_GetService(NS_RILCONTENTHELPER_CONTRACTID); + nsCOMPtr service = + do_GetService(ICC_SERVICE_CONTRACTID); + NS_ENSURE_TRUE_VOID(service); + + nsCOMPtr icc; + service->GetIccByServiceId(aClientId, getter_AddRefs(icc)); NS_ENSURE_TRUE_VOID(icc); nsCOMPtr iccInfo; - icc->GetIccInfo(aClientId, getter_AddRefs(iccInfo)); + icc->GetIccInfo(getter_AddRefs(iccInfo)); NS_ENSURE_TRUE_VOID(iccInfo); nsCOMPtr gsmIccInfo = do_QueryInterface(iccInfo); diff --git a/dom/bluetooth/bluez/BluetoothHfpManager.cpp b/dom/bluetooth/bluez/BluetoothHfpManager.cpp index cf0323cfdb0..3c2ac425759 100644 --- a/dom/bluetooth/bluez/BluetoothHfpManager.cpp +++ b/dom/bluetooth/bluez/BluetoothHfpManager.cpp @@ -28,12 +28,11 @@ #ifdef MOZ_B2G_RIL #include "nsIIccInfo.h" -#include "nsIIccProvider.h" +#include "nsIIccService.h" #include "nsIMobileConnectionInfo.h" #include "nsIMobileConnectionService.h" #include "nsIMobileNetworkInfo.h" #include "nsITelephonyService.h" -#include "nsRadioInterfaceLayer.h" #endif /** @@ -664,12 +663,16 @@ BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId) void BluetoothHfpManager::HandleIccInfoChanged(uint32_t aClientId) { - nsCOMPtr icc = - do_GetService(NS_RILCONTENTHELPER_CONTRACTID); + nsCOMPtr service = + do_GetService(ICC_SERVICE_CONTRACTID); + NS_ENSURE_TRUE_VOID(service); + + nsCOMPtr icc; + service->GetIccByServiceId(aClientId, getter_AddRefs(icc)); NS_ENSURE_TRUE_VOID(icc); nsCOMPtr iccInfo; - icc->GetIccInfo(aClientId, getter_AddRefs(iccInfo)); + icc->GetIccInfo(getter_AddRefs(iccInfo)); NS_ENSURE_TRUE_VOID(iccInfo); nsCOMPtr gsmIccInfo = do_QueryInterface(iccInfo); diff --git a/dom/bluetooth2/BluetoothRilListener.cpp b/dom/bluetooth2/BluetoothRilListener.cpp index f6237480ecf..a13f1520c26 100644 --- a/dom/bluetooth2/BluetoothRilListener.cpp +++ b/dom/bluetooth2/BluetoothRilListener.cpp @@ -7,11 +7,10 @@ #include "BluetoothRilListener.h" #include "BluetoothHfpManager.h" -#include "nsIIccProvider.h" +#include "nsIIccService.h" #include "nsIMobileConnectionInfo.h" #include "nsIMobileConnectionService.h" #include "nsITelephonyService.h" -#include "nsRadioInterfaceLayer.h" // For NS_RILCONTENTHELPER_CONTRACTID. #include "nsServiceManagerUtils.h" #include "nsString.h" @@ -59,15 +58,19 @@ IccListener::Listen(bool aStart) { NS_ENSURE_TRUE(mOwner, false); - nsCOMPtr provider = - do_GetService(NS_RILCONTENTHELPER_CONTRACTID); - NS_ENSURE_TRUE(provider, false); + nsCOMPtr service = + do_GetService(ICC_SERVICE_CONTRACTID); + NS_ENSURE_TRUE(service, false); + + nsCOMPtr icc; + service->GetIccByServiceId(mOwner->mClientId, getter_AddRefs(icc)); + NS_ENSURE_TRUE(icc, false); nsresult rv; if (aStart) { - rv = provider->RegisterIccMsg(mOwner->mClientId, this); + rv = icc->RegisterListener(this); } else { - rv = provider->UnregisterIccMsg(mOwner->mClientId, this); + rv = icc->UnregisterListener(this); } return NS_SUCCEEDED(rv); diff --git a/dom/bluetooth2/BluetoothRilListener.h b/dom/bluetooth2/BluetoothRilListener.h index 11ce91173c4..1768528d686 100644 --- a/dom/bluetooth2/BluetoothRilListener.h +++ b/dom/bluetooth2/BluetoothRilListener.h @@ -11,7 +11,7 @@ #include "nsAutoPtr.h" -#include "nsIIccProvider.h" +#include "nsIIccService.h" #include "nsIMobileConnectionService.h" #include "nsITelephonyCallInfo.h" #include "nsITelephonyService.h" diff --git a/dom/bluetooth2/bluedroid/hfp/BluetoothHfpManager.cpp b/dom/bluetooth2/bluedroid/hfp/BluetoothHfpManager.cpp index 73afc71d8af..56065fd2954 100644 --- a/dom/bluetooth2/bluedroid/hfp/BluetoothHfpManager.cpp +++ b/dom/bluetooth2/bluedroid/hfp/BluetoothHfpManager.cpp @@ -17,14 +17,13 @@ #include "nsContentUtils.h" #include "nsIAudioManager.h" #include "nsIIccInfo.h" -#include "nsIIccProvider.h" +#include "nsIIccService.h" #include "nsIMobileConnectionInfo.h" #include "nsIMobileConnectionService.h" #include "nsIMobileNetworkInfo.h" #include "nsIObserverService.h" #include "nsISettingsService.h" #include "nsITelephonyService.h" -#include "nsRadioInterfaceLayer.h" #include "nsServiceManagerUtils.h" #include "nsThreadUtils.h" #include "mozilla/dom/BindingUtils.h" @@ -710,12 +709,16 @@ BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId) void BluetoothHfpManager::HandleIccInfoChanged(uint32_t aClientId) { - nsCOMPtr icc = - do_GetService(NS_RILCONTENTHELPER_CONTRACTID); + nsCOMPtr service = + do_GetService(ICC_SERVICE_CONTRACTID); + NS_ENSURE_TRUE_VOID(service); + + nsCOMPtr icc; + service->GetIccByServiceId(aClientId, getter_AddRefs(icc)); NS_ENSURE_TRUE_VOID(icc); nsCOMPtr iccInfo; - icc->GetIccInfo(aClientId, getter_AddRefs(iccInfo)); + icc->GetIccInfo(getter_AddRefs(iccInfo)); NS_ENSURE_TRUE_VOID(iccInfo); nsCOMPtr gsmIccInfo = do_QueryInterface(iccInfo); diff --git a/dom/bluetooth2/bluez/BluetoothHfpManager.cpp b/dom/bluetooth2/bluez/BluetoothHfpManager.cpp index fea26b99b94..e531f44f4e0 100644 --- a/dom/bluetooth2/bluez/BluetoothHfpManager.cpp +++ b/dom/bluetooth2/bluez/BluetoothHfpManager.cpp @@ -28,12 +28,11 @@ #ifdef MOZ_B2G_RIL #include "nsIIccInfo.h" -#include "nsIIccProvider.h" +#include "nsIIccService.h" #include "nsIMobileConnectionInfo.h" #include "nsIMobileConnectionService.h" #include "nsIMobileNetworkInfo.h" #include "nsITelephonyService.h" -#include "nsRadioInterfaceLayer.h" #endif /** @@ -664,12 +663,16 @@ BluetoothHfpManager::HandleVoiceConnectionChanged(uint32_t aClientId) void BluetoothHfpManager::HandleIccInfoChanged(uint32_t aClientId) { - nsCOMPtr icc = - do_GetService(NS_RILCONTENTHELPER_CONTRACTID); + nsCOMPtr service = + do_GetService(ICC_SERVICE_CONTRACTID); + NS_ENSURE_TRUE_VOID(service); + + nsCOMPtr icc; + service->GetIccByServiceId(aClientId, getter_AddRefs(icc)); NS_ENSURE_TRUE_VOID(icc); nsCOMPtr iccInfo; - icc->GetIccInfo(aClientId, getter_AddRefs(iccInfo)); + icc->GetIccInfo(getter_AddRefs(iccInfo)); NS_ENSURE_TRUE_VOID(iccInfo); nsCOMPtr gsmIccInfo = do_QueryInterface(iccInfo);