Bug 927320 - 1/2: rename TelephonyProvider to TelephonyService. r=aknow

--HG--
rename : dom/telephony/gonk/TelephonyProvider.js => dom/telephony/gonk/TelephonyService.js
rename : dom/telephony/gonk/TelephonyProvider.manifest => dom/telephony/gonk/TelephonyService.manifest
rename : dom/telephony/ipc/TelephonyIPCProvider.cpp => dom/telephony/ipc/TelephonyIPCService.cpp
rename : dom/telephony/ipc/TelephonyIPCProvider.h => dom/telephony/ipc/TelephonyIPCService.h
rename : dom/telephony/nsIGonkTelephonyProvider.idl => dom/telephony/nsIGonkTelephonyService.idl
rename : dom/telephony/nsITelephonyProvider.idl => dom/telephony/nsITelephonyService.idl
This commit is contained in:
Vicamo Yang 2014-06-03 22:15:25 +08:00
Родитель ee64a6b05f
Коммит cff89f3dbc
30 изменённых файлов: 418 добавлений и 418 удалений

Просмотреть файл

@ -430,8 +430,8 @@
@BINPATH@/components/RadioInterfaceLayer.js
@BINPATH@/components/RadioInterfaceLayer.manifest
@BINPATH@/components/RILContentHelper.js
@BINPATH@/components/TelephonyProvider.js
@BINPATH@/components/TelephonyProvider.manifest
@BINPATH@/components/TelephonyService.js
@BINPATH@/components/TelephonyService.manifest
#endif // MOZ_WIDGET_GONK && MOZ_B2G_RIL
#ifndef MOZ_WIDGET_GONK

Просмотреть файл

@ -229,7 +229,7 @@ TelephonyListener::NotifyError(uint32_t aServiceId,
// instead of CallStateChanged(). We need to reset the call array state
// via setting CALL_STATE_DISCONNECTED
hfp->HandleCallStateChanged(aCallIndex,
nsITelephonyProvider::CALL_STATE_DISCONNECTED,
nsITelephonyService::CALL_STATE_DISCONNECTED,
aError, EmptyString(), false, false, true);
BT_WARNING("Reset the call state due to call transition ends abnormally");
}
@ -283,8 +283,8 @@ TelephonyListener::NotifyCdmaCallWaiting(uint32_t aServiceId,
bool
TelephonyListener::Listen(bool aStart)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, false);
nsresult rv;
@ -394,8 +394,8 @@ BluetoothRilListener::ServiceChanged(uint32_t aClientId, bool aRegistered)
void
BluetoothRilListener::EnumerateCalls()
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE_VOID(provider);
nsCOMPtr<nsITelephonyListener> listener(

Просмотреть файл

@ -13,7 +13,7 @@
#include "nsIIccProvider.h"
#include "nsIMobileConnectionProvider.h"
#include "nsITelephonyProvider.h"
#include "nsITelephonyService.h"
BEGIN_BLUETOOTH_NAMESPACE

Просмотреть файл

@ -23,7 +23,7 @@
#include "nsIMobileNetworkInfo.h"
#include "nsIObserverService.h"
#include "nsISettingsService.h"
#include "nsITelephonyProvider.h"
#include "nsITelephonyService.h"
#include "nsRadioInterfaceLayer.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
@ -336,7 +336,7 @@ Call::Set(const nsAString& aNumber, const bool aIsOutgoing)
void
Call::Reset()
{
mState = nsITelephonyProvider::CALL_STATE_DISCONNECTED;
mState = nsITelephonyService::CALL_STATE_DISCONNECTED;
mDirection = BTHF_CALL_DIRECTION_OUTGOING;
mNumber.Truncate();
mType = BTHF_CALL_ADDRTYPE_UNKNOWN;
@ -345,7 +345,7 @@ Call::Reset()
bool
Call::IsActive()
{
return (mState == nsITelephonyProvider::CALL_STATE_CONNECTED);
return (mState == nsITelephonyService::CALL_STATE_CONNECTED);
}
/**
@ -674,8 +674,8 @@ BluetoothHfpManager::ProcessAtCind()
{
NS_ENSURE_TRUE_VOID(sBluetoothHfpInterface);
int numActive = GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_CONNECTED);
int numHeld = GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_HELD);
int numActive = GetNumberOfCalls(nsITelephonyService::CALL_STATE_CONNECTED);
int numHeld = GetNumberOfCalls(nsITelephonyService::CALL_STATE_HELD);
bt_status_t status = sBluetoothHfpInterface->cind_response(
mService,
@ -730,10 +730,10 @@ void
BluetoothHfpManager::ProcessKeyPressed()
{
bool hasActiveCall =
(FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED) > 0);
(FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED) > 0);
// Refer to AOSP HeadsetStateMachine.processKeyPressed
if (FindFirstCall(nsITelephonyProvider::CALL_STATE_INCOMING)
if (FindFirstCall(nsITelephonyService::CALL_STATE_INCOMING)
&& !hasActiveCall) {
/**
* Bluetooth HSP spec 4.2.2
@ -975,7 +975,7 @@ void
BluetoothHfpManager::SendCLCC(Call& aCall, int aIndex)
{
NS_ENSURE_TRUE_VOID(aCall.mState !=
nsITelephonyProvider::CALL_STATE_DISCONNECTED);
nsITelephonyService::CALL_STATE_DISCONNECTED);
NS_ENSURE_TRUE_VOID(sBluetoothHfpInterface);
bthf_call_state_t callState = ConvertToBthfCallState(aCall.mState);
@ -986,7 +986,7 @@ BluetoothHfpManager::SendCLCC(Call& aCall, int aIndex)
}
if (callState == BTHF_CALL_STATE_INCOMING &&
FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED)) {
FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED)) {
callState = BTHF_CALL_STATE_WAITING;
}
@ -1022,8 +1022,8 @@ BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex)
{
NS_ENSURE_TRUE_VOID(sBluetoothHfpInterface);
int numActive = GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_CONNECTED);
int numHeld = GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_HELD);
int numActive = GetNumberOfCalls(nsITelephonyService::CALL_STATE_CONNECTED);
int numHeld = GetNumberOfCalls(nsITelephonyService::CALL_STATE_HELD);
bthf_call_state_t callSetupState =
ConvertToBthfCallState(GetCallSetupState());
nsAutoCString number =
@ -1088,16 +1088,16 @@ BluetoothHfpManager::GetCallSetupState()
for (uint32_t i = 1; i < callLength; ++i) {
switch (mCurrentCallArray[i].mState) {
case nsITelephonyProvider::CALL_STATE_INCOMING:
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyProvider::CALL_STATE_ALERTING:
case nsITelephonyService::CALL_STATE_INCOMING:
case nsITelephonyService::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_ALERTING:
return mCurrentCallArray[i].mState;
default:
break;
}
}
return nsITelephonyProvider::CALL_STATE_DISCONNECTED;
return nsITelephonyService::CALL_STATE_DISCONNECTED;
}
bthf_call_state_t
@ -1106,15 +1106,15 @@ BluetoothHfpManager::ConvertToBthfCallState(int aCallState)
bthf_call_state_t state;
// Refer to AOSP BluetoothPhoneService.convertCallState
if (aCallState == nsITelephonyProvider::CALL_STATE_INCOMING) {
if (aCallState == nsITelephonyService::CALL_STATE_INCOMING) {
state = BTHF_CALL_STATE_INCOMING;
} else if (aCallState == nsITelephonyProvider::CALL_STATE_DIALING) {
} else if (aCallState == nsITelephonyService::CALL_STATE_DIALING) {
state = BTHF_CALL_STATE_DIALING;
} else if (aCallState == nsITelephonyProvider::CALL_STATE_ALERTING) {
} else if (aCallState == nsITelephonyService::CALL_STATE_ALERTING) {
state = BTHF_CALL_STATE_ALERTING;
} else if (aCallState == nsITelephonyProvider::CALL_STATE_CONNECTED) {
} else if (aCallState == nsITelephonyService::CALL_STATE_CONNECTED) {
state = BTHF_CALL_STATE_ACTIVE;
} else if (aCallState == nsITelephonyProvider::CALL_STATE_HELD) {
} else if (aCallState == nsITelephonyService::CALL_STATE_HELD) {
state = BTHF_CALL_STATE_HELD;
} else { // disconnected
state = BTHF_CALL_STATE_IDLE;
@ -1137,11 +1137,11 @@ BluetoothHfpManager::IsTransitionState(uint16_t aCallState, bool aIsConference)
*/
if (!aIsConference) {
switch (aCallState) {
case nsITelephonyProvider::CALL_STATE_CONNECTED:
case nsITelephonyService::CALL_STATE_CONNECTED:
return (GetNumberOfCalls(aCallState) > 1);
case nsITelephonyProvider::CALL_STATE_HELD:
case nsITelephonyService::CALL_STATE_HELD:
return (GetNumberOfCalls(aCallState) > 1 ||
FindFirstCall(nsITelephonyProvider::CALL_STATE_INCOMING));
FindFirstCall(nsITelephonyService::CALL_STATE_INCOMING));
default:
break;
}
@ -1188,17 +1188,17 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
}
switch (aCallState) {
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_DIALING:
// We've send Dialer a dialing request and this is the response.
if (!mDialingRequestProcessed) {
SendResponse(BTHF_AT_RESPONSE_OK);
mDialingRequestProcessed = true;
}
break;
case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
case nsITelephonyService::CALL_STATE_DISCONNECTED:
// -1 is necessary because call 0 is an invalid (padding) call object.
if (mCurrentCallArray.Length() - 1 ==
GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_DISCONNECTED)) {
GetNumberOfCalls(nsITelephonyService::CALL_STATE_DISCONNECTED)) {
// In order to let user hear busy tone via connected Bluetooth headset,
// we postpone the timing of dropping SCO.
if (aError.EqualsLiteral("BusyError")) {
@ -1253,7 +1253,7 @@ BluetoothHfpManager::AnswerWaitingCall()
MOZ_ASSERT(mPhoneType == PhoneType::CDMA);
// Pick up second call. First call is held now.
mCdmaSecondCall.mState = nsITelephonyProvider::CALL_STATE_CONNECTED;
mCdmaSecondCall.mState = nsITelephonyService::CALL_STATE_CONNECTED;
// FIXME: check CDMA + bluedroid
//UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, true);
@ -1280,8 +1280,8 @@ BluetoothHfpManager::ToggleCalls()
// Toggle acitve and held calls
mCdmaSecondCall.mState = (mCdmaSecondCall.IsActive()) ?
nsITelephonyProvider::CALL_STATE_HELD :
nsITelephonyProvider::CALL_STATE_CONNECTED;
nsITelephonyService::CALL_STATE_HELD :
nsITelephonyService::CALL_STATE_CONNECTED;
}
bool

Просмотреть файл

@ -30,7 +30,7 @@
#include "nsIMobileConnectionInfo.h"
#include "nsIMobileConnectionProvider.h"
#include "nsIMobileNetworkInfo.h"
#include "nsITelephonyProvider.h"
#include "nsITelephonyService.h"
#include "nsRadioInterfaceLayer.h"
#endif
@ -333,7 +333,7 @@ Call::Call()
void
Call::Reset()
{
mState = nsITelephonyProvider::CALL_STATE_DISCONNECTED;
mState = nsITelephonyService::CALL_STATE_DISCONNECTED;
mDirection = false;
mIsConference = false;
mNumber.Truncate();
@ -343,7 +343,7 @@ Call::Reset()
bool
Call::IsActive()
{
return (mState == nsITelephonyProvider::CALL_STATE_CONNECTED);
return (mState == nsITelephonyService::CALL_STATE_CONNECTED);
}
#endif // MOZ_B2G_RIL
@ -1205,7 +1205,7 @@ BluetoothHfpManager::SendCCWA(const nsAString& aNumber, int aType)
bool
BluetoothHfpManager::SendCLCC(const Call& aCall, int aIndex)
{
if (aCall.mState == nsITelephonyProvider::CALL_STATE_DISCONNECTED) {
if (aCall.mState == nsITelephonyService::CALL_STATE_DISCONNECTED) {
return true;
}
@ -1217,23 +1217,23 @@ BluetoothHfpManager::SendCLCC(const Call& aCall, int aIndex)
int status = 0;
switch (aCall.mState) {
case nsITelephonyProvider::CALL_STATE_CONNECTED:
case nsITelephonyService::CALL_STATE_CONNECTED:
if (mPhoneType == PhoneType::CDMA && aIndex == 1) {
status = (mCdmaSecondCall.IsActive()) ? 1 : 0;
}
message.AppendInt(status);
break;
case nsITelephonyProvider::CALL_STATE_HELD:
case nsITelephonyService::CALL_STATE_HELD:
message.AppendInt(1);
break;
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_DIALING:
message.AppendInt(2);
break;
case nsITelephonyProvider::CALL_STATE_ALERTING:
case nsITelephonyService::CALL_STATE_ALERTING:
message.AppendInt(3);
break;
case nsITelephonyProvider::CALL_STATE_INCOMING:
if (!FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED)) {
case nsITelephonyService::CALL_STATE_INCOMING:
if (!FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED)) {
message.AppendInt(4);
} else {
message.AppendInt(5);
@ -1457,11 +1457,11 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
nsString address;
switch (aCallState) {
case nsITelephonyProvider::CALL_STATE_HELD:
case nsITelephonyService::CALL_STATE_HELD:
switch (prevCallState) {
case nsITelephonyProvider::CALL_STATE_CONNECTED: {
uint32_t numActive = GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_CONNECTED);
uint32_t numHeld = GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_HELD);
case nsITelephonyService::CALL_STATE_CONNECTED: {
uint32_t numActive = GetNumberOfCalls(nsITelephonyService::CALL_STATE_CONNECTED);
uint32_t numHeld = GetNumberOfCalls(nsITelephonyService::CALL_STATE_HELD);
uint32_t numConCalls = GetNumberOfConCalls();
/**
@ -1489,7 +1489,7 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_ACTIVE;
}
SendCommand(RESPONSE_CIEV, CINDType::CALLHELD);
} else if (GetNumberOfConCalls(nsITelephonyProvider::CALL_STATE_HELD)
} else if (GetNumberOfConCalls(nsITelephonyService::CALL_STATE_HELD)
== numConCalls) {
if (numActive + numHeld == numConCalls) {
// An active conference call is put on hold.
@ -1502,10 +1502,10 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
}
break;
}
case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
case nsITelephonyService::CALL_STATE_DISCONNECTED:
// The call state changed from DISCONNECTED to HELD. It could happen
// when user held a call before Bluetooth got connected.
if (FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED)) {
if (FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED)) {
// callheld = ONHOLD_ACTIVE if an active call already exists.
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_ACTIVE;
SendCommand(RESPONSE_CIEV, CINDType::CALLHELD);
@ -1513,8 +1513,8 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
break;
}
break;
case nsITelephonyProvider::CALL_STATE_INCOMING:
if (FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED)) {
case nsITelephonyService::CALL_STATE_INCOMING:
if (FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED)) {
SendCCWA(aNumber, mCurrentCallArray[aCallIndex].mType);
UpdateCIND(CINDType::CALLSETUP, CallSetupState::INCOMING, aSend);
} else {
@ -1539,7 +1539,7 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
sRingInterval);
}
break;
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_DIALING:
if (!mDialingRequestProcessed) {
SendLine("OK");
mDialingRequestProcessed = true;
@ -1548,14 +1548,14 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING, aSend);
ConnectSco();
break;
case nsITelephonyProvider::CALL_STATE_ALERTING:
case nsITelephonyService::CALL_STATE_ALERTING:
UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING_ALERTING, aSend);
// If there's an ongoing call when the headset is just connected, we have
// to open a sco socket here.
ConnectSco();
break;
case nsITelephonyProvider::CALL_STATE_CONNECTED:
case nsITelephonyService::CALL_STATE_CONNECTED:
/**
* A call becomes active because:
* - user answers an incoming call,
@ -1563,32 +1563,32 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
* - SLC is connected when a call is active.
*/
switch (prevCallState) {
case nsITelephonyProvider::CALL_STATE_INCOMING:
case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
case nsITelephonyService::CALL_STATE_INCOMING:
case nsITelephonyService::CALL_STATE_DISCONNECTED:
// Incoming call, no break
sStopSendingRingFlag = true;
ConnectSco();
// NO BREAK HERE. continue to next statement
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyProvider::CALL_STATE_ALERTING:
case nsITelephonyService::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_ALERTING:
// Outgoing call
UpdateCIND(CINDType::CALL, CallState::IN_PROGRESS, aSend);
UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, aSend);
if (FindFirstCall(nsITelephonyProvider::CALL_STATE_HELD)) {
if (FindFirstCall(nsITelephonyService::CALL_STATE_HELD)) {
// callheld state = ONHOLD_ACTIVE if a held call already exists.
UpdateCIND(CINDType::CALLHELD, CallHeldState::ONHOLD_ACTIVE, aSend);
}
break;
case nsITelephonyProvider::CALL_STATE_CONNECTED:
case nsITelephonyService::CALL_STATE_CONNECTED:
// User wants to add a held call to the conversation.
// The original connected call becomes a conference call here.
if (aIsConference) {
UpdateCIND(CINDType::CALLHELD, CallHeldState::NO_CALLHELD, aSend);
}
break;
case nsITelephonyProvider::CALL_STATE_HELD:
if (!FindFirstCall(nsITelephonyProvider::CALL_STATE_HELD)) {
case nsITelephonyService::CALL_STATE_HELD:
if (!FindFirstCall(nsITelephonyService::CALL_STATE_HELD)) {
if (aIsConference && !prevCallIsConference) {
// The held call was merged and becomes a conference call.
UpdateCIND(CINDType::CALLHELD, CallHeldState::NO_CALLHELD, aSend);
@ -1604,17 +1604,17 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
BT_WARNING("Not handling state changed");
}
break;
case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
case nsITelephonyService::CALL_STATE_DISCONNECTED:
switch (prevCallState) {
case nsITelephonyProvider::CALL_STATE_INCOMING:
case nsITelephonyService::CALL_STATE_INCOMING:
// Incoming call, no break
sStopSendingRingFlag = true;
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyProvider::CALL_STATE_ALERTING:
case nsITelephonyService::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_ALERTING:
// Outgoing call
UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, aSend);
break;
case nsITelephonyProvider::CALL_STATE_CONNECTED:
case nsITelephonyService::CALL_STATE_CONNECTED:
// No call is ongoing
if (sCINDItems[CINDType::CALLHELD].value ==
CallHeldState::NO_CALLHELD) {
@ -1626,9 +1626,9 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
}
// Handle held calls separately
if (!FindFirstCall(nsITelephonyProvider::CALL_STATE_HELD)) {
if (!FindFirstCall(nsITelephonyService::CALL_STATE_HELD)) {
UpdateCIND(CINDType::CALLHELD, CallHeldState::NO_CALLHELD, aSend);
} else if (!FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED)) {
} else if (!FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED)) {
UpdateCIND(CINDType::CALLHELD, CallHeldState::ONHOLD_NOACTIVE, aSend);
} else {
UpdateCIND(CINDType::CALLHELD, CallHeldState::ONHOLD_ACTIVE, aSend);
@ -1636,7 +1636,7 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
// -1 is necessary because call 0 is an invalid (padding) call object.
if (mCurrentCallArray.Length() - 1 ==
GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_DISCONNECTED)) {
GetNumberOfCalls(nsITelephonyService::CALL_STATE_DISCONNECTED)) {
// In order to let user hear busy tone via connected Bluetooth headset,
// we postpone the timing of dropping SCO.
if (!(aError.EqualsLiteral("BusyError"))) {
@ -1699,7 +1699,7 @@ BluetoothHfpManager::AnswerWaitingCall()
MOZ_ASSERT(mPhoneType == PhoneType::CDMA);
// Pick up second call. First call is held now.
mCdmaSecondCall.mState = nsITelephonyProvider::CALL_STATE_CONNECTED;
mCdmaSecondCall.mState = nsITelephonyService::CALL_STATE_CONNECTED;
UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, true);
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_ACTIVE;
@ -1724,8 +1724,8 @@ BluetoothHfpManager::ToggleCalls()
// Toggle acitve and held calls
mCdmaSecondCall.mState = (mCdmaSecondCall.IsActive()) ?
nsITelephonyProvider::CALL_STATE_HELD :
nsITelephonyProvider::CALL_STATE_CONNECTED;
nsITelephonyService::CALL_STATE_HELD :
nsITelephonyService::CALL_STATE_CONNECTED;
}
#endif // MOZ_B2G_RIL

Просмотреть файл

@ -229,7 +229,7 @@ TelephonyListener::NotifyError(uint32_t aServiceId,
// instead of CallStateChanged(). We need to reset the call array state
// via setting CALL_STATE_DISCONNECTED
hfp->HandleCallStateChanged(aCallIndex,
nsITelephonyProvider::CALL_STATE_DISCONNECTED,
nsITelephonyService::CALL_STATE_DISCONNECTED,
aError, EmptyString(), false, false, true);
BT_WARNING("Reset the call state due to call transition ends abnormally");
}
@ -283,8 +283,8 @@ TelephonyListener::NotifyCdmaCallWaiting(uint32_t aServiceId,
bool
TelephonyListener::Listen(bool aStart)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, false);
nsresult rv;
@ -394,8 +394,8 @@ BluetoothRilListener::ServiceChanged(uint32_t aClientId, bool aRegistered)
void
BluetoothRilListener::EnumerateCalls()
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE_VOID(provider);
nsCOMPtr<nsITelephonyListener> listener(

Просмотреть файл

@ -13,7 +13,7 @@
#include "nsIIccProvider.h"
#include "nsIMobileConnectionProvider.h"
#include "nsITelephonyProvider.h"
#include "nsITelephonyService.h"
BEGIN_BLUETOOTH_NAMESPACE

Просмотреть файл

@ -23,7 +23,7 @@
#include "nsIMobileNetworkInfo.h"
#include "nsIObserverService.h"
#include "nsISettingsService.h"
#include "nsITelephonyProvider.h"
#include "nsITelephonyService.h"
#include "nsRadioInterfaceLayer.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
@ -336,7 +336,7 @@ Call::Set(const nsAString& aNumber, const bool aIsOutgoing)
void
Call::Reset()
{
mState = nsITelephonyProvider::CALL_STATE_DISCONNECTED;
mState = nsITelephonyService::CALL_STATE_DISCONNECTED;
mDirection = BTHF_CALL_DIRECTION_OUTGOING;
mNumber.Truncate();
mType = BTHF_CALL_ADDRTYPE_UNKNOWN;
@ -345,7 +345,7 @@ Call::Reset()
bool
Call::IsActive()
{
return (mState == nsITelephonyProvider::CALL_STATE_CONNECTED);
return (mState == nsITelephonyService::CALL_STATE_CONNECTED);
}
/**
@ -674,8 +674,8 @@ BluetoothHfpManager::ProcessAtCind()
{
NS_ENSURE_TRUE_VOID(sBluetoothHfpInterface);
int numActive = GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_CONNECTED);
int numHeld = GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_HELD);
int numActive = GetNumberOfCalls(nsITelephonyService::CALL_STATE_CONNECTED);
int numHeld = GetNumberOfCalls(nsITelephonyService::CALL_STATE_HELD);
bt_status_t status = sBluetoothHfpInterface->cind_response(
mService,
@ -730,10 +730,10 @@ void
BluetoothHfpManager::ProcessKeyPressed()
{
bool hasActiveCall =
(FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED) > 0);
(FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED) > 0);
// Refer to AOSP HeadsetStateMachine.processKeyPressed
if (FindFirstCall(nsITelephonyProvider::CALL_STATE_INCOMING)
if (FindFirstCall(nsITelephonyService::CALL_STATE_INCOMING)
&& !hasActiveCall) {
/**
* Bluetooth HSP spec 4.2.2
@ -975,7 +975,7 @@ void
BluetoothHfpManager::SendCLCC(Call& aCall, int aIndex)
{
NS_ENSURE_TRUE_VOID(aCall.mState !=
nsITelephonyProvider::CALL_STATE_DISCONNECTED);
nsITelephonyService::CALL_STATE_DISCONNECTED);
NS_ENSURE_TRUE_VOID(sBluetoothHfpInterface);
bthf_call_state_t callState = ConvertToBthfCallState(aCall.mState);
@ -986,7 +986,7 @@ BluetoothHfpManager::SendCLCC(Call& aCall, int aIndex)
}
if (callState == BTHF_CALL_STATE_INCOMING &&
FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED)) {
FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED)) {
callState = BTHF_CALL_STATE_WAITING;
}
@ -1022,8 +1022,8 @@ BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex)
{
NS_ENSURE_TRUE_VOID(sBluetoothHfpInterface);
int numActive = GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_CONNECTED);
int numHeld = GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_HELD);
int numActive = GetNumberOfCalls(nsITelephonyService::CALL_STATE_CONNECTED);
int numHeld = GetNumberOfCalls(nsITelephonyService::CALL_STATE_HELD);
bthf_call_state_t callSetupState =
ConvertToBthfCallState(GetCallSetupState());
nsAutoCString number =
@ -1088,16 +1088,16 @@ BluetoothHfpManager::GetCallSetupState()
for (uint32_t i = 1; i < callLength; ++i) {
switch (mCurrentCallArray[i].mState) {
case nsITelephonyProvider::CALL_STATE_INCOMING:
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyProvider::CALL_STATE_ALERTING:
case nsITelephonyService::CALL_STATE_INCOMING:
case nsITelephonyService::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_ALERTING:
return mCurrentCallArray[i].mState;
default:
break;
}
}
return nsITelephonyProvider::CALL_STATE_DISCONNECTED;
return nsITelephonyService::CALL_STATE_DISCONNECTED;
}
bthf_call_state_t
@ -1106,15 +1106,15 @@ BluetoothHfpManager::ConvertToBthfCallState(int aCallState)
bthf_call_state_t state;
// Refer to AOSP BluetoothPhoneService.convertCallState
if (aCallState == nsITelephonyProvider::CALL_STATE_INCOMING) {
if (aCallState == nsITelephonyService::CALL_STATE_INCOMING) {
state = BTHF_CALL_STATE_INCOMING;
} else if (aCallState == nsITelephonyProvider::CALL_STATE_DIALING) {
} else if (aCallState == nsITelephonyService::CALL_STATE_DIALING) {
state = BTHF_CALL_STATE_DIALING;
} else if (aCallState == nsITelephonyProvider::CALL_STATE_ALERTING) {
} else if (aCallState == nsITelephonyService::CALL_STATE_ALERTING) {
state = BTHF_CALL_STATE_ALERTING;
} else if (aCallState == nsITelephonyProvider::CALL_STATE_CONNECTED) {
} else if (aCallState == nsITelephonyService::CALL_STATE_CONNECTED) {
state = BTHF_CALL_STATE_ACTIVE;
} else if (aCallState == nsITelephonyProvider::CALL_STATE_HELD) {
} else if (aCallState == nsITelephonyService::CALL_STATE_HELD) {
state = BTHF_CALL_STATE_HELD;
} else { // disconnected
state = BTHF_CALL_STATE_IDLE;
@ -1137,11 +1137,11 @@ BluetoothHfpManager::IsTransitionState(uint16_t aCallState, bool aIsConference)
*/
if (!aIsConference) {
switch (aCallState) {
case nsITelephonyProvider::CALL_STATE_CONNECTED:
case nsITelephonyService::CALL_STATE_CONNECTED:
return (GetNumberOfCalls(aCallState) > 1);
case nsITelephonyProvider::CALL_STATE_HELD:
case nsITelephonyService::CALL_STATE_HELD:
return (GetNumberOfCalls(aCallState) > 1 ||
FindFirstCall(nsITelephonyProvider::CALL_STATE_INCOMING));
FindFirstCall(nsITelephonyService::CALL_STATE_INCOMING));
default:
break;
}
@ -1188,17 +1188,17 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
}
switch (aCallState) {
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_DIALING:
// We've send Dialer a dialing request and this is the response.
if (!mDialingRequestProcessed) {
SendResponse(BTHF_AT_RESPONSE_OK);
mDialingRequestProcessed = true;
}
break;
case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
case nsITelephonyService::CALL_STATE_DISCONNECTED:
// -1 is necessary because call 0 is an invalid (padding) call object.
if (mCurrentCallArray.Length() - 1 ==
GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_DISCONNECTED)) {
GetNumberOfCalls(nsITelephonyService::CALL_STATE_DISCONNECTED)) {
// In order to let user hear busy tone via connected Bluetooth headset,
// we postpone the timing of dropping SCO.
if (aError.Equals(NS_LITERAL_STRING("BusyError"))) {
@ -1253,7 +1253,7 @@ BluetoothHfpManager::AnswerWaitingCall()
MOZ_ASSERT(mPhoneType == PhoneType::CDMA);
// Pick up second call. First call is held now.
mCdmaSecondCall.mState = nsITelephonyProvider::CALL_STATE_CONNECTED;
mCdmaSecondCall.mState = nsITelephonyService::CALL_STATE_CONNECTED;
// FIXME: check CDMA + bluedroid
//UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, true);
@ -1280,8 +1280,8 @@ BluetoothHfpManager::ToggleCalls()
// Toggle acitve and held calls
mCdmaSecondCall.mState = (mCdmaSecondCall.IsActive()) ?
nsITelephonyProvider::CALL_STATE_HELD :
nsITelephonyProvider::CALL_STATE_CONNECTED;
nsITelephonyService::CALL_STATE_HELD :
nsITelephonyService::CALL_STATE_CONNECTED;
}
bool

Просмотреть файл

@ -30,7 +30,7 @@
#include "nsIMobileConnectionInfo.h"
#include "nsIMobileConnectionProvider.h"
#include "nsIMobileNetworkInfo.h"
#include "nsITelephonyProvider.h"
#include "nsITelephonyService.h"
#include "nsRadioInterfaceLayer.h"
#endif
@ -333,7 +333,7 @@ Call::Call()
void
Call::Reset()
{
mState = nsITelephonyProvider::CALL_STATE_DISCONNECTED;
mState = nsITelephonyService::CALL_STATE_DISCONNECTED;
mDirection = false;
mIsConference = false;
mNumber.Truncate();
@ -343,7 +343,7 @@ Call::Reset()
bool
Call::IsActive()
{
return (mState == nsITelephonyProvider::CALL_STATE_CONNECTED);
return (mState == nsITelephonyService::CALL_STATE_CONNECTED);
}
#endif // MOZ_B2G_RIL
@ -1205,7 +1205,7 @@ BluetoothHfpManager::SendCCWA(const nsAString& aNumber, int aType)
bool
BluetoothHfpManager::SendCLCC(const Call& aCall, int aIndex)
{
if (aCall.mState == nsITelephonyProvider::CALL_STATE_DISCONNECTED) {
if (aCall.mState == nsITelephonyService::CALL_STATE_DISCONNECTED) {
return true;
}
@ -1217,23 +1217,23 @@ BluetoothHfpManager::SendCLCC(const Call& aCall, int aIndex)
int status = 0;
switch (aCall.mState) {
case nsITelephonyProvider::CALL_STATE_CONNECTED:
case nsITelephonyService::CALL_STATE_CONNECTED:
if (mPhoneType == PhoneType::CDMA && aIndex == 1) {
status = (mCdmaSecondCall.IsActive()) ? 1 : 0;
}
message.AppendInt(status);
break;
case nsITelephonyProvider::CALL_STATE_HELD:
case nsITelephonyService::CALL_STATE_HELD:
message.AppendInt(1);
break;
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_DIALING:
message.AppendInt(2);
break;
case nsITelephonyProvider::CALL_STATE_ALERTING:
case nsITelephonyService::CALL_STATE_ALERTING:
message.AppendInt(3);
break;
case nsITelephonyProvider::CALL_STATE_INCOMING:
if (!FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED)) {
case nsITelephonyService::CALL_STATE_INCOMING:
if (!FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED)) {
message.AppendInt(4);
} else {
message.AppendInt(5);
@ -1457,11 +1457,11 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
nsString address;
switch (aCallState) {
case nsITelephonyProvider::CALL_STATE_HELD:
case nsITelephonyService::CALL_STATE_HELD:
switch (prevCallState) {
case nsITelephonyProvider::CALL_STATE_CONNECTED: {
uint32_t numActive = GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_CONNECTED);
uint32_t numHeld = GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_HELD);
case nsITelephonyService::CALL_STATE_CONNECTED: {
uint32_t numActive = GetNumberOfCalls(nsITelephonyService::CALL_STATE_CONNECTED);
uint32_t numHeld = GetNumberOfCalls(nsITelephonyService::CALL_STATE_HELD);
uint32_t numConCalls = GetNumberOfConCalls();
/**
@ -1489,7 +1489,7 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_ACTIVE;
}
SendCommand(RESPONSE_CIEV, CINDType::CALLHELD);
} else if (GetNumberOfConCalls(nsITelephonyProvider::CALL_STATE_HELD)
} else if (GetNumberOfConCalls(nsITelephonyService::CALL_STATE_HELD)
== numConCalls) {
if (numActive + numHeld == numConCalls) {
// An active conference call is put on hold.
@ -1502,10 +1502,10 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
}
break;
}
case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
case nsITelephonyService::CALL_STATE_DISCONNECTED:
// The call state changed from DISCONNECTED to HELD. It could happen
// when user held a call before Bluetooth got connected.
if (FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED)) {
if (FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED)) {
// callheld = ONHOLD_ACTIVE if an active call already exists.
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_ACTIVE;
SendCommand(RESPONSE_CIEV, CINDType::CALLHELD);
@ -1513,8 +1513,8 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
break;
}
break;
case nsITelephonyProvider::CALL_STATE_INCOMING:
if (FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED)) {
case nsITelephonyService::CALL_STATE_INCOMING:
if (FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED)) {
SendCCWA(aNumber, mCurrentCallArray[aCallIndex].mType);
UpdateCIND(CINDType::CALLSETUP, CallSetupState::INCOMING, aSend);
} else {
@ -1539,7 +1539,7 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
sRingInterval);
}
break;
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_DIALING:
if (!mDialingRequestProcessed) {
SendLine("OK");
mDialingRequestProcessed = true;
@ -1548,14 +1548,14 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING, aSend);
ConnectSco();
break;
case nsITelephonyProvider::CALL_STATE_ALERTING:
case nsITelephonyService::CALL_STATE_ALERTING:
UpdateCIND(CINDType::CALLSETUP, CallSetupState::OUTGOING_ALERTING, aSend);
// If there's an ongoing call when the headset is just connected, we have
// to open a sco socket here.
ConnectSco();
break;
case nsITelephonyProvider::CALL_STATE_CONNECTED:
case nsITelephonyService::CALL_STATE_CONNECTED:
/**
* A call becomes active because:
* - user answers an incoming call,
@ -1563,32 +1563,32 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
* - SLC is connected when a call is active.
*/
switch (prevCallState) {
case nsITelephonyProvider::CALL_STATE_INCOMING:
case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
case nsITelephonyService::CALL_STATE_INCOMING:
case nsITelephonyService::CALL_STATE_DISCONNECTED:
// Incoming call, no break
sStopSendingRingFlag = true;
ConnectSco();
// NO BREAK HERE. continue to next statement
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyProvider::CALL_STATE_ALERTING:
case nsITelephonyService::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_ALERTING:
// Outgoing call
UpdateCIND(CINDType::CALL, CallState::IN_PROGRESS, aSend);
UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, aSend);
if (FindFirstCall(nsITelephonyProvider::CALL_STATE_HELD)) {
if (FindFirstCall(nsITelephonyService::CALL_STATE_HELD)) {
// callheld state = ONHOLD_ACTIVE if a held call already exists.
UpdateCIND(CINDType::CALLHELD, CallHeldState::ONHOLD_ACTIVE, aSend);
}
break;
case nsITelephonyProvider::CALL_STATE_CONNECTED:
case nsITelephonyService::CALL_STATE_CONNECTED:
// User wants to add a held call to the conversation.
// The original connected call becomes a conference call here.
if (aIsConference) {
UpdateCIND(CINDType::CALLHELD, CallHeldState::NO_CALLHELD, aSend);
}
break;
case nsITelephonyProvider::CALL_STATE_HELD:
if (!FindFirstCall(nsITelephonyProvider::CALL_STATE_HELD)) {
case nsITelephonyService::CALL_STATE_HELD:
if (!FindFirstCall(nsITelephonyService::CALL_STATE_HELD)) {
if (aIsConference && !prevCallIsConference) {
// The held call was merged and becomes a conference call.
UpdateCIND(CINDType::CALLHELD, CallHeldState::NO_CALLHELD, aSend);
@ -1604,17 +1604,17 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
BT_WARNING("Not handling state changed");
}
break;
case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
case nsITelephonyService::CALL_STATE_DISCONNECTED:
switch (prevCallState) {
case nsITelephonyProvider::CALL_STATE_INCOMING:
case nsITelephonyService::CALL_STATE_INCOMING:
// Incoming call, no break
sStopSendingRingFlag = true;
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyProvider::CALL_STATE_ALERTING:
case nsITelephonyService::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_ALERTING:
// Outgoing call
UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, aSend);
break;
case nsITelephonyProvider::CALL_STATE_CONNECTED:
case nsITelephonyService::CALL_STATE_CONNECTED:
// No call is ongoing
if (sCINDItems[CINDType::CALLHELD].value ==
CallHeldState::NO_CALLHELD) {
@ -1626,9 +1626,9 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
}
// Handle held calls separately
if (!FindFirstCall(nsITelephonyProvider::CALL_STATE_HELD)) {
if (!FindFirstCall(nsITelephonyService::CALL_STATE_HELD)) {
UpdateCIND(CINDType::CALLHELD, CallHeldState::NO_CALLHELD, aSend);
} else if (!FindFirstCall(nsITelephonyProvider::CALL_STATE_CONNECTED)) {
} else if (!FindFirstCall(nsITelephonyService::CALL_STATE_CONNECTED)) {
UpdateCIND(CINDType::CALLHELD, CallHeldState::ONHOLD_NOACTIVE, aSend);
} else {
UpdateCIND(CINDType::CALLHELD, CallHeldState::ONHOLD_ACTIVE, aSend);
@ -1636,7 +1636,7 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
// -1 is necessary because call 0 is an invalid (padding) call object.
if (mCurrentCallArray.Length() - 1 ==
GetNumberOfCalls(nsITelephonyProvider::CALL_STATE_DISCONNECTED)) {
GetNumberOfCalls(nsITelephonyService::CALL_STATE_DISCONNECTED)) {
// In order to let user hear busy tone via connected Bluetooth headset,
// we postpone the timing of dropping SCO.
if (!(aError.Equals(NS_LITERAL_STRING("BusyError")))) {
@ -1699,7 +1699,7 @@ BluetoothHfpManager::AnswerWaitingCall()
MOZ_ASSERT(mPhoneType == PhoneType::CDMA);
// Pick up second call. First call is held now.
mCdmaSecondCall.mState = nsITelephonyProvider::CALL_STATE_CONNECTED;
mCdmaSecondCall.mState = nsITelephonyService::CALL_STATE_CONNECTED;
UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, true);
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_ACTIVE;
@ -1724,8 +1724,8 @@ BluetoothHfpManager::ToggleCalls()
// Toggle acitve and held calls
mCdmaSecondCall.mState = (mCdmaSecondCall.IsActive()) ?
nsITelephonyProvider::CALL_STATE_HELD :
nsITelephonyProvider::CALL_STATE_CONNECTED;
nsITelephonyService::CALL_STATE_HELD :
nsITelephonyService::CALL_STATE_CONNECTED;
}
#endif // MOZ_B2G_RIL

Просмотреть файл

@ -211,9 +211,9 @@ XPCOMUtils.defineLazyServiceGetter(this, "gSystemWorkerManager",
"@mozilla.org/telephony/system-worker-manager;1",
"nsISystemWorkerManager");
XPCOMUtils.defineLazyServiceGetter(this, "gTelephonyProvider",
"@mozilla.org/telephony/telephonyprovider;1",
"nsIGonkTelephonyProvider");
XPCOMUtils.defineLazyServiceGetter(this, "gTelephonyService",
"@mozilla.org/telephony/telephonyservice;1",
"nsIGonkTelephonyService");
XPCOMUtils.defineLazyGetter(this, "WAP", function() {
let wap = {};
@ -2063,22 +2063,22 @@ RadioInterface.prototype = {
let connHandler = gDataConnectionManager.getConnectionHandler(this.clientId);
switch (message.rilMessageType) {
case "callRing":
gTelephonyProvider.notifyCallRing();
gTelephonyService.notifyCallRing();
break;
case "callStateChange":
gTelephonyProvider.notifyCallStateChanged(this.clientId, message.call);
gTelephonyService.notifyCallStateChanged(this.clientId, message.call);
break;
case "callDisconnected":
gTelephonyProvider.notifyCallDisconnected(this.clientId, message.call);
gTelephonyService.notifyCallDisconnected(this.clientId, message.call);
break;
case "conferenceCallStateChanged":
gTelephonyProvider.notifyConferenceCallStateChanged(message.state);
gTelephonyService.notifyConferenceCallStateChanged(message.state);
break;
case "cdmaCallWaiting":
gTelephonyProvider.notifyCdmaCallWaiting(this.clientId, message.number);
gTelephonyService.notifyCdmaCallWaiting(this.clientId, message.number);
break;
case "suppSvcNotification":
gTelephonyProvider.notifySupplementaryService(this.clientId,
gTelephonyService.notifySupplementaryService(this.clientId,
message.callIndex,
message.notification);
break;

Просмотреть файл

@ -146,8 +146,8 @@ Telephony::Create(nsPIDOMWindow* aOwner, ErrorResult& aRv)
{
NS_ASSERTION(aOwner, "Null owner!");
nsCOMPtr<nsITelephonyProvider> ril =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> ril =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
if (!ril) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
@ -204,9 +204,9 @@ Telephony::IsValidServiceId(uint32_t aServiceId)
// static
bool
Telephony::IsActiveState(uint16_t aCallState) {
return aCallState == nsITelephonyProvider::CALL_STATE_DIALING ||
aCallState == nsITelephonyProvider::CALL_STATE_ALERTING ||
aCallState == nsITelephonyProvider::CALL_STATE_CONNECTED;
return aCallState == nsITelephonyService::CALL_STATE_DIALING ||
aCallState == nsITelephonyService::CALL_STATE_ALERTING ||
aCallState == nsITelephonyService::CALL_STATE_CONNECTED;
}
uint32_t
@ -226,8 +226,8 @@ Telephony::HasDialingCall()
{
for (uint32_t i = 0; i < mCalls.Length(); i++) {
const nsRefPtr<TelephonyCall>& call = mCalls[i];
if (call->CallState() > nsITelephonyProvider::CALL_STATE_UNKNOWN &&
call->CallState() < nsITelephonyProvider::CALL_STATE_CONNECTED) {
if (call->CallState() > nsITelephonyService::CALL_STATE_UNKNOWN &&
call->CallState() < nsITelephonyService::CALL_STATE_CONNECTED) {
return true;
}
}
@ -282,7 +282,7 @@ Telephony::CreateNewDialingCall(uint32_t aServiceId, const nsAString& aNumber,
{
nsRefPtr<TelephonyCall> call =
TelephonyCall::Create(this, aServiceId, aNumber,
nsITelephonyProvider::CALL_STATE_DIALING, aCallIndex);
nsITelephonyService::CALL_STATE_DIALING, aCallIndex);
NS_ASSERTION(call, "This should never fail!");
NS_ASSERTION(mCalls.Contains(call), "Should have auto-added new call!");
@ -449,7 +449,7 @@ Telephony::GetActive(Nullable<OwningTelephonyCallOrTelephonyCallGroup>& aValue)
{
if (mActiveCall) {
aValue.SetValue().SetAsTelephonyCall() = mActiveCall;
} else if (mGroup->CallState() == nsITelephonyProvider::CALL_STATE_CONNECTED) {
} else if (mGroup->CallState() == nsITelephonyService::CALL_STATE_CONNECTED) {
aValue.SetValue().SetAsTelephonyCallGroup() = mGroup;
} else {
aValue.SetNull();
@ -530,7 +530,7 @@ Telephony::CallStateChanged(uint32_t aServiceId, uint32_t aCallIndex,
// Do nothing since we didn't know anything about it before now and it's
// ended already.
if (aCallState == nsITelephonyProvider::CALL_STATE_DISCONNECTED) {
if (aCallState == nsITelephonyService::CALL_STATE_DISCONNECTED) {
return NS_OK;
}
@ -545,7 +545,7 @@ Telephony::CallStateChanged(uint32_t aServiceId, uint32_t aCallIndex,
mCalls.Contains(call),
"Should have auto-added new call!");
if (aCallState == nsITelephonyProvider::CALL_STATE_INCOMING) {
if (aCallState == nsITelephonyService::CALL_STATE_INCOMING) {
nsresult rv = DispatchCallEvent(NS_LITERAL_STRING("incoming"), call);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -620,10 +620,10 @@ Telephony::SupplementaryServiceNotification(uint32_t aServiceId,
nsresult rv;
switch (aNotification) {
case nsITelephonyProvider::NOTIFICATION_REMOTE_HELD:
case nsITelephonyService::NOTIFICATION_REMOTE_HELD:
rv = DispatchCallEvent(NS_LITERAL_STRING("remoteheld"), associatedCall);
break;
case nsITelephonyProvider::NOTIFICATION_REMOTE_RESUMED:
case nsITelephonyService::NOTIFICATION_REMOTE_RESUMED:
rv = DispatchCallEvent(NS_LITERAL_STRING("remoteresumed"), associatedCall);
break;
default:

Просмотреть файл

@ -11,7 +11,7 @@
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/telephony/TelephonyCommon.h"
#include "nsITelephonyProvider.h"
#include "nsITelephonyService.h"
// Need to include TelephonyCall.h because we have inline methods that
// assume they see the definition of TelephonyCall.
@ -29,7 +29,7 @@ class Telephony MOZ_FINAL : public DOMEventTargetHelper
/**
* Class Telephony doesn't actually inherit nsITelephonyListener.
* Instead, it owns an nsITelephonyListener derived instance mListener
* and passes it to nsITelephonyProvider. The onreceived events are first
* and passes it to nsITelephonyService. The onreceived events are first
* delivered to mListener and then forwarded to its owner, Telephony. See
* also bug 775997 comment #51.
*/
@ -41,7 +41,7 @@ class Telephony MOZ_FINAL : public DOMEventTargetHelper
class EnumerationAck;
friend class EnumerationAck;
nsCOMPtr<nsITelephonyProvider> mProvider;
nsCOMPtr<nsITelephonyService> mProvider;
nsRefPtr<Listener> mListener;
TelephonyCall* mActiveCall;
@ -130,7 +130,7 @@ public:
NotifyCallsChanged(aCall);
}
nsITelephonyProvider*
nsITelephonyService*
Provider() const
{
return mProvider;

Просмотреть файл

@ -46,7 +46,7 @@ TelephonyCall::Create(Telephony* aTelephony, uint32_t aServiceId,
TelephonyCall::TelephonyCall(nsPIDOMWindow* aOwner)
: DOMEventTargetHelper(aOwner),
mCallState(nsITelephonyProvider::CALL_STATE_UNKNOWN),
mCallState(nsITelephonyService::CALL_STATE_UNKNOWN),
mLive(false)
{
}
@ -68,34 +68,34 @@ TelephonyCall::ChangeStateInternal(uint16_t aCallState, bool aFireEvents)
nsString stateString;
switch (aCallState) {
case nsITelephonyProvider::CALL_STATE_DIALING:
case nsITelephonyService::CALL_STATE_DIALING:
stateString.AssignLiteral("dialing");
break;
case nsITelephonyProvider::CALL_STATE_ALERTING:
case nsITelephonyService::CALL_STATE_ALERTING:
stateString.AssignLiteral("alerting");
break;
case nsITelephonyProvider::CALL_STATE_CONNECTING:
case nsITelephonyService::CALL_STATE_CONNECTING:
stateString.AssignLiteral("connecting");
break;
case nsITelephonyProvider::CALL_STATE_CONNECTED:
case nsITelephonyService::CALL_STATE_CONNECTED:
stateString.AssignLiteral("connected");
break;
case nsITelephonyProvider::CALL_STATE_HOLDING:
case nsITelephonyService::CALL_STATE_HOLDING:
stateString.AssignLiteral("holding");
break;
case nsITelephonyProvider::CALL_STATE_HELD:
case nsITelephonyService::CALL_STATE_HELD:
stateString.AssignLiteral("held");
break;
case nsITelephonyProvider::CALL_STATE_RESUMING:
case nsITelephonyService::CALL_STATE_RESUMING:
stateString.AssignLiteral("resuming");
break;
case nsITelephonyProvider::CALL_STATE_DISCONNECTING:
case nsITelephonyService::CALL_STATE_DISCONNECTING:
stateString.AssignLiteral("disconnecting");
break;
case nsITelephonyProvider::CALL_STATE_DISCONNECTED:
case nsITelephonyService::CALL_STATE_DISCONNECTED:
stateString.AssignLiteral("disconnected");
break;
case nsITelephonyProvider::CALL_STATE_INCOMING:
case nsITelephonyService::CALL_STATE_INCOMING:
stateString.AssignLiteral("incoming");
break;
default:
@ -105,7 +105,7 @@ TelephonyCall::ChangeStateInternal(uint16_t aCallState, bool aFireEvents)
mState = stateString;
mCallState = aCallState;
if (aCallState == nsITelephonyProvider::CALL_STATE_DISCONNECTED) {
if (aCallState == nsITelephonyService::CALL_STATE_DISCONNECTED) {
NS_ASSERTION(mLive, "Should be live!");
mLive = false;
if (mGroup) {
@ -159,7 +159,7 @@ TelephonyCall::NotifyError(const nsAString& aError)
mError = new DOMError(GetOwner(), aError);
// Do the state transitions
ChangeStateInternal(nsITelephonyProvider::CALL_STATE_DISCONNECTED, true);
ChangeStateInternal(nsITelephonyService::CALL_STATE_DISCONNECTED, true);
nsresult rv = DispatchCallEvent(NS_LITERAL_STRING("error"), this);
if (NS_FAILED(rv)) {
@ -209,7 +209,7 @@ TelephonyCall::GetGroup() const
void
TelephonyCall::Answer(ErrorResult& aRv)
{
if (mCallState != nsITelephonyProvider::CALL_STATE_INCOMING) {
if (mCallState != nsITelephonyService::CALL_STATE_INCOMING) {
NS_WARNING("Answer on non-incoming call ignored!");
return;
}
@ -220,19 +220,19 @@ TelephonyCall::Answer(ErrorResult& aRv)
return;
}
ChangeStateInternal(nsITelephonyProvider::CALL_STATE_CONNECTING, true);
ChangeStateInternal(nsITelephonyService::CALL_STATE_CONNECTING, true);
}
void
TelephonyCall::HangUp(ErrorResult& aRv)
{
if (mCallState == nsITelephonyProvider::CALL_STATE_DISCONNECTING ||
mCallState == nsITelephonyProvider::CALL_STATE_DISCONNECTED) {
if (mCallState == nsITelephonyService::CALL_STATE_DISCONNECTING ||
mCallState == nsITelephonyService::CALL_STATE_DISCONNECTED) {
NS_WARNING("HangUp on previously disconnected call ignored!");
return;
}
nsresult rv = mCallState == nsITelephonyProvider::CALL_STATE_INCOMING ?
nsresult rv = mCallState == nsITelephonyService::CALL_STATE_INCOMING ?
mTelephony->Provider()->RejectCall(mServiceId, mCallIndex) :
mTelephony->Provider()->HangUp(mServiceId, mCallIndex);
if (NS_FAILED(rv)) {
@ -240,13 +240,13 @@ TelephonyCall::HangUp(ErrorResult& aRv)
return;
}
ChangeStateInternal(nsITelephonyProvider::CALL_STATE_DISCONNECTING, true);
ChangeStateInternal(nsITelephonyService::CALL_STATE_DISCONNECTING, true);
}
void
TelephonyCall::Hold(ErrorResult& aRv)
{
if (mCallState != nsITelephonyProvider::CALL_STATE_CONNECTED) {
if (mCallState != nsITelephonyService::CALL_STATE_CONNECTED) {
NS_WARNING("Hold non-connected call ignored!");
return;
}
@ -274,13 +274,13 @@ TelephonyCall::Hold(ErrorResult& aRv)
return;
}
ChangeStateInternal(nsITelephonyProvider::CALL_STATE_HOLDING, true);
ChangeStateInternal(nsITelephonyService::CALL_STATE_HOLDING, true);
}
void
TelephonyCall::Resume(ErrorResult& aRv)
{
if (mCallState != nsITelephonyProvider::CALL_STATE_HELD) {
if (mCallState != nsITelephonyService::CALL_STATE_HELD) {
NS_WARNING("Resume non-held call ignored!");
return;
}
@ -301,5 +301,5 @@ TelephonyCall::Resume(ErrorResult& aRv)
return;
}
ChangeStateInternal(nsITelephonyProvider::CALL_STATE_RESUMING, true);
ChangeStateInternal(nsITelephonyService::CALL_STATE_RESUMING, true);
}

Просмотреть файл

@ -17,7 +17,7 @@ using mozilla::ErrorResult;
TelephonyCallGroup::TelephonyCallGroup(nsPIDOMWindow* aOwner)
: DOMEventTargetHelper(aOwner)
, mCallState(nsITelephonyProvider::CALL_STATE_UNKNOWN)
, mCallState(nsITelephonyService::CALL_STATE_UNKNOWN)
{
}
@ -88,18 +88,18 @@ TelephonyCallGroup::ChangeState(uint16_t aCallState)
nsString stateString;
switch (aCallState) {
case nsITelephonyProvider::CALL_STATE_UNKNOWN:
case nsITelephonyService::CALL_STATE_UNKNOWN:
break;
case nsITelephonyProvider::CALL_STATE_CONNECTED:
case nsITelephonyService::CALL_STATE_CONNECTED:
stateString.AssignLiteral("connected");
break;
case nsITelephonyProvider::CALL_STATE_HOLDING:
case nsITelephonyService::CALL_STATE_HOLDING:
stateString.AssignLiteral("holding");
break;
case nsITelephonyProvider::CALL_STATE_HELD:
case nsITelephonyService::CALL_STATE_HELD:
stateString.AssignLiteral("held");
break;
case nsITelephonyProvider::CALL_STATE_RESUMING:
case nsITelephonyService::CALL_STATE_RESUMING:
stateString.AssignLiteral("resuming");
break;
default:
@ -157,13 +157,13 @@ TelephonyCallGroup::CanConference(const TelephonyCall& aCall,
if (!aSecondCall) {
MOZ_ASSERT(!mCalls.IsEmpty());
return (mCallState == nsITelephonyProvider::CALL_STATE_CONNECTED &&
aCall.CallState() == nsITelephonyProvider::CALL_STATE_HELD) ||
(mCallState == nsITelephonyProvider::CALL_STATE_HELD &&
aCall.CallState() == nsITelephonyProvider::CALL_STATE_CONNECTED);
return (mCallState == nsITelephonyService::CALL_STATE_CONNECTED &&
aCall.CallState() == nsITelephonyService::CALL_STATE_HELD) ||
(mCallState == nsITelephonyService::CALL_STATE_HELD &&
aCall.CallState() == nsITelephonyService::CALL_STATE_CONNECTED);
}
MOZ_ASSERT(mCallState == nsITelephonyProvider::CALL_STATE_UNKNOWN);
MOZ_ASSERT(mCallState == nsITelephonyService::CALL_STATE_UNKNOWN);
if (aCall.ServiceId() != aSecondCall->ServiceId()) {
return false;
@ -173,10 +173,10 @@ TelephonyCallGroup::CanConference(const TelephonyCall& aCall,
return false;
}
return (aCall.CallState() == nsITelephonyProvider::CALL_STATE_CONNECTED &&
aSecondCall->CallState() == nsITelephonyProvider::CALL_STATE_HELD) ||
(aCall.CallState() == nsITelephonyProvider::CALL_STATE_HELD &&
aSecondCall->CallState() == nsITelephonyProvider::CALL_STATE_CONNECTED);
return (aCall.CallState() == nsITelephonyService::CALL_STATE_CONNECTED &&
aSecondCall->CallState() == nsITelephonyService::CALL_STATE_HELD) ||
(aCall.CallState() == nsITelephonyService::CALL_STATE_HELD &&
aSecondCall->CallState() == nsITelephonyService::CALL_STATE_CONNECTED);
}
already_AddRefed<TelephonyCall>
@ -254,7 +254,7 @@ TelephonyCallGroup::Add(TelephonyCall& aCall,
void
TelephonyCallGroup::Remove(TelephonyCall& aCall, ErrorResult& aRv)
{
if (mCallState != nsITelephonyProvider::CALL_STATE_CONNECTED) {
if (mCallState != nsITelephonyService::CALL_STATE_CONNECTED) {
NS_WARNING("Remove call from a non-connected call group. Ignore!");
return;
}
@ -275,7 +275,7 @@ TelephonyCallGroup::Remove(TelephonyCall& aCall, ErrorResult& aRv)
void
TelephonyCallGroup::Hold(ErrorResult& aRv)
{
if (mCallState != nsITelephonyProvider::CALL_STATE_CONNECTED) {
if (mCallState != nsITelephonyService::CALL_STATE_CONNECTED) {
NS_WARNING("Hold non-connected call ignored!");
return;
}
@ -288,13 +288,13 @@ TelephonyCallGroup::Hold(ErrorResult& aRv)
return;
}
ChangeState(nsITelephonyProvider::CALL_STATE_HOLDING);
ChangeState(nsITelephonyService::CALL_STATE_HOLDING);
}
void
TelephonyCallGroup::Resume(ErrorResult& aRv)
{
if (mCallState != nsITelephonyProvider::CALL_STATE_HELD) {
if (mCallState != nsITelephonyService::CALL_STATE_HELD) {
NS_WARNING("Resume non-held call ignored!");
return;
}
@ -307,5 +307,5 @@ TelephonyCallGroup::Resume(ErrorResult& aRv)
return;
}
ChangeState(nsITelephonyProvider::CALL_STATE_RESUMING);
ChangeState(nsITelephonyService::CALL_STATE_RESUMING);
}

Просмотреть файл

@ -5,24 +5,24 @@
#include "mozilla/dom/telephony/TelephonyFactory.h"
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
#include "nsIGonkTelephonyProvider.h"
#include "nsIGonkTelephonyService.h"
#endif
#include "nsServiceManagerUtils.h"
#include "nsXULAppAPI.h"
#include "ipc/TelephonyIPCProvider.h"
#include "ipc/TelephonyIPCService.h"
USING_TELEPHONY_NAMESPACE
/* static */ already_AddRefed<nsITelephonyProvider>
TelephonyFactory::CreateTelephonyProvider()
/* static */ already_AddRefed<nsITelephonyService>
TelephonyFactory::CreateTelephonyService()
{
nsCOMPtr<nsITelephonyProvider> provider;
nsCOMPtr<nsITelephonyService> provider;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
provider = new TelephonyIPCProvider();
provider = new TelephonyIPCService();
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
} else {
provider = do_CreateInstance(GONK_TELEPHONY_PROVIDER_CONTRACTID);
provider = do_CreateInstance(GONK_TELEPHONY_SERVICE_CONTRACTID);
#endif
}

Просмотреть файл

@ -9,14 +9,14 @@
#include "nsCOMPtr.h"
#include "mozilla/dom/telephony/TelephonyCommon.h"
class nsITelephonyProvider;
class nsITelephonyService;
BEGIN_TELEPHONY_NAMESPACE
class TelephonyFactory
{
public:
static already_AddRefed<nsITelephonyProvider> CreateTelephonyProvider();
static already_AddRefed<nsITelephonyService> CreateTelephonyService();
};
END_TELEPHONY_NAMESPACE

Просмотреть файл

@ -1,2 +0,0 @@
component {67d26434-d063-4d28-9f48-5b3189788155} TelephonyProvider.js
contract @mozilla.org/telephony/gonktelephonyprovider;1 {67d26434-d063-4d28-9f48-5b3189788155}

Просмотреть файл

@ -14,9 +14,9 @@ Cu.import("resource://gre/modules/Promise.jsm");
var RIL = {};
Cu.import("resource://gre/modules/ril_consts.js", RIL);
const GONK_TELEPHONYPROVIDER_CONTRACTID =
"@mozilla.org/telephony/gonktelephonyprovider;1";
const GONK_TELEPHONYPROVIDER_CID =
const GONK_TELEPHONYSERVICE_CONTRACTID =
"@mozilla.org/telephony/gonktelephonyservice;1";
const GONK_TELEPHONYSERVICE_CID =
Components.ID("{67d26434-d063-4d28-9f48-5b3189788155}");
const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
@ -28,7 +28,7 @@ const kPrefRilDebuggingEnabled = "ril.debugging.enabled";
const kPrefDefaultServiceId = "dom.telephony.defaultServiceId";
const nsIAudioManager = Ci.nsIAudioManager;
const nsITelephonyProvider = Ci.nsITelephonyProvider;
const nsITelephonyService = Ci.nsITelephonyService;
const CALL_WAKELOCK_TIMEOUT = 5000;
@ -40,7 +40,7 @@ const DIAL_ERROR_OTHER_CONNECTION_IN_USE = "OtherConnectionInUse";
let DEBUG;
function debug(s) {
dump("TelephonyProvider: " + s + "\n");
dump("TelephonyService: " + s + "\n");
}
XPCOMUtils.defineLazyGetter(this, "gAudioManager", function getAudioManager() {
@ -115,7 +115,7 @@ ConferenceCall.prototype = {
state: null
};
function TelephonyProvider() {
function TelephonyService() {
this._numClients = gRadioInterfaceLayer.numRadioInterfaces;
this._listeners = [];
this._currentCalls = {};
@ -131,16 +131,16 @@ function TelephonyProvider() {
this._enumerateCallsForClient(i);
}
}
TelephonyProvider.prototype = {
classID: GONK_TELEPHONYPROVIDER_CID,
classInfo: XPCOMUtils.generateCI({classID: GONK_TELEPHONYPROVIDER_CID,
contractID: GONK_TELEPHONYPROVIDER_CONTRACTID,
classDescription: "TelephonyProvider",
interfaces: [Ci.nsITelephonyProvider,
Ci.nsIGonkTelephonyProvider],
TelephonyService.prototype = {
classID: GONK_TELEPHONYSERVICE_CID,
classInfo: XPCOMUtils.generateCI({classID: GONK_TELEPHONYSERVICE_CID,
contractID: GONK_TELEPHONYSERVICE_CONTRACTID,
classDescription: "TelephonyService",
interfaces: [Ci.nsITelephonyService,
Ci.nsIGonkTelephonyService],
flags: Ci.nsIClassInfo.SINGLETON}),
QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyProvider,
Ci.nsIGonkTelephonyProvider,
QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyService,
Ci.nsIGonkTelephonyService,
Ci.nsIObserver]),
// The following attributes/functions are used for acquiring/releasing the
@ -211,14 +211,14 @@ TelephonyProvider.prototype = {
*/
_activeCall: null,
_updateActiveCall: function(aCall, aConferenceState) {
if (aConferenceState === nsITelephonyProvider.CALL_STATE_CONNECTED) {
if (aConferenceState === nsITelephonyService.CALL_STATE_CONNECTED) {
this._activeCall = new ConferenceCall(aConferenceState);
this._updateCallAudioState(aCall);
return;
}
if (aConferenceState === nsITelephonyProvider.CALL_STATE_UNKNOWN ||
aConferenceState === nsITelephonyProvider.CALL_STATE_HELD) {
if (aConferenceState === nsITelephonyService.CALL_STATE_UNKNOWN ||
aConferenceState === nsITelephonyService.CALL_STATE_HELD) {
if (this._activeCall instanceof ConferenceCall) {
this._activeCall = null;
this._updateCallAudioState(aCall);
@ -238,19 +238,19 @@ TelephonyProvider.prototype = {
}
switch (aCall.state) {
case nsITelephonyProvider.CALL_STATE_DIALING: // Fall through...
case nsITelephonyProvider.CALL_STATE_ALERTING:
case nsITelephonyProvider.CALL_STATE_CONNECTED:
case nsITelephonyService.CALL_STATE_DIALING: // Fall through...
case nsITelephonyService.CALL_STATE_ALERTING:
case nsITelephonyService.CALL_STATE_CONNECTED:
this._activeCall = new SingleCall(aCall);
this._updateCallAudioState(aCall);
break;
case nsITelephonyProvider.CALL_STATE_INCOMING:
case nsITelephonyService.CALL_STATE_INCOMING:
this._updateCallAudioState(aCall);
break;
case nsITelephonyProvider.CALL_STATE_HELD: // Fall through...
case nsITelephonyProvider.CALL_STATE_DISCONNECTED:
case nsITelephonyService.CALL_STATE_HELD: // Fall through...
case nsITelephonyService.CALL_STATE_DISCONNECTED:
if (this._matchActiveSingleCall(aCall)) {
// Previously active call is not active now.
this._activeCall = null;
@ -263,7 +263,7 @@ TelephonyProvider.prototype = {
_updateCallAudioState: function(aCall) {
let active = (this._activeCall !== null);
let incoming = (aCall &&
aCall.state === nsITelephonyProvider.CALL_STATE_INCOMING);
aCall.state === nsITelephonyService.CALL_STATE_INCOMING);
if (active) {
gAudioManager.phoneState = nsIAudioManager.PHONE_STATE_IN_CALL;
@ -295,18 +295,18 @@ TelephonyProvider.prototype = {
_convertRILCallState: function(aState) {
switch (aState) {
case RIL.CALL_STATE_UNKNOWN:
return nsITelephonyProvider.CALL_STATE_UNKNOWN;
return nsITelephonyService.CALL_STATE_UNKNOWN;
case RIL.CALL_STATE_ACTIVE:
return nsITelephonyProvider.CALL_STATE_CONNECTED;
return nsITelephonyService.CALL_STATE_CONNECTED;
case RIL.CALL_STATE_HOLDING:
return nsITelephonyProvider.CALL_STATE_HELD;
return nsITelephonyService.CALL_STATE_HELD;
case RIL.CALL_STATE_DIALING:
return nsITelephonyProvider.CALL_STATE_DIALING;
return nsITelephonyService.CALL_STATE_DIALING;
case RIL.CALL_STATE_ALERTING:
return nsITelephonyProvider.CALL_STATE_ALERTING;
return nsITelephonyService.CALL_STATE_ALERTING;
case RIL.CALL_STATE_INCOMING:
case RIL.CALL_STATE_WAITING:
return nsITelephonyProvider.CALL_STATE_INCOMING;
return nsITelephonyService.CALL_STATE_INCOMING;
default:
throw new Error("Unknown rilCallState: " + aState);
}
@ -315,9 +315,9 @@ TelephonyProvider.prototype = {
_convertRILSuppSvcNotification: function(aNotification) {
switch (aNotification) {
case RIL.GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD:
return nsITelephonyProvider.NOTIFICATION_REMOTE_HELD;
return nsITelephonyService.NOTIFICATION_REMOTE_HELD;
case RIL.GECKO_SUPP_SVC_NOTIFICATION_REMOTE_RESUMED:
return nsITelephonyProvider.NOTIFICATION_REMOTE_RESUMED;
return nsITelephonyService.NOTIFICATION_REMOTE_RESUMED;
default:
if (DEBUG) {
debug("Unknown rilSuppSvcNotification: " + aNotification);
@ -367,7 +367,7 @@ TelephonyProvider.prototype = {
},
/**
* nsITelephonyProvider interface.
* nsITelephonyService interface.
*/
defaultServiceId: 0,
@ -713,7 +713,7 @@ TelephonyProvider.prototype = {
},
/**
* nsIGonkTelephonyProvider interface.
* nsIGonkTelephonyService interface.
*/
/**
@ -722,7 +722,7 @@ TelephonyProvider.prototype = {
notifyCallDisconnected: function(aClientId, aCall) {
if (DEBUG) debug("handleCallDisconnected: " + JSON.stringify(aCall));
aCall.state = nsITelephonyProvider.CALL_STATE_DISCONNECTED;
aCall.state = nsITelephonyService.CALL_STATE_DISCONNECTED;
let duration = ("started" in aCall && typeof aCall.started == "number") ?
new Date().getTime() - aCall.started : 0;
let data = {
@ -810,7 +810,7 @@ TelephonyProvider.prototype = {
aCall.state = this._convertRILCallState(aCall.state);
}
if (aCall.state == nsITelephonyProvider.CALL_STATE_DIALING) {
if (aCall.state == nsITelephonyService.CALL_STATE_DIALING) {
gSystemMessenger.broadcastMessage("telephony-new-call", {});
}
@ -899,4 +899,4 @@ TelephonyProvider.prototype = {
}
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TelephonyProvider]);
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TelephonyService]);

Просмотреть файл

@ -0,0 +1,2 @@
component {67d26434-d063-4d28-9f48-5b3189788155} TelephonyService.js
contract @mozilla.org/telephony/gonktelephonyservice;1 {67d26434-d063-4d28-9f48-5b3189788155}

Просмотреть файл

@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "TelephonyChild.h"
#include "TelephonyIPCProvider.h"
#include "TelephonyIPCService.h"
USING_TELEPHONY_NAMESPACE
@ -12,7 +12,7 @@ USING_TELEPHONY_NAMESPACE
* TelephonyChild
******************************************************************************/
TelephonyChild::TelephonyChild(TelephonyIPCProvider* aProvider)
TelephonyChild::TelephonyChild(TelephonyIPCService* aProvider)
: mProvider(aProvider)
{
MOZ_ASSERT(aProvider);

Просмотреть файл

@ -9,16 +9,16 @@
#include "mozilla/dom/telephony/TelephonyCommon.h"
#include "mozilla/dom/telephony/PTelephonyChild.h"
#include "mozilla/dom/telephony/PTelephonyRequestChild.h"
#include "nsITelephonyProvider.h"
#include "nsITelephonyService.h"
BEGIN_TELEPHONY_NAMESPACE
class TelephonyIPCProvider;
class TelephonyIPCService;
class TelephonyChild : public PTelephonyChild
{
public:
TelephonyChild(TelephonyIPCProvider* aProvider);
TelephonyChild(TelephonyIPCService* aProvider);
protected:
virtual ~TelephonyChild();
@ -57,7 +57,7 @@ protected:
const uint16_t& aNotification) MOZ_OVERRIDE;
private:
nsRefPtr<TelephonyIPCProvider> mProvider;
nsRefPtr<TelephonyIPCService> mProvider;
};
class TelephonyRequestChild : public PTelephonyRequestChild

Просмотреть файл

@ -3,7 +3,7 @@
* 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/. */
#include "TelephonyIPCProvider.h"
#include "TelephonyIPCService.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/telephony/TelephonyChild.h"
@ -36,12 +36,12 @@ getDefaultServiceId()
} // Anonymous namespace
NS_IMPL_ISUPPORTS(TelephonyIPCProvider,
nsITelephonyProvider,
NS_IMPL_ISUPPORTS(TelephonyIPCService,
nsITelephonyService,
nsITelephonyListener,
nsIObserver)
TelephonyIPCProvider::TelephonyIPCProvider()
TelephonyIPCService::TelephonyIPCService()
{
// Deallocated in ContentChild::DeallocPTelephonyChild().
mPTelephonyChild = new TelephonyChild(this);
@ -51,7 +51,7 @@ TelephonyIPCProvider::TelephonyIPCProvider()
mDefaultServiceId = getDefaultServiceId();
}
TelephonyIPCProvider::~TelephonyIPCProvider()
TelephonyIPCService::~TelephonyIPCService()
{
if (mPTelephonyChild) {
mPTelephonyChild->Send__delete__(mPTelephonyChild);
@ -60,7 +60,7 @@ TelephonyIPCProvider::~TelephonyIPCProvider()
}
void
TelephonyIPCProvider::NoteActorDestroyed()
TelephonyIPCService::NoteActorDestroyed()
{
MOZ_ASSERT(mPTelephonyChild);
@ -72,7 +72,7 @@ TelephonyIPCProvider::NoteActorDestroyed()
*/
NS_IMETHODIMP
TelephonyIPCProvider::Observe(nsISupports* aSubject,
TelephonyIPCService::Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData)
{
@ -84,28 +84,28 @@ TelephonyIPCProvider::Observe(nsISupports* aSubject,
return NS_OK;
}
MOZ_ASSERT(false, "TelephonyIPCProvider got unexpected topic!");
MOZ_ASSERT(false, "TelephonyIPCService got unexpected topic!");
return NS_ERROR_UNEXPECTED;
}
/*
* Implementation of nsITelephonyProvider.
* Implementation of nsITelephonyService.
*/
NS_IMETHODIMP
TelephonyIPCProvider::GetDefaultServiceId(uint32_t* aServiceId)
TelephonyIPCService::GetDefaultServiceId(uint32_t* aServiceId)
{
*aServiceId = mDefaultServiceId;
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::RegisterListener(nsITelephonyListener *aListener)
TelephonyIPCService::RegisterListener(nsITelephonyListener *aListener)
{
MOZ_ASSERT(!mListeners.Contains(aListener));
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -119,12 +119,12 @@ TelephonyIPCProvider::RegisterListener(nsITelephonyListener *aListener)
}
NS_IMETHODIMP
TelephonyIPCProvider::UnregisterListener(nsITelephonyListener *aListener)
TelephonyIPCService::UnregisterListener(nsITelephonyListener *aListener)
{
MOZ_ASSERT(mListeners.Contains(aListener));
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -138,12 +138,12 @@ TelephonyIPCProvider::UnregisterListener(nsITelephonyListener *aListener)
}
nsresult
TelephonyIPCProvider::SendRequest(nsITelephonyListener *aListener,
TelephonyIPCService::SendRequest(nsITelephonyListener *aListener,
nsITelephonyCallback *aCallback,
const IPCTelephonyRequest& aRequest)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -155,13 +155,13 @@ TelephonyIPCProvider::SendRequest(nsITelephonyListener *aListener,
}
NS_IMETHODIMP
TelephonyIPCProvider::EnumerateCalls(nsITelephonyListener *aListener)
TelephonyIPCService::EnumerateCalls(nsITelephonyListener *aListener)
{
return SendRequest(aListener, nullptr, EnumerateCallsRequest());
}
NS_IMETHODIMP
TelephonyIPCProvider::Dial(uint32_t aClientId, const nsAString& aNumber,
TelephonyIPCService::Dial(uint32_t aClientId, const nsAString& aNumber,
bool aIsEmergency, nsITelephonyCallback *aCallback)
{
return SendRequest(nullptr, aCallback,
@ -169,10 +169,10 @@ TelephonyIPCProvider::Dial(uint32_t aClientId, const nsAString& aNumber,
}
NS_IMETHODIMP
TelephonyIPCProvider::HangUp(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCService::HangUp(uint32_t aClientId, uint32_t aCallIndex)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -181,10 +181,10 @@ TelephonyIPCProvider::HangUp(uint32_t aClientId, uint32_t aCallIndex)
}
NS_IMETHODIMP
TelephonyIPCProvider::AnswerCall(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCService::AnswerCall(uint32_t aClientId, uint32_t aCallIndex)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -193,10 +193,10 @@ TelephonyIPCProvider::AnswerCall(uint32_t aClientId, uint32_t aCallIndex)
}
NS_IMETHODIMP
TelephonyIPCProvider::RejectCall(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCService::RejectCall(uint32_t aClientId, uint32_t aCallIndex)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -205,10 +205,10 @@ TelephonyIPCProvider::RejectCall(uint32_t aClientId, uint32_t aCallIndex)
}
NS_IMETHODIMP
TelephonyIPCProvider::HoldCall(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCService::HoldCall(uint32_t aClientId, uint32_t aCallIndex)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -217,10 +217,10 @@ TelephonyIPCProvider::HoldCall(uint32_t aClientId, uint32_t aCallIndex)
}
NS_IMETHODIMP
TelephonyIPCProvider::ResumeCall(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCService::ResumeCall(uint32_t aClientId, uint32_t aCallIndex)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -229,10 +229,10 @@ TelephonyIPCProvider::ResumeCall(uint32_t aClientId, uint32_t aCallIndex)
}
NS_IMETHODIMP
TelephonyIPCProvider::ConferenceCall(uint32_t aClientId)
TelephonyIPCService::ConferenceCall(uint32_t aClientId)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -241,10 +241,10 @@ TelephonyIPCProvider::ConferenceCall(uint32_t aClientId)
}
NS_IMETHODIMP
TelephonyIPCProvider::SeparateCall(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCService::SeparateCall(uint32_t aClientId, uint32_t aCallIndex)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -253,10 +253,10 @@ TelephonyIPCProvider::SeparateCall(uint32_t aClientId, uint32_t aCallIndex)
}
NS_IMETHODIMP
TelephonyIPCProvider::HoldConference(uint32_t aClientId)
TelephonyIPCService::HoldConference(uint32_t aClientId)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -265,10 +265,10 @@ TelephonyIPCProvider::HoldConference(uint32_t aClientId)
}
NS_IMETHODIMP
TelephonyIPCProvider::ResumeConference(uint32_t aClientId)
TelephonyIPCService::ResumeConference(uint32_t aClientId)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -277,10 +277,10 @@ TelephonyIPCProvider::ResumeConference(uint32_t aClientId)
}
NS_IMETHODIMP
TelephonyIPCProvider::StartTone(uint32_t aClientId, const nsAString& aDtmfChar)
TelephonyIPCService::StartTone(uint32_t aClientId, const nsAString& aDtmfChar)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -289,10 +289,10 @@ TelephonyIPCProvider::StartTone(uint32_t aClientId, const nsAString& aDtmfChar)
}
NS_IMETHODIMP
TelephonyIPCProvider::StopTone(uint32_t aClientId)
TelephonyIPCService::StopTone(uint32_t aClientId)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -301,10 +301,10 @@ TelephonyIPCProvider::StopTone(uint32_t aClientId)
}
NS_IMETHODIMP
TelephonyIPCProvider::GetMicrophoneMuted(bool* aMuted)
TelephonyIPCService::GetMicrophoneMuted(bool* aMuted)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -313,10 +313,10 @@ TelephonyIPCProvider::GetMicrophoneMuted(bool* aMuted)
}
NS_IMETHODIMP
TelephonyIPCProvider::SetMicrophoneMuted(bool aMuted)
TelephonyIPCService::SetMicrophoneMuted(bool aMuted)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -325,10 +325,10 @@ TelephonyIPCProvider::SetMicrophoneMuted(bool aMuted)
}
NS_IMETHODIMP
TelephonyIPCProvider::GetSpeakerEnabled(bool* aEnabled)
TelephonyIPCService::GetSpeakerEnabled(bool* aEnabled)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -337,10 +337,10 @@ TelephonyIPCProvider::GetSpeakerEnabled(bool* aEnabled)
}
NS_IMETHODIMP
TelephonyIPCProvider::SetSpeakerEnabled(bool aEnabled)
TelephonyIPCService::SetSpeakerEnabled(bool aEnabled)
{
if (!mPTelephonyChild) {
NS_WARNING("TelephonyProvider used after shutdown has begun!");
NS_WARNING("TelephonyService used after shutdown has begun!");
return NS_ERROR_FAILURE;
}
@ -351,7 +351,7 @@ TelephonyIPCProvider::SetSpeakerEnabled(bool aEnabled)
// nsITelephonyListener
NS_IMETHODIMP
TelephonyIPCProvider::CallStateChanged(uint32_t aClientId,
TelephonyIPCService::CallStateChanged(uint32_t aClientId,
uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
@ -370,7 +370,7 @@ TelephonyIPCProvider::CallStateChanged(uint32_t aClientId,
}
NS_IMETHODIMP
TelephonyIPCProvider::ConferenceCallStateChanged(uint16_t aCallState)
TelephonyIPCService::ConferenceCallStateChanged(uint16_t aCallState)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
mListeners[i]->ConferenceCallStateChanged(aCallState);
@ -379,13 +379,13 @@ TelephonyIPCProvider::ConferenceCallStateChanged(uint16_t aCallState)
}
NS_IMETHODIMP
TelephonyIPCProvider::EnumerateCallStateComplete()
TelephonyIPCService::EnumerateCallStateComplete()
{
MOZ_CRASH("Not a EnumerateCalls request!");
}
NS_IMETHODIMP
TelephonyIPCProvider::EnumerateCallState(uint32_t aClientId,
TelephonyIPCService::EnumerateCallState(uint32_t aClientId,
uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
@ -399,7 +399,7 @@ TelephonyIPCProvider::EnumerateCallState(uint32_t aClientId,
}
NS_IMETHODIMP
TelephonyIPCProvider::NotifyCdmaCallWaiting(uint32_t aClientId,
TelephonyIPCService::NotifyCdmaCallWaiting(uint32_t aClientId,
const nsAString& aNumber)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
@ -409,7 +409,7 @@ TelephonyIPCProvider::NotifyCdmaCallWaiting(uint32_t aClientId,
}
NS_IMETHODIMP
TelephonyIPCProvider::NotifyConferenceError(const nsAString& aName,
TelephonyIPCService::NotifyConferenceError(const nsAString& aName,
const nsAString& aMessage)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
@ -419,7 +419,7 @@ TelephonyIPCProvider::NotifyConferenceError(const nsAString& aName,
}
NS_IMETHODIMP
TelephonyIPCProvider::NotifyError(uint32_t aClientId, int32_t aCallIndex,
TelephonyIPCService::NotifyError(uint32_t aClientId, int32_t aCallIndex,
const nsAString& aError)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
@ -429,7 +429,7 @@ TelephonyIPCProvider::NotifyError(uint32_t aClientId, int32_t aCallIndex,
}
NS_IMETHODIMP
TelephonyIPCProvider::SupplementaryServiceNotification(uint32_t aClientId,
TelephonyIPCService::SupplementaryServiceNotification(uint32_t aClientId,
int32_t aCallIndex,
uint16_t aNotification)
{

Просмотреть файл

@ -3,35 +3,35 @@
* 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/. */
#ifndef mozilla_dom_telephony_TelephonyIPCProvider_h
#define mozilla_dom_telephony_TelephonyIPCProvider_h
#ifndef mozilla_dom_telephony_TelephonyIPCService_h
#define mozilla_dom_telephony_TelephonyIPCService_h
#include "mozilla/dom/telephony/TelephonyCommon.h"
#include "mozilla/Attributes.h"
#include "nsIObserver.h"
#include "nsITelephonyProvider.h"
#include "nsITelephonyService.h"
BEGIN_TELEPHONY_NAMESPACE
struct IPCTelephonyRequest;
class PTelephonyChild;
class TelephonyIPCProvider MOZ_FINAL : public nsITelephonyProvider
class TelephonyIPCService MOZ_FINAL : public nsITelephonyService
, public nsITelephonyListener
, public nsIObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSITELEPHONYPROVIDER
NS_DECL_NSITELEPHONYSERVICE
NS_DECL_NSITELEPHONYLISTENER
NS_DECL_NSIOBSERVER
TelephonyIPCProvider();
TelephonyIPCService();
void NoteActorDestroyed();
private:
~TelephonyIPCProvider();
~TelephonyIPCService();
nsTArray<nsCOMPtr<nsITelephonyListener> > mListeners;
PTelephonyChild* mPTelephonyChild;
@ -44,4 +44,4 @@ private:
END_TELEPHONY_NAMESPACE
#endif // mozilla_dom_telephony_TelephonyIPCProvider_h
#endif // mozilla_dom_telephony_TelephonyIPCService_h

Просмотреть файл

@ -80,8 +80,8 @@ TelephonyParent::RecvRegisterListener()
{
NS_ENSURE_TRUE(!mRegistered, true);
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
mRegistered = NS_SUCCEEDED(provider->RegisterListener(this));
@ -93,8 +93,8 @@ TelephonyParent::RecvUnregisterListener()
{
NS_ENSURE_TRUE(mRegistered, true);
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
mRegistered = !NS_SUCCEEDED(provider->UnregisterListener(this));
@ -105,8 +105,8 @@ bool
TelephonyParent::RecvHangUpCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->HangUp(aClientId, aCallIndex);
@ -117,8 +117,8 @@ bool
TelephonyParent::RecvAnswerCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->AnswerCall(aClientId, aCallIndex);
@ -129,8 +129,8 @@ bool
TelephonyParent::RecvRejectCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->RejectCall(aClientId, aCallIndex);
@ -141,8 +141,8 @@ bool
TelephonyParent::RecvHoldCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->HoldCall(aClientId, aCallIndex);
@ -153,8 +153,8 @@ bool
TelephonyParent::RecvResumeCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->ResumeCall(aClientId, aCallIndex);
@ -164,8 +164,8 @@ TelephonyParent::RecvResumeCall(const uint32_t& aClientId,
bool
TelephonyParent::RecvConferenceCall(const uint32_t& aClientId)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->ConferenceCall(aClientId);
@ -176,8 +176,8 @@ bool
TelephonyParent::RecvSeparateCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->SeparateCall(aClientId, aCallIndex);
@ -187,8 +187,8 @@ TelephonyParent::RecvSeparateCall(const uint32_t& aClientId,
bool
TelephonyParent::RecvHoldConference(const uint32_t& aClientId)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->HoldConference(aClientId);
@ -198,8 +198,8 @@ TelephonyParent::RecvHoldConference(const uint32_t& aClientId)
bool
TelephonyParent::RecvResumeConference(const uint32_t& aClientId)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->ResumeConference(aClientId);
@ -209,8 +209,8 @@ TelephonyParent::RecvResumeConference(const uint32_t& aClientId)
bool
TelephonyParent::RecvStartTone(const uint32_t& aClientId, const nsString& aTone)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->StartTone(aClientId, aTone);
@ -220,8 +220,8 @@ TelephonyParent::RecvStartTone(const uint32_t& aClientId, const nsString& aTone)
bool
TelephonyParent::RecvStopTone(const uint32_t& aClientId)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->StopTone(aClientId);
@ -233,8 +233,8 @@ TelephonyParent::RecvGetMicrophoneMuted(bool* aMuted)
{
*aMuted = false;
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->GetMicrophoneMuted(aMuted);
@ -244,8 +244,8 @@ TelephonyParent::RecvGetMicrophoneMuted(bool* aMuted)
bool
TelephonyParent::RecvSetMicrophoneMuted(const bool& aMuted)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->SetMicrophoneMuted(aMuted);
@ -257,8 +257,8 @@ TelephonyParent::RecvGetSpeakerEnabled(bool* aEnabled)
{
*aEnabled = false;
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->GetSpeakerEnabled(aEnabled);
@ -268,8 +268,8 @@ TelephonyParent::RecvGetSpeakerEnabled(bool* aEnabled)
bool
TelephonyParent::RecvSetSpeakerEnabled(const bool& aEnabled)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->SetSpeakerEnabled(aEnabled);
@ -395,8 +395,8 @@ TelephonyRequestParent::DoRequest(const EnumerateCallsRequest& aRequest)
{
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
if (provider) {
rv = provider->EnumerateCalls(this);
}
@ -411,8 +411,8 @@ TelephonyRequestParent::DoRequest(const EnumerateCallsRequest& aRequest)
bool
TelephonyRequestParent::DoRequest(const DialRequest& aRequest)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
nsCOMPtr<nsITelephonyService> provider =
do_GetService(TELEPHONY_SERVICE_CONTRACTID);
if (provider) {
provider->Dial(aRequest.clientId(), aRequest.number(),
aRequest.isEmergency(), this);

Просмотреть файл

@ -9,7 +9,7 @@
#include "mozilla/dom/telephony/TelephonyCommon.h"
#include "mozilla/dom/telephony/PTelephonyParent.h"
#include "mozilla/dom/telephony/PTelephonyRequestParent.h"
#include "nsITelephonyProvider.h"
#include "nsITelephonyService.h"
BEGIN_TELEPHONY_NAMESPACE

Просмотреть файл

@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [
'nsITelephonyProvider.idl',
'nsITelephonyService.idl',
]
XPIDL_MODULE = 'dom_telephony'
@ -29,7 +29,7 @@ UNIFIED_SOURCES += [
'CallEvent.cpp',
'CallsList.cpp',
'ipc/TelephonyChild.cpp',
'ipc/TelephonyIPCProvider.cpp',
'ipc/TelephonyIPCService.cpp',
'ipc/TelephonyParent.cpp',
'Telephony.cpp',
'TelephonyCall.cpp',
@ -45,11 +45,11 @@ IPDL_SOURCES += [
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:
XPIDL_SOURCES += [
'nsIGonkTelephonyProvider.idl',
'nsIGonkTelephonyService.idl',
]
EXTRA_COMPONENTS += [
'gonk/TelephonyProvider.js',
'gonk/TelephonyProvider.manifest',
'gonk/TelephonyService.js',
'gonk/TelephonyService.manifest',
]
FAIL_ON_WARNINGS = True

Просмотреть файл

@ -3,15 +3,15 @@
* 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/. */
#include "nsITelephonyProvider.idl"
#include "nsITelephonyService.idl"
%{C++
#define GONK_TELEPHONY_PROVIDER_CONTRACTID \
"@mozilla.org/telephony/gonktelephonyprovider;1"
#define GONK_TELEPHONY_SERVICE_CONTRACTID \
"@mozilla.org/telephony/gonktelephonyservice;1"
%}
[scriptable, uuid(9d884482-90fc-4050-a4b1-1a370afe7a35)]
interface nsIGonkTelephonyProvider : nsITelephonyProvider
[scriptable, uuid(2ff3dcbb-ae63-443e-9c5d-76811f2f9b42)]
interface nsIGonkTelephonyService : nsITelephonyService
{
void notifyCallDisconnected(in unsigned long clientId, in jsval call);

Просмотреть файл

@ -15,7 +15,7 @@ interface nsITelephonyListener : nsISupports
* @param callIndex
* Call identifier assigned by the RIL.
* @param callState
* One of the nsITelephonyProvider::CALL_STATE_* values.
* One of the nsITelephonyService::CALL_STATE_* values.
* @param number
* Number of the other party.
* @param isOutgoing
@ -26,8 +26,8 @@ interface nsITelephonyListener : nsISupports
* Indicates whether this call is a conference call.
* @param isSwitchable
* Indicates whether this call can be switched between states of
* nsITelephonyProvider::CALL_STATE_CONNECTED and
* nsITelephonyProvider::CALL_STATE_HELD.
* nsITelephonyService::CALL_STATE_CONNECTED and
* nsITelephonyService::CALL_STATE_HELD.
* @param isMergeable
* Indicates whether this call be be added into a conference.
*/
@ -46,21 +46,21 @@ interface nsITelephonyListener : nsISupports
* conference call state changes.
*
* @param callState
* Possible values are: nsITelephonyProvider::CALL_STATE_UNKNOWN,
* nsITelephonyProvider::CALL_STATE_HELD,
* nsITelephonyProvider::CALL_STATE_CONNECTED.
* Possible values are: nsITelephonyService::CALL_STATE_UNKNOWN,
* nsITelephonyService::CALL_STATE_HELD,
* nsITelephonyService::CALL_STATE_CONNECTED.
*/
void conferenceCallStateChanged(in unsigned short callState);
/**
* Called when enumeration asked by nsITelephonyProvider::enumerateCalls
* Called when enumeration asked by nsITelephonyService::enumerateCalls
* is completed.
*/
void enumerateCallStateComplete();
/**
* Called when nsITelephonyProvider is asked to enumerate the current
* telephony call state (nsITelephonyProvider::enumerateCalls). This is
* Called when nsITelephonyService is asked to enumerate the current
* telephony call state (nsITelephonyService::enumerateCalls). This is
* called once per call that is currently managed by the RIL.
*
* @param clientId
@ -68,7 +68,7 @@ interface nsITelephonyListener : nsISupports
* @param callIndex
* Call identifier assigned by the RIL.
* @param callState
* One of the nsITelephonyProvider::CALL_STATE_* values.
* One of the nsITelephonyService::CALL_STATE_* values.
* @param number
* Number of the other party.
* @param isOutgoing
@ -77,8 +77,8 @@ interface nsITelephonyListener : nsISupports
* Indicates whether this call is a conference call.
* @param isSwitchable
* Indicates whether this call can be switched between states of
* nsITelephonyProvider::CALL_STATE_CONNECTED and
* nsITelephonyProvider::CALL_STATE_HELD.
* nsITelephonyService::CALL_STATE_CONNECTED and
* nsITelephonyService::CALL_STATE_HELD.
* @param isMergeable
* Indicates whether this call be be added into a conference.
*/
@ -100,7 +100,7 @@ interface nsITelephonyListener : nsISupports
* @param callIndex
* Call identifier assigned by the RIL. -1 if not specified
* @param notification
* One of the nsITelephonyProvider::NOTIFICATION_* values.
* One of the nsITelephonyService::NOTIFICATION_* values.
*/
void supplementaryServiceNotification(in unsigned long clientId,
in long callIndex,
@ -159,18 +159,18 @@ interface nsITelephonyCallback : nsISupports
};
%{C++
#define TELEPHONY_PROVIDER_CID \
#define TELEPHONY_SERVICE_CID \
{ 0x9cf8aa52, 0x7c1c, 0x4cde, { 0x97, 0x4e, 0xed, 0x2a, 0xa0, 0xe7, 0x35, 0xfa } }
#define TELEPHONY_PROVIDER_CONTRACTID \
"@mozilla.org/telephony/telephonyprovider;1"
#define TELEPHONY_SERVICE_CONTRACTID \
"@mozilla.org/telephony/telephonyservice;1"
%}
/**
* XPCOM component (in the content process) that provides the telephony
* information.
*/
[scriptable, uuid(b16ca98f-994f-4ae1-8c2d-e7b18e08d1f3)]
interface nsITelephonyProvider : nsISupports
[scriptable, uuid(4ff3ecb7-b024-4752-9dd6-c3623c6e6b8a)]
interface nsITelephonyService : nsISupports
{
const unsigned short CALL_STATE_UNKNOWN = 0;
const unsigned short CALL_STATE_DIALING = 1;

Просмотреть файл

@ -6,8 +6,8 @@ MARIONETTE_CONTEXT = "chrome";
Cu.import("resource://gre/modules/Promise.jsm");
const TELEPHONY_PROVIDER_CONTRACTID =
"@mozilla.org/telephony/telephonyprovider;1";
const TELEPHONY_SERVICE_CONTRACTID =
"@mozilla.org/telephony/telephonyservice;1";
const PREF_RIL_NUM_RADIO_INTERFACES = "ril.numRadioInterfaces";
const PREF_DEFAULT_SERVICE_ID = "dom.telephony.defaultServiceId";
@ -122,6 +122,6 @@ function verify(contractId, ifaceName, attrName, prefKey, numRil) {
}
getNumRadioInterfaces()
.then(verify.bind(null, TELEPHONY_PROVIDER_CONTRACTID, "nsITelephonyProvider",
.then(verify.bind(null, TELEPHONY_SERVICE_CONTRACTID, "nsITelephonyService",
"defaultServiceId", PREF_DEFAULT_SERVICE_ID))
.then(finish);

Просмотреть файл

@ -236,7 +236,7 @@ static void Shutdown();
#include "StreamingProtocolService.h"
#include "mozilla/dom/telephony/TelephonyFactory.h"
#include "nsITelephonyProvider.h"
#include "nsITelephonyService.h"
#ifdef MOZ_WIDGET_GONK
#include "GonkGPSGeolocationProvider.h"
@ -358,8 +358,8 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsVolumeService,
#endif
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMediaManagerService,
MediaManager::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelephonyProvider,
TelephonyFactory::CreateTelephonyProvider)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelephonyService,
TelephonyFactory::CreateTelephonyService)
//-----------------------------------------------------------------------------
@ -792,7 +792,7 @@ NS_DEFINE_NAMED_CID(NS_SYNTHVOICEREGISTRY_CID);
#ifdef ACCESSIBILITY
NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(TELEPHONY_PROVIDER_CID);
NS_DEFINE_NAMED_CID(TELEPHONY_SERVICE_CID);
NS_DEFINE_NAMED_CID(GECKO_MEDIA_PLUGIN_SERVICE_CID);
@ -1079,7 +1079,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
#ifdef ACCESSIBILITY
{ &kNS_ACCESSIBILITY_SERVICE_CID, false, nullptr, CreateA11yService },
#endif
{ &kTELEPHONY_PROVIDER_CID, false, nullptr, nsITelephonyProviderConstructor },
{ &kTELEPHONY_SERVICE_CID, false, nullptr, nsITelephonyServiceConstructor },
{ nullptr }
};
@ -1235,7 +1235,7 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
{ "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID },
{ "@mozilla.org/accessibleRetrieval;1", &kNS_ACCESSIBILITY_SERVICE_CID },
#endif
{ TELEPHONY_PROVIDER_CONTRACTID, &kTELEPHONY_PROVIDER_CID },
{ TELEPHONY_SERVICE_CONTRACTID, &kTELEPHONY_SERVICE_CID },
{ "@mozilla.org/gecko-media-plugin-service;1", &kGECKO_MEDIA_PLUGIN_SERVICE_CID },
{ nullptr }
};