Backed out 9 changesets (bug 814625) for desktop build bustage.

Backed out changeset a107de5616a0 (bug 814625)
Backed out changeset 416665a419f4 (bug 814625)
Backed out changeset b6fc8734864f (bug 814625)
Backed out changeset 9f5e2e44a914 (bug 814625)
Backed out changeset 17b3050df362 (bug 814625)
Backed out changeset 43a047c081c8 (bug 814625)
Backed out changeset 90bdcd099320 (bug 814625)
Backed out changeset 8957cc31cce2 (bug 814625)
Backed out changeset de45eb7a8d16 (bug 814625)
This commit is contained in:
Ryan VanderMeulen 2013-10-30 15:48:39 -04:00
parent 85a40fb7d6
commit d9c8a6c13c
20 changed files with 516 additions and 681 deletions

View File

@ -133,8 +133,6 @@ MobileConnectionListener::NotifyIccChanged()
/**
* TelephonyListener Implementation
*
* TODO: Bug 921991 - B2G BT: support multiple sim cards
*/
class TelephonyListener : public nsITelephonyListener
{
@ -148,8 +146,7 @@ public:
NS_IMPL_ISUPPORTS1(TelephonyListener, nsITelephonyListener)
NS_IMETHODIMP
TelephonyListener::CallStateChanged(uint32_t aServiceId,
uint32_t aCallIndex,
TelephonyListener::CallStateChanged(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
@ -165,8 +162,7 @@ TelephonyListener::CallStateChanged(uint32_t aServiceId,
}
NS_IMETHODIMP
TelephonyListener::EnumerateCallState(uint32_t aServiceId,
uint32_t aCallIndex,
TelephonyListener::EnumerateCallState(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString_internal& aNumber,
bool aIsActive,
@ -181,8 +177,7 @@ TelephonyListener::EnumerateCallState(uint32_t aServiceId,
}
NS_IMETHODIMP
TelephonyListener::NotifyError(uint32_t aServiceId,
int32_t aCallIndex,
TelephonyListener::NotifyError(int32_t aCallIndex,
const nsAString& aError)
{
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
@ -216,16 +211,14 @@ TelephonyListener::EnumerateCallStateComplete()
}
NS_IMETHODIMP
TelephonyListener::SupplementaryServiceNotification(uint32_t aServiceId,
int32_t aCallIndex,
TelephonyListener::SupplementaryServiceNotification(int32_t aCallIndex,
uint16_t aNotification)
{
return NS_OK;
}
NS_IMETHODIMP
TelephonyListener::NotifyCdmaCallWaiting(uint32_t aServiceId,
const nsAString& aNumber)
TelephonyListener::NotifyCdmaCallWaiting(const nsAString& aNumber)
{
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
hfp->UpdateSecondNumber(aNumber);
@ -344,4 +337,4 @@ BluetoothRilListener::StopTelephonyListening()
nsresult rv = provider->UnregisterListener(mTelephonyListener);
return NS_SUCCEEDED(rv);
}
}

View File

@ -1001,24 +1001,22 @@ RadioInterface.prototype = {
gTelephonyProvider.notifyCallRing();
break;
case "callStateChange":
gTelephonyProvider.notifyCallStateChanged(this.clientId, message.call);
gTelephonyProvider.notifyCallStateChanged(message.call);
break;
case "callDisconnected":
gTelephonyProvider.notifyCallDisconnected(this.clientId, message.call);
gTelephonyProvider.notifyCallDisconnected(message.call);
break;
case "conferenceCallStateChanged":
gTelephonyProvider.notifyConferenceCallStateChanged(message.state);
break;
case "cdmaCallWaiting":
gTelephonyProvider.notifyCdmaCallWaiting(this.clientId, message.number);
gTelephonyProvider.notifyCdmaCallWaiting(message.number);
break;
case "callError":
gTelephonyProvider.notifyCallError(this.clientId, message.callIndex,
message.errorMsg);
gTelephonyProvider.notifyCallError(message.callIndex, message.errorMsg);
break;
case "suppSvcNotification":
gTelephonyProvider.notifySupplementaryService(this.clientId,
message.callIndex,
gTelephonyProvider.notifySupplementaryService(message.callIndex,
message.notification);
break;
case "emergencyCbModeChange":
@ -3577,3 +3575,4 @@ RILNetworkInterface.prototype = {
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RadioInterfaceLayer]);

View File

@ -12,7 +12,6 @@
#include "nsIPermissionManager.h"
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/Preferences.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
@ -176,106 +175,11 @@ Telephony::Create(nsPIDOMWindow* aOwner, ErrorResult& aRv)
return telephony.forget();
}
// static
bool
Telephony::IsValidNumber(const nsAString& aNumber)
{
return !aNumber.IsEmpty();
}
// static
uint32_t
Telephony::GetNumServices() {
return mozilla::Preferences::GetInt("ril.numRadioInterfaces", 1);
}
// static
bool
Telephony::IsValidServiceId(uint32_t aServiceId)
{
return aServiceId < GetNumServices();
}
// static
bool
Telephony::IsActiveState(uint16_t aCallState) {
return aCallState == nsITelephonyProvider::CALL_STATE_DIALING ||
aCallState == nsITelephonyProvider::CALL_STATE_ALERTING ||
aCallState == nsITelephonyProvider::CALL_STATE_CONNECTED;
}
uint32_t
Telephony::ProvidedOrDefaultServiceId(const Optional<uint32_t>& aServiceId)
{
uint32_t serviceId = 0;
return aServiceId.WasPassed() ? aServiceId.Value()
: mProvider->GetDefaultServiceId(&serviceId);
}
bool
Telephony::HasDialingCall()
{
for (uint32_t i = 0; i < mCalls.Length(); i++) {
const nsRefPtr<TelephonyCall>& call = mCalls[i];
if (call->IsOutgoing() &&
call->CallState() > nsITelephonyProvider::CALL_STATE_UNKNOWN &&
call->CallState() < nsITelephonyProvider::CALL_STATE_CONNECTED) {
return true;
}
}
return false;
}
bool
Telephony::MatchActiveCall(TelephonyCall* aCall)
{
return (mActiveCall &&
mActiveCall->CallIndex() == aCall->CallIndex() &&
mActiveCall->ServiceId() == aCall->ServiceId());
}
already_AddRefed<TelephonyCall>
Telephony::DialInternal(uint32_t aServiceId, const nsAString& aNumber,
bool aIsEmergency, ErrorResult& aRv)
{
if (!IsValidNumber(aNumber) || !IsValidServiceId(aServiceId)) {
aRv.Throw(NS_ERROR_INVALID_ARG);
return nullptr;
}
// We only support one outgoing call at a time.
if (HasDialingCall()) {
NS_WARNING("Only permitted to dial one call at a time!");
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
return nullptr;
}
nsresult rv = mProvider->Dial(aServiceId, aNumber, aIsEmergency);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;
}
nsRefPtr<TelephonyCall> call = CreateNewDialingCall(aServiceId, aNumber);
// Notify other telephony objects that we just dialed.
for (uint32_t i = 0; i < gTelephonyList->Length(); i++) {
Telephony*& telephony = gTelephonyList->ElementAt(i);
if (telephony != this) {
nsRefPtr<Telephony> kungFuDeathGrip = telephony;
telephony->NoteDialedCallFromOtherInstance(aServiceId, aNumber);
}
}
return call.forget();
}
already_AddRefed<TelephonyCall>
Telephony::CreateNewDialingCall(uint32_t aServiceId, const nsAString& aNumber)
Telephony::CreateNewDialingCall(const nsAString& aNumber)
{
nsRefPtr<TelephonyCall> call =
TelephonyCall::Create(this, aServiceId, aNumber,
TelephonyCall::Create(this, aNumber,
nsITelephonyProvider::CALL_STATE_DIALING);
NS_ASSERTION(call, "This should never fail!");
@ -285,11 +189,10 @@ Telephony::CreateNewDialingCall(uint32_t aServiceId, const nsAString& aNumber)
}
void
Telephony::NoteDialedCallFromOtherInstance(uint32_t aServiceId,
const nsAString& aNumber)
Telephony::NoteDialedCallFromOtherInstance(const nsAString& aNumber)
{
// We don't need to hang on to this call object, it is held alive by mCalls.
nsRefPtr<TelephonyCall> call = CreateNewDialingCall(aServiceId, aNumber);
nsRefPtr<TelephonyCall> call = CreateNewDialingCall(aNumber);
}
nsresult
@ -298,25 +201,71 @@ Telephony::NotifyCallsChanged(TelephonyCall* aCall)
return DispatchCallEvent(NS_LITERAL_STRING("callschanged"), aCall);
}
void
Telephony::UpdateActiveCall(TelephonyCall* aCall, bool aIsActive)
already_AddRefed<TelephonyCall>
Telephony::DialInternal(bool isEmergency,
const nsAString& aNumber,
ErrorResult& aRv)
{
if (aIsActive) {
mActiveCall = aCall;
} else if (MatchActiveCall(aCall)) {
if (aNumber.IsEmpty()) {
aRv.Throw(NS_ERROR_INVALID_ARG);
return nullptr;
}
for (uint32_t index = 0; index < mCalls.Length(); index++) {
const nsRefPtr<TelephonyCall>& tempCall = mCalls[index];
if (tempCall->IsOutgoing() &&
tempCall->CallState() < nsITelephonyProvider::CALL_STATE_CONNECTED) {
// One call has been dialed already and we only support one outgoing call
// at a time.
NS_WARNING("Only permitted to dial one call at a time!");
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
return nullptr;
}
}
nsresult rv = mProvider->Dial(aNumber, isEmergency);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return nullptr;
}
nsRefPtr<TelephonyCall> call = CreateNewDialingCall(aNumber);
// Notify other telephony objects that we just dialed.
for (uint32_t index = 0; index < gTelephonyList->Length(); index++) {
Telephony*& telephony = gTelephonyList->ElementAt(index);
if (telephony != this) {
nsRefPtr<Telephony> kungFuDeathGrip = telephony;
telephony->NoteDialedCallFromOtherInstance(aNumber);
}
}
return call.forget();
}
void
Telephony::UpdateActiveCall(TelephonyCall* aCall, bool aIsAdding)
{
if (aIsAdding) {
if (aCall->CallState() == nsITelephonyProvider::CALL_STATE_DIALING ||
aCall->CallState() == nsITelephonyProvider::CALL_STATE_ALERTING ||
aCall->CallState() == nsITelephonyProvider::CALL_STATE_CONNECTED) {
NS_ASSERTION(!mActiveCall, "Already have an active call!");
mActiveCall = aCall;
}
} else if (mActiveCall && mActiveCall->CallIndex() == aCall->CallIndex()) {
mActiveCall = nullptr;
}
}
already_AddRefed<TelephonyCall>
Telephony::GetCall(uint32_t aServiceId, uint32_t aCallIndex)
Telephony::GetCall(uint32_t aCallIndex)
{
nsRefPtr<TelephonyCall> call;
for (uint32_t i = 0; i < mCalls.Length(); i++) {
nsRefPtr<TelephonyCall>& tempCall = mCalls[i];
if (tempCall->ServiceId() == aServiceId &&
tempCall->CallIndex() == aCallIndex) {
for (uint32_t index = 0; index < mCalls.Length(); index++) {
nsRefPtr<TelephonyCall>& tempCall = mCalls[index];
if (tempCall->CallIndex() == aCallIndex) {
call = tempCall;
break;
}
@ -325,36 +274,32 @@ Telephony::GetCall(uint32_t aServiceId, uint32_t aCallIndex)
return call.forget();
}
already_AddRefed<TelephonyCall>
Telephony::GetOutgoingCall()
bool
Telephony::MoveCall(uint32_t aCallIndex, bool aIsConference)
{
nsRefPtr<TelephonyCall> call;
for (uint32_t i = 0; i < mCalls.Length(); i++) {
nsRefPtr<TelephonyCall>& tempCall = mCalls[i];
if (tempCall->CallIndex() == kOutgoingPlaceholderCallIndex) {
NS_ASSERTION(!call, "More than one outgoing call not supported!");
NS_ASSERTION(tempCall->CallState() == nsITelephonyProvider::CALL_STATE_DIALING,
"Something really wrong here!");
call = tempCall;
// No break. We will search entire list to ensure only one outgoing call.
// Move a call to mGroup.
if (aIsConference) {
call = GetCall(aCallIndex);
if (call) {
RemoveCall(call);
mGroup->AddCall(call);
return true;
}
return false;
}
return call.forget();
}
already_AddRefed<TelephonyCall>
Telephony::GetCallFromEverywhere(uint32_t aServiceId, uint32_t aCallIndex)
{
nsRefPtr<TelephonyCall> call = GetCall(aServiceId, aCallIndex);
if (!call) {
call = mGroup->GetCall(aServiceId, aCallIndex);
// Remove a call from mGroup.
call = mGroup->GetCall(aCallIndex);
if (call) {
mGroup->RemoveCall(call);
AddCall(call);
return true;
}
return call.forget();
return false;
}
NS_IMPL_CYCLE_COLLECTION_CLASS(Telephony)
@ -386,57 +331,19 @@ NS_IMPL_ISUPPORTS1(Telephony::Listener, nsITelephonyListener)
// Telephony WebIDL
already_AddRefed<TelephonyCall>
Telephony::Dial(const nsAString& aNumber, const Optional<uint32_t>& aServiceId,
ErrorResult& aRv)
Telephony::Dial(const nsAString& aNumber, ErrorResult& aRv)
{
uint32_t serviceId = ProvidedOrDefaultServiceId(aServiceId);
nsRefPtr<TelephonyCall> call = DialInternal(serviceId, aNumber, false, aRv);
nsRefPtr<TelephonyCall> call = DialInternal(false, aNumber, aRv);
return call.forget();
}
already_AddRefed<TelephonyCall>
Telephony::DialEmergency(const nsAString& aNumber,
const Optional<uint32_t>& aServiceId,
ErrorResult& aRv)
Telephony::DialEmergency(const nsAString& aNumber, ErrorResult& aRv)
{
uint32_t serviceId = ProvidedOrDefaultServiceId(aServiceId);
nsRefPtr<TelephonyCall> call = DialInternal(serviceId, aNumber, true, aRv);
nsRefPtr<TelephonyCall> call = DialInternal(true, aNumber, aRv);
return call.forget();
}
void
Telephony::StartTone(const nsAString& aDTMFChar,
const Optional<uint32_t>& aServiceId,
ErrorResult& aRv)
{
uint32_t serviceId = ProvidedOrDefaultServiceId(aServiceId);
if (aDTMFChar.IsEmpty()) {
NS_WARNING("Empty tone string will be ignored");
return;
}
if (aDTMFChar.Length() > 1 || !IsValidServiceId(serviceId)) {
aRv.Throw(NS_ERROR_INVALID_ARG);
return;
}
aRv = mProvider->StartTone(serviceId, aDTMFChar);
}
void
Telephony::StopTone(const Optional<uint32_t>& aServiceId, ErrorResult& aRv)
{
uint32_t serviceId = ProvidedOrDefaultServiceId(aServiceId);
if (!IsValidServiceId(serviceId)) {
aRv.Throw(NS_ERROR_INVALID_ARG);
return;
}
aRv = mProvider->StopTone(serviceId);
}
bool
Telephony::GetMuted(ErrorResult& aRv) const
{
@ -493,6 +400,28 @@ Telephony::ConferenceGroup() const
return group.forget();
}
void
Telephony::StartTone(const nsAString& aDTMFChar, ErrorResult& aRv)
{
if (aDTMFChar.IsEmpty()) {
NS_WARNING("Empty tone string will be ignored");
return;
}
if (aDTMFChar.Length() > 1) {
aRv.Throw(NS_ERROR_INVALID_ARG);
return;
}
aRv = mProvider->StartTone(aDTMFChar);
}
void
Telephony::StopTone(ErrorResult& aRv)
{
aRv = mProvider->StopTone();
}
// EventTarget
void
@ -507,78 +436,124 @@ Telephony::EventListenerAdded(nsIAtom* aType)
// nsITelephonyListener
NS_IMETHODIMP
Telephony::CallStateChanged(uint32_t aServiceId, uint32_t aCallIndex,
uint16_t aCallState, const nsAString& aNumber,
bool aIsActive, bool aIsOutgoing, bool aIsEmergency,
Telephony::CallStateChanged(uint32_t aCallIndex, uint16_t aCallState,
const nsAString& aNumber, bool aIsActive,
bool aIsOutgoing, bool aIsEmergency,
bool aIsConference)
{
NS_ASSERTION(aCallIndex != kOutgoingPlaceholderCallIndex,
"This should never happen!");
nsRefPtr<TelephonyCall> modifiedCall
= GetCallFromEverywhere(aServiceId, aCallIndex);
nsRefPtr<TelephonyCall> modifiedCall;
nsRefPtr<TelephonyCall> outgoingCall;
// Try to use the outgoing call if we don't find the modified call.
if (!modifiedCall) {
nsRefPtr<TelephonyCall> outgoingCall = GetOutgoingCall();
// Update calls array first then state of a call in mCalls.
// If the call state isn't incoming but we do have an outgoing call then
// we must be seeing a status update for our outgoing call.
if (outgoingCall &&
aCallState != nsITelephonyProvider::CALL_STATE_INCOMING) {
outgoingCall->UpdateCallIndex(aCallIndex);
outgoingCall->UpdateEmergency(aIsEmergency);
modifiedCall.swap(outgoingCall);
if (aIsConference) {
// Add the call into mGroup if it hasn't been there, otherwise we simply
// update its call state. We don't fire the statechange event on a call in
// conference here. Instead, the event will be fired later in
// TelephonyCallGroup::ChangeState(). Thus the sequence of firing the
// statechange events is guaranteed: first on TelephonyCallGroup then on
// individual TelephonyCall objects.
modifiedCall = mGroup->GetCall(aCallIndex);
if (modifiedCall) {
modifiedCall->ChangeStateInternal(aCallState, false);
return NS_OK;
}
// The call becomes a conference call. Remove it from Telephony::mCalls and
// add it to mGroup.
modifiedCall = GetCall(aCallIndex);
if (modifiedCall) {
modifiedCall->ChangeStateInternal(aCallState, false);
mGroup->AddCall(modifiedCall);
RemoveCall(modifiedCall);
return NS_OK;
}
// Didn't find this call in mCalls or mGroup. Create a new call.
nsRefPtr<TelephonyCall> call =
TelephonyCall::Create(this, aNumber, aCallState, aCallIndex,
aIsEmergency, aIsConference);
NS_ASSERTION(call, "This should never fail!");
return NS_OK;
}
// Not a conference call. Remove the call from mGroup if it has been there.
modifiedCall = mGroup->GetCall(aCallIndex);
if (modifiedCall) {
if (aCallState != nsITelephonyProvider::CALL_STATE_DISCONNECTED) {
if (modifiedCall->CallState() != aCallState) {
modifiedCall->ChangeState(aCallState);
}
mGroup->RemoveCall(modifiedCall);
AddCall(modifiedCall);
} else {
modifiedCall->ChangeState(aCallState);
}
return NS_OK;
}
// Update calls in mCalls.
for (uint32_t index = 0; index < mCalls.Length(); index++) {
nsRefPtr<TelephonyCall>& tempCall = mCalls[index];
if (tempCall->CallIndex() == kOutgoingPlaceholderCallIndex) {
NS_ASSERTION(!outgoingCall, "More than one outgoing call not supported!");
NS_ASSERTION(tempCall->CallState() ==
nsITelephonyProvider::CALL_STATE_DIALING,
"Something really wrong here!");
// Stash this for later, we may need it if aCallIndex doesn't match one of
// our other calls.
outgoingCall = tempCall;
} else if (tempCall->CallIndex() == aCallIndex) {
// We already know about this call so just update its state.
modifiedCall = tempCall;
outgoingCall = nullptr;
break;
}
}
// If nothing matched above and the call state isn't incoming but we do have
// an outgoing call then we must be seeing a status update for our outgoing
// call.
if (!modifiedCall &&
aCallState != nsITelephonyProvider::CALL_STATE_INCOMING &&
outgoingCall) {
outgoingCall->UpdateCallIndex(aCallIndex);
outgoingCall->UpdateEmergency(aIsEmergency);
modifiedCall.swap(outgoingCall);
}
if (modifiedCall) {
if (!aIsConference) {
UpdateActiveCall(modifiedCall, aIsActive);
// See if this should replace our current active call.
if (aIsActive) {
mActiveCall = modifiedCall;
} else if (mActiveCall && mActiveCall->CallIndex() == aCallIndex) {
mActiveCall = nullptr;
}
if (modifiedCall->CallState() != aCallState) {
// We don't fire the statechange event on a call in conference here.
// Instead, the event will be fired later in
// TelephonyCallGroup::ChangeState(). Thus the sequence of firing the
// statechange events is guaranteed: first on TelephonyCallGroup then on
// individual TelephonyCall objects.
bool fireEvent = !aIsConference;
modifiedCall->ChangeStateInternal(aCallState, fireEvent);
}
nsRefPtr<TelephonyCallGroup> group = modifiedCall->GetGroup();
if (!group && aIsConference) {
// Add to conference.
NS_ASSERTION(mCalls.Contains(modifiedCall), "Should in mCalls");
mGroup->AddCall(modifiedCall);
RemoveCall(modifiedCall);
} else if (group && !aIsConference) {
// Remove from conference.
NS_ASSERTION(mGroup->CallsArray().Contains(modifiedCall), "Should in mGroup");
mGroup->RemoveCall(modifiedCall);
AddCall(modifiedCall);
}
// Change state.
modifiedCall->ChangeState(aCallState);
return NS_OK;
}
// Do nothing since we didn't know anything about it before now and it's
// ended already.
// Didn't know anything about this call before now.
if (aCallState == nsITelephonyProvider::CALL_STATE_DISCONNECTED) {
// Do nothing since we didn't know anything about it before now and it's
// been ended already.
return NS_OK;
}
// Didn't find this call in mCalls or mGroup. Create a new call.
nsRefPtr<TelephonyCall> call =
TelephonyCall::Create(this, aServiceId, aNumber, aCallState, aCallIndex,
aIsEmergency, aIsConference);
TelephonyCall::Create(this, aNumber, aCallState, aCallIndex, aIsEmergency);
NS_ASSERTION(call, "This should never fail!");
NS_ASSERTION(aIsConference ? mGroup->CallsArray().Contains(call) :
mCalls.Contains(call),
"Should have auto-added new call!");
NS_ASSERTION(mCalls.Contains(call), "Should have auto-added new call!");
if (aCallState == nsITelephonyProvider::CALL_STATE_INCOMING) {
nsresult rv = DispatchCallEvent(NS_LITERAL_STRING("incoming"), call);
@ -609,9 +584,9 @@ Telephony::EnumerateCallStateComplete()
}
NS_IMETHODIMP
Telephony::EnumerateCallState(uint32_t aServiceId, uint32_t aCallIndex,
uint16_t aCallState, const nsAString& aNumber,
bool aIsActive, bool aIsOutgoing, bool aIsEmergency,
Telephony::EnumerateCallState(uint32_t aCallIndex, uint16_t aCallState,
const nsAString& aNumber, bool aIsActive,
bool aIsOutgoing, bool aIsEmergency,
bool aIsConference)
{
nsRefPtr<TelephonyCall> call;
@ -621,14 +596,20 @@ Telephony::EnumerateCallState(uint32_t aServiceId, uint32_t aCallIndex,
// However, it is likely to have call state changes, i.e. CallStateChanged()
// being called, before the enumeration result comes back. We'd make sure
// we don't somehow add duplicates due to the race condition.
call = GetCallFromEverywhere(aServiceId, aCallIndex);
call = aIsConference ? mGroup->GetCall(aCallIndex) : GetCall(aCallIndex);
if (call) {
// We have the call either in mCalls or in mGroup. Skip it.
return NS_OK;
}
if (MoveCall(aCallIndex, aIsConference)) {
return NS_OK;
}
// Didn't know anything about this call before now.
call = TelephonyCall::Create(this, aServiceId, aNumber, aCallState,
aCallIndex, aIsEmergency, aIsConference);
call = TelephonyCall::Create(this, aNumber, aCallState, aCallIndex,
aIsEmergency, aIsConference);
NS_ASSERTION(call, "This should never fail!");
NS_ASSERTION(aIsConference ? mGroup->CallsArray().Contains(call) :
@ -639,13 +620,12 @@ Telephony::EnumerateCallState(uint32_t aServiceId, uint32_t aCallIndex,
}
NS_IMETHODIMP
Telephony::SupplementaryServiceNotification(uint32_t aServiceId,
int32_t aCallIndex,
Telephony::SupplementaryServiceNotification(int32_t aCallIndex,
uint16_t aNotification)
{
nsRefPtr<TelephonyCall> associatedCall;
if (!mCalls.IsEmpty() && aCallIndex != -1) {
associatedCall = GetCall(aServiceId, aCallIndex);
associatedCall = GetCall(aCallIndex);
}
nsresult rv;
@ -666,26 +646,31 @@ Telephony::SupplementaryServiceNotification(uint32_t aServiceId,
}
NS_IMETHODIMP
Telephony::NotifyError(uint32_t aServiceId,
int32_t aCallIndex,
Telephony::NotifyError(int32_t aCallIndex,
const nsAString& aError)
{
if (mCalls.IsEmpty()) {
NS_ERROR("No existing call!");
return NS_ERROR_UNEXPECTED;
}
nsRefPtr<TelephonyCall> callToNotify;
callToNotify = (aCallIndex == -1) ? GetOutgoingCall()
: GetCall(aServiceId, aCallIndex);
if (!mCalls.IsEmpty()) {
// The connection is not established yet. Get the latest dialing call object.
if (aCallIndex == -1) {
nsRefPtr<TelephonyCall>& lastCall = mCalls[mCalls.Length() - 1];
if (lastCall->CallIndex() == kOutgoingPlaceholderCallIndex) {
callToNotify = lastCall;
}
} else {
// The connection has been established. Get the failed call.
callToNotify = GetCall(aCallIndex);
}
}
if (!callToNotify) {
NS_ERROR("Don't call me with a bad call index!");
return NS_ERROR_UNEXPECTED;
}
UpdateActiveCall(callToNotify, false);
if (mActiveCall && mActiveCall->CallIndex() == callToNotify->CallIndex()) {
mActiveCall = nullptr;
}
// Set the call state to 'disconnected' and remove it from the calls list.
callToNotify->NotifyError(aError);
@ -694,10 +679,9 @@ Telephony::NotifyError(uint32_t aServiceId,
}
NS_IMETHODIMP
Telephony::NotifyCdmaCallWaiting(uint32_t aServiceId, const nsAString& aNumber)
Telephony::NotifyCdmaCallWaiting(const nsAString& aNumber)
{
MOZ_ASSERT(mActiveCall &&
mActiveCall->ServiceId() == aServiceId &&
mActiveCall->CallState() == nsITelephonyProvider::CALL_STATE_CONNECTED);
nsRefPtr<TelephonyCall> callToNotify = mActiveCall;

View File

@ -7,7 +7,6 @@
#ifndef mozilla_dom_telephony_telephony_h__
#define mozilla_dom_telephony_telephony_h__
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/telephony/TelephonyCommon.h"
#include "nsITelephonyProvider.h"
@ -67,19 +66,10 @@ public:
// WebIDL
already_AddRefed<TelephonyCall>
Dial(const nsAString& aNumber, const Optional<uint32_t>& aServiceId,
ErrorResult& aRv);
Dial(const nsAString& aNumber, ErrorResult& aRv);
already_AddRefed<TelephonyCall>
DialEmergency(const nsAString& aNumber, const Optional<uint32_t>& aServiceId,
ErrorResult& aRv);
void
StartTone(const nsAString& aDTMFChar, const Optional<uint32_t>& aServiceId,
ErrorResult& aRv);
void
StopTone(const Optional<uint32_t>& aServiceId, ErrorResult& aRv);
DialEmergency(const nsAString& aNumber, ErrorResult& aRv);
bool
GetMuted(ErrorResult& aRv) const;
@ -102,6 +92,12 @@ public:
already_AddRefed<TelephonyCallGroup>
ConferenceGroup() const;
void
StartTone(const nsAString& aDTMF, ErrorResult& aRv);
void
StopTone(ErrorResult& aRv);
IMPL_EVENT_HANDLER(incoming)
IMPL_EVENT_HANDLER(callschanged)
IMPL_EVENT_HANDLER(remoteheld)
@ -115,7 +111,7 @@ public:
{
NS_ASSERTION(!mCalls.Contains(aCall), "Already know about this one!");
mCalls.AppendElement(aCall);
UpdateActiveCall(aCall, IsActiveState(aCall->CallState()));
UpdateActiveCall(aCall, true);
NotifyCallsChanged(aCall);
}
@ -146,61 +142,38 @@ private:
Telephony();
~Telephony();
void
Shutdown();
static bool
IsValidNumber(const nsAString& aNumber);
static uint32_t
GetNumServices();
static bool
IsValidServiceId(uint32_t aServiceId);
static bool
IsActiveState(uint16_t aCallState);
uint32_t
ProvidedOrDefaultServiceId(const Optional<uint32_t>& aServiceId);
bool
HasDialingCall();
bool
MatchActiveCall(TelephonyCall* aCall);
already_AddRefed<TelephonyCall>
DialInternal(uint32_t aServiceId, const nsAString& aNumber,
bool isEmergency, ErrorResult& aRv);
already_AddRefed<TelephonyCall>
CreateNewDialingCall(uint32_t aServiceId, const nsAString& aNumber);
CreateNewDialingCall(const nsAString& aNumber);
void
NoteDialedCallFromOtherInstance(uint32_t aServiceId,
const nsAString& aNumber);
NoteDialedCallFromOtherInstance(const nsAString& aNumber);
nsresult
NotifyCallsChanged(TelephonyCall* aCall);
already_AddRefed<TelephonyCall>
DialInternal(bool isEmergency,
const nsAString& aNumber,
ErrorResult& aRv);
nsresult
DispatchCallEvent(const nsAString& aType, TelephonyCall* aCall);
DispatchCallEvent(const nsAString& aType,
TelephonyCall* aCall);
void
EnqueueEnumerationAck();
void
UpdateActiveCall(TelephonyCall* aCall, bool aIsActive);
UpdateActiveCall(TelephonyCall* aCall, bool aIsAdding);
already_AddRefed<TelephonyCall>
GetCall(uint32_t aServiceId, uint32_t aCallIndex);
GetCall(uint32_t aCallIndex);
already_AddRefed<TelephonyCall>
GetOutgoingCall();
bool
MoveCall(uint32_t aCallIndex, bool aIsConference);
already_AddRefed<TelephonyCall>
GetCallFromEverywhere(uint32_t aServiceId, uint32_t aCallIndex);
void
Shutdown();
};
} // namespace dom

View File

@ -19,9 +19,9 @@ using mozilla::dom::telephony::kOutgoingPlaceholderCallIndex;
// static
already_AddRefed<TelephonyCall>
TelephonyCall::Create(Telephony* aTelephony, uint32_t aServiceId,
const nsAString& aNumber, uint16_t aCallState,
uint32_t aCallIndex, bool aEmergency, bool aIsConference)
TelephonyCall::Create(Telephony* aTelephony, const nsAString& aNumber,
uint16_t aCallState, uint32_t aCallIndex,
bool aEmergency, bool aIsConference)
{
NS_ASSERTION(aTelephony, "Null pointer!");
NS_ASSERTION(!aNumber.IsEmpty(), "Empty number!");
@ -32,7 +32,6 @@ TelephonyCall::Create(Telephony* aTelephony, uint32_t aServiceId,
call->BindToOwner(aTelephony->GetOwner());
call->mTelephony = aTelephony;
call->mServiceId = aServiceId;
call->mNumber = aNumber;
call->mCallIndex = aCallIndex;
call->mError = nullptr;
@ -220,7 +219,7 @@ TelephonyCall::Answer(ErrorResult& aRv)
return;
}
nsresult rv = mTelephony->Provider()->AnswerCall(mServiceId, mCallIndex);
nsresult rv = mTelephony->Provider()->AnswerCall(mCallIndex);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return;
@ -239,8 +238,8 @@ TelephonyCall::HangUp(ErrorResult& aRv)
}
nsresult rv = mCallState == nsITelephonyProvider::CALL_STATE_INCOMING ?
mTelephony->Provider()->RejectCall(mServiceId, mCallIndex) :
mTelephony->Provider()->HangUp(mServiceId, mCallIndex);
mTelephony->Provider()->RejectCall(mCallIndex) :
mTelephony->Provider()->HangUp(mCallIndex);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return;
@ -262,7 +261,7 @@ TelephonyCall::Hold(ErrorResult& aRv)
return;
}
nsresult rv = mTelephony->Provider()->HoldCall(mServiceId, mCallIndex);
nsresult rv = mTelephony->Provider()->HoldCall(mCallIndex);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return;
@ -291,7 +290,7 @@ TelephonyCall::Resume(ErrorResult& aRv)
return;
}
nsresult rv = mTelephony->Provider()->ResumeCall(mServiceId, mCallIndex);
nsresult rv = mTelephony->Provider()->ResumeCall(mCallIndex);
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return;

View File

@ -21,7 +21,6 @@ class TelephonyCall MOZ_FINAL : public nsDOMEventTargetHelper
nsRefPtr<Telephony> mTelephony;
nsRefPtr<TelephonyCallGroup> mGroup;
uint32_t mServiceId;
nsString mNumber;
nsString mSecondNumber;
nsString mState;
@ -108,8 +107,7 @@ public:
IMPL_EVENT_HANDLER(groupchange)
static already_AddRefed<TelephonyCall>
Create(Telephony* aTelephony, uint32_t aServiceId,
const nsAString& aNumber, uint16_t aCallState,
Create(Telephony* aTelephony, const nsAString& aNumber, uint16_t aCallState,
uint32_t aCallIndex = telephony::kOutgoingPlaceholderCallIndex,
bool aEmergency = false, bool aIsConference = false);
@ -119,12 +117,6 @@ public:
ChangeStateInternal(aCallState, true);
}
uint32_t
ServiceId() const
{
return mServiceId;
}
uint32_t
CallIndex() const
{

View File

@ -146,10 +146,6 @@ TelephonyCallGroup::CanConference(const TelephonyCall& aCall,
MOZ_ASSERT(mCallState == nsITelephonyProvider::CALL_STATE_UNKNOWN);
if (aCall.ServiceId() != aSecondCall->ServiceId()) {
return false;
}
return (aCall.CallState() == nsITelephonyProvider::CALL_STATE_CONNECTED &&
aSecondCall->CallState() == nsITelephonyProvider::CALL_STATE_HELD) ||
(aCall.CallState() == nsITelephonyProvider::CALL_STATE_HELD &&
@ -157,14 +153,13 @@ TelephonyCallGroup::CanConference(const TelephonyCall& aCall,
}
already_AddRefed<TelephonyCall>
TelephonyCallGroup::GetCall(uint32_t aServiceId, uint32_t aCallIndex)
TelephonyCallGroup::GetCall(uint32_t aCallIndex)
{
nsRefPtr<TelephonyCall> call;
for (uint32_t index = 0; index < mCalls.Length(); index++) {
nsRefPtr<TelephonyCall>& tempCall = mCalls[index];
if (tempCall->ServiceId() == aServiceId &&
tempCall->CallIndex() == aCallIndex) {
if (tempCall->CallIndex() == aCallIndex) {
call = tempCall;
break;
}
@ -212,7 +207,7 @@ TelephonyCallGroup::Add(TelephonyCall& aCall,
return;
}
aRv = mTelephony->Provider()->ConferenceCall(aCall.ServiceId());
aRv = mTelephony->Provider()->ConferenceCall();
}
void
@ -225,7 +220,7 @@ TelephonyCallGroup::Add(TelephonyCall& aCall,
return;
}
aRv = mTelephony->Provider()->ConferenceCall(aCall.ServiceId());
aRv = mTelephony->Provider()->ConferenceCall();
}
void
@ -236,14 +231,18 @@ TelephonyCallGroup::Remove(TelephonyCall& aCall, ErrorResult& aRv)
return;
}
uint32_t serviceId = aCall.ServiceId();
uint32_t callIndex = aCall.CallIndex();
bool hasCallToRemove = false;
for (uint32_t index = 0; index < mCalls.Length(); index++) {
nsRefPtr<TelephonyCall>& call = mCalls[index];
if (call->CallIndex() == callIndex) {
hasCallToRemove = true;
break;
}
}
nsRefPtr<TelephonyCall> call;
call = GetCall(serviceId, callIndex);
if (call) {
aRv = mTelephony->Provider()->SeparateCall(serviceId, callIndex);
if (hasCallToRemove) {
aRv = mTelephony->Provider()->SeparateCall(callIndex);
} else {
NS_WARNING("Didn't have this call. Ignore!");
}
@ -257,9 +256,7 @@ TelephonyCallGroup::Hold(ErrorResult& aRv)
return;
}
MOZ_ASSERT(!mCalls.IsEmpty());
nsresult rv = mTelephony->Provider()->HoldConference(mCalls[0]->ServiceId());
nsresult rv = mTelephony->Provider()->HoldConference();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return;
@ -276,9 +273,7 @@ TelephonyCallGroup::Resume(ErrorResult& aRv)
return;
}
MOZ_ASSERT(!mCalls.IsEmpty());
nsresult rv = mTelephony->Provider()->ResumeConference(mCalls[0]->ServiceId());
nsresult rv = mTelephony->Provider()->ResumeConference();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
return;

View File

@ -81,7 +81,7 @@ public:
RemoveCall(TelephonyCall* aCall);
already_AddRefed<TelephonyCall>
GetCall(uint32_t aServiceId, uint32_t aCallIndex);
GetCall(uint32_t aCallIndex);
const nsTArray<nsRefPtr<TelephonyCall> >&
CallsArray() const

View File

@ -9,7 +9,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
var RIL = {};
Cu.import("resource://gre/modules/ril_consts.js", RIL);
@ -65,10 +64,6 @@ XPCOMUtils.defineLazyGetter(this, "gAudioManager", function getAudioManager() {
}
});
XPCOMUtils.defineLazyServiceGetter(this, "gRadioInterfaceLayer",
"@mozilla.org/ril;1",
"nsIRadioInterfaceLayer");
XPCOMUtils.defineLazyServiceGetter(this, "gPowerManagerService",
"@mozilla.org/power/powermanagerservice;1",
"nsIPowerManagerService");
@ -77,6 +72,12 @@ XPCOMUtils.defineLazyServiceGetter(this, "gSystemMessenger",
"@mozilla.org/system-message-internal;1",
"nsISystemMessagesInternal");
XPCOMUtils.defineLazyGetter(this, "gRadioInterface", function () {
let ril = Cc["@mozilla.org/ril;1"].getService(Ci["nsIRadioInterfaceLayer"]);
// TODO: Bug 854326 - B2G Multi-SIM: support multiple SIM cards for SMS/MMS
return ril.getRadioInterface(0);
});
XPCOMUtils.defineLazyGetter(this, "gPhoneNumberUtils", function () {
let ns = {};
Cu.import("resource://gre/modules/PhoneNumberUtils.jsm", ns);
@ -84,8 +85,8 @@ XPCOMUtils.defineLazyGetter(this, "gPhoneNumberUtils", function () {
});
function TelephonyProvider() {
this._numClients = gRadioInterfaceLayer.numRadioInterfaces;
this._listeners = [];
this._updateDebugFlag();
this.defaultServiceId = this._getDefaultServiceId();
@ -139,10 +140,6 @@ TelephonyProvider.prototype = {
}
},
_getClient: function _getClient(aClientId) {
return gRadioInterfaceLayer.getRadioInterface(aClientId);
},
// An array of nsITelephonyListener instances.
_listeners: null,
_notifyAllListeners: function _notifyAllListeners(aMethodName, aArgs) {
@ -162,16 +159,6 @@ TelephonyProvider.prototype = {
}
},
_matchActiveCall: function _matchActiveCall(aCall) {
if (this._activeCall &&
this._activeCall.callIndex == aCall.callIndex &&
this._activeCall.clientId == aCall.clientId) {
return true;
}
return false;
},
/**
* Track the active call and update the audio system as its state changes.
*/
@ -199,7 +186,7 @@ TelephonyProvider.prototype = {
}
if (aCall.isConference) {
if (this._matchActiveCall(aCall)) {
if (this._activeCall && this._activeCall.callIndex == aCall.callIndex) {
this._activeCall = null;
}
return;
@ -238,7 +225,8 @@ TelephonyProvider.prototype = {
case nsITelephonyProvider.CALL_STATE_HELD: // Fall through...
case nsITelephonyProvider.CALL_STATE_DISCONNECTED:
aCall.isActive = false;
if (this._matchActiveCall(aCall)) {
if (this._activeCall &&
this._activeCall.callIndex == aCall.callIndex) {
// Previously active call is not active now.
this._activeCall = null;
}
@ -344,45 +332,26 @@ TelephonyProvider.prototype = {
this._listeners.splice(index, 1);
},
_enumerateCallsForClient: function _enumerateCallsForClient(aClientId,
aListener) {
if (DEBUG) debug("Enumeration of calls for client " + aClientId);
let deferred = Promise.defer();
this._getClient(aClientId).sendWorkerMessage("enumerateCalls", null,
(function(response) {
enumerateCalls: function(aListener) {
if (DEBUG) debug("Requesting enumeration of calls for callback");
gRadioInterface.sendWorkerMessage("enumerateCalls", null,
(function(response) {
for (let call of response.calls) {
call.clienId = aClientId;
call.state = this._convertRILCallState(call.state);
call.isActive = this._matchActiveCall(call);
call.isActive = this._activeCall ?
(call.callIndex == this._activeCall.callIndex) : false;
aListener.enumerateCallState(call.clientId, call.callIndex,
call.state, call.number,
aListener.enumerateCallState(call.callIndex, call.state, call.number,
call.isActive, call.isOutgoing,
call.isEmergency, call.isConference);
}
deferred.resolve();
aListener.enumerateCallStateComplete();
return false;
}).bind(this));
return deferred.promise;
},
enumerateCalls: function(aListener) {
if (DEBUG) debug("Requesting enumeration of calls for callback");
let promise = Promise.resolve();
for (let i = 0; i < this._numClients; ++i) {
promise = promise.then(this._enumerateCallsForClient.bind(this, i, aListener));
}
promise.then(function() {
aListener.enumerateCallStateComplete();
});
},
dial: function(aClientId, aNumber, aIsEmergency) {
dial: function(aNumber, aIsEmergency) {
if (DEBUG) debug("Dialing " + (aIsEmergency ? "emergency " : "") + aNumber);
// we don't try to be too clever here, as the phone is probably in the
// locked state. Let's just check if it's a number without normalizing
@ -390,55 +359,53 @@ TelephonyProvider.prototype = {
aNumber = gPhoneNumberUtils.normalize(aNumber);
}
if (this._validateNumber(aNumber)) {
this._getClient(aClientId).sendWorkerMessage("dial", {
number: aNumber,
isDialEmergency: aIsEmergency
});
gRadioInterface.sendWorkerMessage("dial", { number: aNumber,
isDialEmergency: aIsEmergency });
}
},
hangUp: function(aClientId, aCallIndex) {
this._getClient(aClientId).sendWorkerMessage("hangUp", { callIndex: aCallIndex });
hangUp: function(aCallIndex) {
gRadioInterface.sendWorkerMessage("hangUp", { callIndex: aCallIndex });
},
startTone: function(aClientId, aDtmfChar) {
this._getClient(aClientId).sendWorkerMessage("startTone", { dtmfChar: aDtmfChar });
startTone: function(aDtmfChar) {
gRadioInterface.sendWorkerMessage("startTone", { dtmfChar: aDtmfChar });
},
stopTone: function(aClientId) {
this._getClient(aClientId).sendWorkerMessage("stopTone");
stopTone: function() {
gRadioInterface.sendWorkerMessage("stopTone");
},
answerCall: function(aClientId, aCallIndex) {
this._getClient(aClientId).sendWorkerMessage("answerCall", { callIndex: aCallIndex });
answerCall: function(aCallIndex) {
gRadioInterface.sendWorkerMessage("answerCall", { callIndex: aCallIndex });
},
rejectCall: function(aClientId, aCallIndex) {
this._getClient(aClientId).sendWorkerMessage("rejectCall", { callIndex: aCallIndex });
rejectCall: function(aCallIndex) {
gRadioInterface.sendWorkerMessage("rejectCall", { callIndex: aCallIndex });
},
holdCall: function(aClientId, aCallIndex) {
this._getClient(aClientId).sendWorkerMessage("holdCall", { callIndex: aCallIndex });
holdCall: function(aCallIndex) {
gRadioInterface.sendWorkerMessage("holdCall", { callIndex: aCallIndex });
},
resumeCall: function(aClientId, aCallIndex) {
this._getClient(aClientId).sendWorkerMessage("resumeCall", { callIndex: aCallIndex });
resumeCall: function(aCallIndex) {
gRadioInterface.sendWorkerMessage("resumeCall", { callIndex: aCallIndex });
},
conferenceCall: function conferenceCall(aClientId) {
this._getClient(aClientId).sendWorkerMessage("conferenceCall");
conferenceCall: function conferenceCall() {
gRadioInterface.sendWorkerMessage("conferenceCall");
},
separateCall: function separateCall(aClientId, aCallIndex) {
this._getClient(aClientId).sendWorkerMessage("separateCall", { callIndex: aCallIndex });
separateCall: function separateCall(aCallIndex) {
gRadioInterface.sendWorkerMessage("separateCall", { callIndex: aCallIndex });
},
holdConference: function holdConference(aClientId) {
this._getClient(aClientId).sendWorkerMessage("holdConference");
holdConference: function holdConference() {
gRadioInterface.sendWorkerMessage("holdConference");
},
resumeConference: function resumeConference(aClientId) {
this._getClient(aClientId).sendWorkerMessage("resumeConference");
resumeConference: function resumeConference() {
gRadioInterface.sendWorkerMessage("resumeConference");
},
get microphoneMuted() {
@ -481,7 +448,7 @@ TelephonyProvider.prototype = {
/**
* Handle call disconnects by updating our current state and the audio system.
*/
notifyCallDisconnected: function notifyCallDisconnected(aClientId, aCall) {
notifyCallDisconnected: function notifyCallDisconnected(aCall) {
if (DEBUG) debug("handleCallDisconnected: " + JSON.stringify(aCall));
aCall.state = nsITelephonyProvider.CALL_STATE_DISCONNECTED;
@ -496,8 +463,7 @@ TelephonyProvider.prototype = {
this._updateCallAudioState(aCall, null);
this._notifyAllListeners("callStateChanged", [aClientId,
aCall.callIndex,
this._notifyAllListeners("callStateChanged", [aCall.callIndex,
aCall.state,
aCall.number,
aCall.isActive,
@ -509,8 +475,8 @@ TelephonyProvider.prototype = {
/**
* Handle call error.
*/
notifyCallError: function notifyCallError(aClientId, aCallIndex, aErrorMsg) {
this._notifyAllListeners("notifyError", [aClientId, aCallIndex, aErrorMsg]);
notifyCallError: function notifyCallError(aCallIndex, aErrorMsg) {
this._notifyAllListeners("notifyError", [aCallIndex, aErrorMsg]);
},
/**
@ -531,7 +497,7 @@ TelephonyProvider.prototype = {
* Handle call state changes by updating our current state and the audio
* system.
*/
notifyCallStateChanged: function notifyCallStateChanged(aClientId, aCall) {
notifyCallStateChanged: function notifyCallStateChanged(aCall) {
if (DEBUG) debug("handleCallStateChange: " + JSON.stringify(aCall));
aCall.state = this._convertRILCallState(aCall.state);
@ -541,8 +507,7 @@ TelephonyProvider.prototype = {
this._updateCallAudioState(aCall, null);
this._notifyAllListeners("callStateChanged", [aClientId,
aCall.callIndex,
this._notifyAllListeners("callStateChanged", [aCall.callIndex,
aCall.state,
aCall.number,
aCall.isActive,
@ -551,19 +516,19 @@ TelephonyProvider.prototype = {
aCall.isConference]);
},
notifyCdmaCallWaiting: function notifyCdmaCallWaiting(aClientId, aNumber) {
notifyCdmaCallWaiting: function notifyCdmaCallWaiting(aNumber) {
// We need to acquire a CPU wake lock to avoid the system falling into
// the sleep mode when the RIL handles the incoming call.
this._acquireCallRingWakeLock();
this._notifyAllListeners("notifyCdmaCallWaiting", [aClientId, aNumber]);
this._notifyAllListeners("notifyCdmaCallWaiting", [aNumber]);
},
notifySupplementaryService:
function notifySupplementaryService(aClientId, aCallIndex, aNotification) {
notifySupplementaryService: function notifySupplementaryService(aCallIndex,
aNotification) {
let notification = this._convertRILSuppSvcNotification(aNotification);
this._notifyAllListeners("supplementaryServiceNotification",
[aClientId, aCallIndex, notification]);
[aCallIndex, notification]);
},
notifyConferenceCallStateChanged: function notifyConferenceCallStateChanged(aState) {

View File

@ -17,16 +17,15 @@ sync protocol PTelephony {
manages PTelephonyRequest;
child:
NotifyCallError(uint32_t aClientId, int32_t aCallIndex, nsString aError);
NotifyCallError(int32_t aCallIndex, nsString aError);
NotifyCallStateChanged(uint32_t aClientId, IPCCallStateData aData);
NotifyCallStateChanged(IPCCallStateData aData);
NotifyCdmaCallWaiting(uint32_t aClientId, nsString aNumber);
NotifyCdmaCallWaiting(nsString aNumber);
NotifyConferenceCallStateChanged(uint16_t aCallState);
NotifySupplementaryService(uint32_t aClientId, int32_t aCallIndex,
uint16_t aNotification);
NotifySupplementaryService(int32_t aCallIndex, uint16_t aNotification);
parent:
/**
@ -44,29 +43,29 @@ parent:
UnregisterListener();
DialCall(uint32_t aClientId, nsString aNumber, bool aIsEmergency);
DialCall(nsString aNumber, bool aIsEmergency);
HangUpCall(uint32_t aClientId, uint32_t aCallIndex);
HangUpCall(uint32_t aCallIndex);
AnswerCall(uint32_t aClientId, uint32_t aCallIndex);
AnswerCall(uint32_t aCallIndex);
RejectCall(uint32_t aClientId, uint32_t aCallIndex);
RejectCall(uint32_t aCallIndex);
HoldCall(uint32_t aClientId, uint32_t aCallIndex);
HoldCall(uint32_t aCallIndex);
ResumeCall(uint32_t aClientId, uint32_t aCallIndex);
ResumeCall(uint32_t aCallIndex);
ConferenceCall(uint32_t aClientId);
ConferenceCall();
SeparateCall(uint32_t aClientId, uint32_t aCallIndex);
SeparateCall(uint32_t aCallIndex);
HoldConference(uint32_t aClientId);
HoldConference();
ResumeConference(uint32_t aClientId);
ResumeConference();
StartTone(uint32_t aClientId, nsString aTone);
StartTone(nsString aTone);
StopTone(uint32_t aClientId);
StopTone();
sync GetMicrophoneMuted()
returns (bool aMuted);

View File

@ -16,7 +16,7 @@ protocol PTelephonyRequest
manager PTelephony;
child:
NotifyEnumerateCallState(uint32_t aClientId, IPCCallStateData aData);
NotifyEnumerateCallState(IPCCallStateData aData);
/**
* Sent when the asynchronous request has completed. It's currently only for

View File

@ -37,24 +37,21 @@ TelephonyChild::DeallocPTelephonyRequestChild(PTelephonyRequestChild* aActor)
}
bool
TelephonyChild::RecvNotifyCallError(const uint32_t& aClientId,
const int32_t& aCallIndex,
TelephonyChild::RecvNotifyCallError(const int32_t& aCallIndex,
const nsString& aError)
{
MOZ_ASSERT(mListener);
mListener->NotifyError(aClientId, aCallIndex, aError);
mListener->NotifyError(aCallIndex, aError);
return true;
}
bool
TelephonyChild::RecvNotifyCallStateChanged(const uint32_t& aClientId,
const IPCCallStateData& aData)
TelephonyChild::RecvNotifyCallStateChanged(const IPCCallStateData& aData)
{
MOZ_ASSERT(mListener);
mListener->CallStateChanged(aClientId,
aData.callIndex(),
mListener->CallStateChanged(aData.callIndex(),
aData.callState(),
aData.number(),
aData.isActive(),
@ -65,12 +62,11 @@ TelephonyChild::RecvNotifyCallStateChanged(const uint32_t& aClientId,
}
bool
TelephonyChild::RecvNotifyCdmaCallWaiting(const uint32_t& aClientId,
const nsString& aNumber)
TelephonyChild::RecvNotifyCdmaCallWaiting(const nsString& aNumber)
{
MOZ_ASSERT(mListener);
mListener->NotifyCdmaCallWaiting(aClientId, aNumber);
mListener->NotifyCdmaCallWaiting(aNumber);
return true;
}
@ -84,14 +80,12 @@ TelephonyChild::RecvNotifyConferenceCallStateChanged(const uint16_t& aCallState)
}
bool
TelephonyChild::RecvNotifySupplementaryService(const uint32_t& aClientId,
const int32_t& aCallIndex,
TelephonyChild::RecvNotifySupplementaryService(const int32_t& aCallIndex,
const uint16_t& aNotification)
{
MOZ_ASSERT(mListener);
mListener->SupplementaryServiceNotification(aClientId, aCallIndex,
aNotification);
mListener->SupplementaryServiceNotification(aCallIndex, aNotification);
return true;
}
@ -121,13 +115,11 @@ TelephonyRequestChild::Recv__delete__()
}
bool
TelephonyRequestChild::RecvNotifyEnumerateCallState(const uint32_t& aClientId,
const IPCCallStateData& aData)
TelephonyRequestChild::RecvNotifyEnumerateCallState(const IPCCallStateData& aData)
{
MOZ_ASSERT(mListener);
mListener->EnumerateCallState(aClientId,
aData.callIndex(),
mListener->EnumerateCallState(aData.callIndex(),
aData.callState(),
aData.number(),
aData.isActive(),

View File

@ -31,23 +31,20 @@ protected:
DeallocPTelephonyRequestChild(PTelephonyRequestChild* aActor) MOZ_OVERRIDE;
virtual bool
RecvNotifyCallError(const uint32_t& aClientId, const int32_t& aCallIndex,
RecvNotifyCallError(const int32_t& aCallIndex,
const nsString& aError) MOZ_OVERRIDE;
virtual bool
RecvNotifyCallStateChanged(const uint32_t& aClientId,
const IPCCallStateData& aData) MOZ_OVERRIDE;
RecvNotifyCallStateChanged(const IPCCallStateData& aData) MOZ_OVERRIDE;
virtual bool
RecvNotifyCdmaCallWaiting(const uint32_t& aClientId,
const nsString& aNumber) MOZ_OVERRIDE;
RecvNotifyCdmaCallWaiting(const nsString& aNumber) MOZ_OVERRIDE;
virtual bool
RecvNotifyConferenceCallStateChanged(const uint16_t& aCallState) MOZ_OVERRIDE;
virtual bool
RecvNotifySupplementaryService(const uint32_t& aClientId,
const int32_t& aCallIndex,
RecvNotifySupplementaryService(const int32_t& aCallIndex,
const uint16_t& aNotification) MOZ_OVERRIDE;
private:
@ -69,8 +66,7 @@ protected:
Recv__delete__() MOZ_OVERRIDE;
virtual bool
RecvNotifyEnumerateCallState(const uint32_t& aClientId,
const IPCCallStateData& aData) MOZ_OVERRIDE;
RecvNotifyEnumerateCallState(const IPCCallStateData& aData) MOZ_OVERRIDE;
private:
nsCOMPtr<nsITelephonyListener> mListener;

View File

@ -128,87 +128,87 @@ TelephonyIPCProvider::EnumerateCalls(nsITelephonyListener *aListener)
}
NS_IMETHODIMP
TelephonyIPCProvider::Dial(uint32_t aClientId, const nsAString& aNumber,
bool aIsEmergency)
TelephonyIPCProvider::Dial(const nsAString& aNumber,
bool aIsEmergency)
{
mPTelephonyChild->SendDialCall(aClientId, nsString(aNumber), aIsEmergency);
mPTelephonyChild->SendDialCall(nsString(aNumber), aIsEmergency);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::HangUp(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCProvider::HangUp(uint32_t aCallIndex)
{
mPTelephonyChild->SendHangUpCall(aClientId, aCallIndex);
mPTelephonyChild->SendHangUpCall(aCallIndex);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::AnswerCall(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCProvider::AnswerCall(uint32_t aCallIndex)
{
mPTelephonyChild->SendAnswerCall(aClientId, aCallIndex);
mPTelephonyChild->SendAnswerCall(aCallIndex);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::RejectCall(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCProvider::RejectCall(uint32_t aCallIndex)
{
mPTelephonyChild->SendRejectCall(aClientId, aCallIndex);
mPTelephonyChild->SendRejectCall(aCallIndex);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::HoldCall(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCProvider::HoldCall(uint32_t aCallIndex)
{
mPTelephonyChild->SendHoldCall(aClientId, aCallIndex);
mPTelephonyChild->SendHoldCall(aCallIndex);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::ResumeCall(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCProvider::ResumeCall(uint32_t aCallIndex)
{
mPTelephonyChild->SendResumeCall(aClientId, aCallIndex);
mPTelephonyChild->SendResumeCall(aCallIndex);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::ConferenceCall(uint32_t aClientId)
TelephonyIPCProvider::ConferenceCall()
{
mPTelephonyChild->SendConferenceCall(aClientId);
mPTelephonyChild->SendConferenceCall();
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::SeparateCall(uint32_t aClientId, uint32_t aCallIndex)
TelephonyIPCProvider::SeparateCall(uint32_t aCallIndex)
{
mPTelephonyChild->SendSeparateCall(aClientId, aCallIndex);
mPTelephonyChild->SendSeparateCall(aCallIndex);
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::HoldConference(uint32_t aClientId)
TelephonyIPCProvider::HoldConference()
{
mPTelephonyChild->SendHoldConference(aClientId);
mPTelephonyChild->SendHoldConference();
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::ResumeConference(uint32_t aClientId)
TelephonyIPCProvider::ResumeConference()
{
mPTelephonyChild->SendResumeConference(aClientId);
mPTelephonyChild->SendResumeConference();
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::StartTone(uint32_t aClientId, const nsAString& aDtmfChar)
TelephonyIPCProvider::StartTone(const nsAString& aDtmfChar)
{
mPTelephonyChild->SendStartTone(aClientId, nsString(aDtmfChar));
mPTelephonyChild->SendStartTone(nsString(aDtmfChar));
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::StopTone(uint32_t aClientId)
TelephonyIPCProvider::StopTone()
{
mPTelephonyChild->SendStopTone(aClientId);
mPTelephonyChild->SendStopTone();
return NS_OK;
}
@ -243,17 +243,16 @@ TelephonyIPCProvider::SetSpeakerEnabled(bool aEnabled)
// nsITelephonyListener
NS_IMETHODIMP
TelephonyIPCProvider::CallStateChanged(uint32_t aClientId,
uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference)
TelephonyIPCProvider::CallStateChanged(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
mListeners[i]->CallStateChanged(aClientId, aCallIndex, aCallState, aNumber,
mListeners[i]->CallStateChanged(aCallIndex, aCallState, aNumber,
aIsActive, aIsOutgoing, aIsEmergency,
aIsConference);
}
@ -276,46 +275,42 @@ TelephonyIPCProvider::EnumerateCallStateComplete()
}
NS_IMETHODIMP
TelephonyIPCProvider::EnumerateCallState(uint32_t aClientId,
uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference)
TelephonyIPCProvider::EnumerateCallState(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference)
{
MOZ_CRASH("Not a EnumerateCalls request!");
}
NS_IMETHODIMP
TelephonyIPCProvider::NotifyCdmaCallWaiting(uint32_t aClientId,
const nsAString& aNumber)
TelephonyIPCProvider::NotifyCdmaCallWaiting(const nsAString& aNumber)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
mListeners[i]->NotifyCdmaCallWaiting(aClientId, aNumber);
mListeners[i]->NotifyCdmaCallWaiting(aNumber);
}
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::NotifyError(uint32_t aClientId, int32_t aCallIndex,
const nsAString& aError)
TelephonyIPCProvider::NotifyError(int32_t aCallIndex,
const nsAString& aError)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
mListeners[i]->NotifyError(aClientId, aCallIndex, aError);
mListeners[i]->NotifyError(aCallIndex, aError);
}
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCProvider::SupplementaryServiceNotification(uint32_t aClientId,
int32_t aCallIndex,
uint16_t aNotification)
TelephonyIPCProvider::SupplementaryServiceNotification(int32_t aCallIndex,
uint16_t aNotification)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
mListeners[i]->SupplementaryServiceNotification(aClientId, aCallIndex,
aNotification);
mListeners[i]->SupplementaryServiceNotification(aCallIndex, aNotification);
}
return NS_OK;
}

View File

@ -92,142 +92,135 @@ TelephonyParent::RecvUnregisterListener()
}
bool
TelephonyParent::RecvDialCall(const uint32_t& aClientId,
const nsString& aNumber,
TelephonyParent::RecvDialCall(const nsString& aNumber,
const bool& aIsEmergency)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->Dial(aClientId, aNumber, aIsEmergency);
provider->Dial(aNumber, aIsEmergency);
return true;
}
bool
TelephonyParent::RecvHangUpCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
TelephonyParent::RecvHangUpCall(const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->HangUp(aClientId, aCallIndex);
provider->HangUp(aCallIndex);
return true;
}
bool
TelephonyParent::RecvAnswerCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
TelephonyParent::RecvAnswerCall(const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->AnswerCall(aClientId, aCallIndex);
provider->AnswerCall(aCallIndex);
return true;
}
bool
TelephonyParent::RecvRejectCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
TelephonyParent::RecvRejectCall(const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->RejectCall(aClientId, aCallIndex);
provider->RejectCall(aCallIndex);
return true;
}
bool
TelephonyParent::RecvHoldCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
TelephonyParent::RecvHoldCall(const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->HoldCall(aClientId, aCallIndex);
provider->HoldCall(aCallIndex);
return true;
}
bool
TelephonyParent::RecvResumeCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
TelephonyParent::RecvResumeCall(const uint32_t& aCallIndex)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->ResumeCall(aClientId, aCallIndex);
provider->ResumeCall(aCallIndex);
return true;
}
bool
TelephonyParent::RecvConferenceCall(const uint32_t& aClientId)
TelephonyParent::RecvConferenceCall()
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->ConferenceCall(aClientId);
provider->ConferenceCall();
return true;
}
bool
TelephonyParent::RecvSeparateCall(const uint32_t& aClientId,
const uint32_t& aCallIndex)
TelephonyParent::RecvSeparateCall(const uint32_t& aCallState)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->SeparateCall(aClientId, aCallIndex);
provider->SeparateCall(aCallState);
return true;
}
bool
TelephonyParent::RecvHoldConference(const uint32_t& aClientId)
TelephonyParent::RecvHoldConference()
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->HoldConference(aClientId);
provider->HoldConference();
return true;
}
bool
TelephonyParent::RecvResumeConference(const uint32_t& aClientId)
TelephonyParent::RecvResumeConference()
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->ResumeConference(aClientId);
provider->ResumeConference();
return true;
}
bool
TelephonyParent::RecvStartTone(const uint32_t& aClientId, const nsString& aTone)
TelephonyParent::RecvStartTone(const nsString& aTone)
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->StartTone(aClientId, aTone);
provider->StartTone(aTone);
return true;
}
bool
TelephonyParent::RecvStopTone(const uint32_t& aClientId)
TelephonyParent::RecvStopTone()
{
nsCOMPtr<nsITelephonyProvider> provider =
do_GetService(TELEPHONY_PROVIDER_CONTRACTID);
NS_ENSURE_TRUE(provider, true);
provider->StopTone(aClientId);
provider->StopTone();
return true;
}
@ -282,8 +275,7 @@ TelephonyParent::RecvSetSpeakerEnabled(const bool& aEnabled)
// nsITelephonyListener
NS_IMETHODIMP
TelephonyParent::CallStateChanged(uint32_t aClientId,
uint32_t aCallIndex,
TelephonyParent::CallStateChanged(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
@ -293,9 +285,9 @@ TelephonyParent::CallStateChanged(uint32_t aClientId,
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber),
aIsActive, aIsOutgoing, aIsEmergency, aIsConference);
return SendNotifyCallStateChanged(aClientId, data) ? NS_OK : NS_ERROR_FAILURE;
IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber), aIsActive,
aIsOutgoing, aIsEmergency, aIsConference);
return SendNotifyCallStateChanged(data) ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
@ -314,8 +306,7 @@ TelephonyParent::EnumerateCallStateComplete()
}
NS_IMETHODIMP
TelephonyParent::EnumerateCallState(uint32_t aClientId,
uint32_t aCallIndex,
TelephonyParent::EnumerateCallState(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
@ -327,35 +318,32 @@ TelephonyParent::EnumerateCallState(uint32_t aClientId,
}
NS_IMETHODIMP
TelephonyParent::NotifyCdmaCallWaiting(uint32_t aClientId,
const nsAString& aNumber)
TelephonyParent::NotifyCdmaCallWaiting(const nsAString& aNumber)
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
return SendNotifyCdmaCallWaiting(aClientId, nsString(aNumber))
? NS_OK : NS_ERROR_FAILURE;
return SendNotifyCdmaCallWaiting(nsString(aNumber)) ? NS_OK
: NS_ERROR_FAILURE;
}
NS_IMETHODIMP
TelephonyParent::NotifyError(uint32_t aClientId,
int32_t aCallIndex,
TelephonyParent::NotifyError(int32_t aCallIndex,
const nsAString& aError)
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
return SendNotifyCallError(aClientId, aCallIndex, nsString(aError))
? NS_OK : NS_ERROR_FAILURE;
return SendNotifyCallError(aCallIndex, nsString(aError)) ? NS_OK
: NS_ERROR_FAILURE;
}
NS_IMETHODIMP
TelephonyParent::SupplementaryServiceNotification(uint32_t aClientId,
int32_t aCallIndex,
TelephonyParent::SupplementaryServiceNotification(int32_t aCallIndex,
uint16_t aNotification)
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
return SendNotifySupplementaryService(aClientId, aCallIndex, aNotification)
? NS_OK : NS_ERROR_FAILURE;
return SendNotifySupplementaryService(aCallIndex, aNotification)
? NS_OK : NS_ERROR_FAILURE;
}
/*******************************************************************************
@ -399,8 +387,7 @@ TelephonyRequestParent::DoRequest()
// nsITelephonyListener
NS_IMETHODIMP
TelephonyRequestParent::CallStateChanged(uint32_t aClientId,
uint32_t aCallIndex,
TelephonyRequestParent::CallStateChanged(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
@ -426,8 +413,7 @@ TelephonyRequestParent::EnumerateCallStateComplete()
}
NS_IMETHODIMP
TelephonyRequestParent::EnumerateCallState(uint32_t aClientId,
uint32_t aCallIndex,
TelephonyRequestParent::EnumerateCallState(uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aNumber,
bool aIsActive,
@ -437,30 +423,26 @@ TelephonyRequestParent::EnumerateCallState(uint32_t aClientId,
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber),
aIsActive, aIsOutgoing, aIsEmergency, aIsConference);
return SendNotifyEnumerateCallState(aClientId, data) ? NS_OK
: NS_ERROR_FAILURE;
IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber), aIsActive,
aIsOutgoing, aIsEmergency, aIsConference);
return SendNotifyEnumerateCallState(data) ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
TelephonyRequestParent::NotifyCdmaCallWaiting(uint32_t aClientId,
const nsAString& aNumber)
TelephonyRequestParent::NotifyCdmaCallWaiting(const nsAString& aNumber)
{
MOZ_CRASH("Not a TelephonyParent!");
}
NS_IMETHODIMP
TelephonyRequestParent::NotifyError(uint32_t aClientId,
int32_t aCallIndex,
TelephonyRequestParent::NotifyError(int32_t aCallIndex,
const nsAString& aError)
{
MOZ_CRASH("Not a TelephonyParent!");
}
NS_IMETHODIMP
TelephonyRequestParent::SupplementaryServiceNotification(uint32_t aClientId,
int32_t aCallIndex,
TelephonyRequestParent::SupplementaryServiceNotification(int32_t aCallIndex,
uint16_t aNotification)
{
MOZ_CRASH("Not a TelephonyParent!");

View File

@ -47,40 +47,41 @@ protected:
RecvUnregisterListener() MOZ_OVERRIDE;
virtual bool
RecvDialCall(const uint32_t& aClientId, const nsString& aNumber, const bool& aIsEmergency) MOZ_OVERRIDE;
RecvDialCall(const nsString& aNumber,
const bool& aIsEmergency) MOZ_OVERRIDE;
virtual bool
RecvHangUpCall(const uint32_t& aClientId, const uint32_t& aCallIndex) MOZ_OVERRIDE;
RecvHangUpCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
virtual bool
RecvAnswerCall(const uint32_t& aClientId, const uint32_t& aCallIndex) MOZ_OVERRIDE;
RecvAnswerCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
virtual bool
RecvRejectCall(const uint32_t& aClientId, const uint32_t& aCallIndex) MOZ_OVERRIDE;
RecvRejectCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
virtual bool
RecvHoldCall(const uint32_t& aClientId, const uint32_t& aCallIndex) MOZ_OVERRIDE;
RecvHoldCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
virtual bool
RecvResumeCall(const uint32_t& aClientId, const uint32_t& aCallIndex) MOZ_OVERRIDE;
RecvResumeCall(const uint32_t& aCallIndex) MOZ_OVERRIDE;
virtual bool
RecvConferenceCall(const uint32_t& aClientId) MOZ_OVERRIDE;
RecvConferenceCall() MOZ_OVERRIDE;
virtual bool
RecvSeparateCall(const uint32_t& aClientId, const uint32_t& callIndex) MOZ_OVERRIDE;
RecvSeparateCall(const uint32_t& callIndex) MOZ_OVERRIDE;
virtual bool
RecvHoldConference(const uint32_t& aClientId) MOZ_OVERRIDE;
RecvHoldConference() MOZ_OVERRIDE;
virtual bool
RecvResumeConference(const uint32_t& aClientId) MOZ_OVERRIDE;
RecvResumeConference() MOZ_OVERRIDE;
virtual bool
RecvStartTone(const uint32_t& aClientId, const nsString& aTone) MOZ_OVERRIDE;
RecvStartTone(const nsString& aTone) MOZ_OVERRIDE;
virtual bool
RecvStopTone(const uint32_t& aClientId) MOZ_OVERRIDE;
RecvStopTone() MOZ_OVERRIDE;
virtual bool
RecvGetMicrophoneMuted(bool* aMuted) MOZ_OVERRIDE;

View File

@ -10,21 +10,21 @@
"@mozilla.org/telephony/gonktelephonyprovider;1"
%}
[scriptable, uuid(fe113e67-5a15-49e6-a555-7f41409f611a)]
[scriptable, uuid(f072f334-e4ea-4754-9929-533da30444a8)]
interface nsIGonkTelephonyProvider : nsITelephonyProvider
{
void notifyCallDisconnected(in unsigned long clientId, in jsval call);
void notifyCallDisconnected(in jsval call);
void notifyCallError(in unsigned long clientId, in long callIndex,
void notifyCallError(in long callIndex,
in AString error);
void notifyCallRing();
void notifyCallStateChanged(in unsigned long clientId, in jsval call);
void notifyCallStateChanged(in jsval call);
void notifyCdmaCallWaiting(in unsigned long clientId, in AString number);
void notifyCdmaCallWaiting(in AString number);
void notifySupplementaryService(in unsigned long clientId, in long callIndex,
void notifySupplementaryService(in long callIndex,
in AString notification);
void notifyConferenceCallStateChanged(in short state);

View File

@ -4,14 +4,12 @@
#include "nsISupports.idl"
[scriptable, uuid(707c4c43-a0d7-4093-af52-d4d6a3a333c3)]
[scriptable, uuid(3aa42e77-7c2b-43a1-b105-7be094b0817a)]
interface nsITelephonyListener : nsISupports
{
/**
* Notified when a telephony call changes state.
*
* @param clientId
Indicate the RIL client, 0 ~ (number of client - 1).
* @param callIndex
* Call identifier assigned by the RIL.
* @param callState
@ -27,8 +25,7 @@ interface nsITelephonyListener : nsISupports
* @param isConference
* Indicates whether this call is a conference call.
*/
void callStateChanged(in unsigned long clientId,
in unsigned long callIndex,
void callStateChanged(in unsigned long callIndex,
in unsigned short callState,
in AString number,
in boolean isActive,
@ -58,8 +55,6 @@ interface nsITelephonyListener : nsISupports
* telephony call state (nsITelephonyProvider::enumerateCalls). This is
* called once per call that is currently managed by the RIL.
*
* @param clientId
Indicate the RIL client, 0 ~ (number of client - 1).
* @param callIndex
* Call identifier assigned by the RIL.
* @param callState
@ -73,8 +68,7 @@ interface nsITelephonyListener : nsISupports
* @param isConference
* Indicates whether this call is a conference call.
*/
void enumerateCallState(in unsigned long clientId,
in unsigned long callIndex,
void enumerateCallState(in unsigned long callIndex,
in unsigned short callState,
in AString number,
in boolean isActive,
@ -85,40 +79,32 @@ interface nsITelephonyListener : nsISupports
/**
* Notify when RIL receives supplementary service notification.
*
* @param clientId
Indicate the RIL client, 0 ~ (number of client - 1).
* @param callIndex
* Call identifier assigned by the RIL. -1 if not specified
* @param notification
* One of the nsITelephonyProvider::NOTIFICATION_* values.
*/
void supplementaryServiceNotification(in unsigned long clientId,
in long callIndex,
void supplementaryServiceNotification(in long callIndex,
in unsigned short notification);
/**
* Called when RIL error occurs.
*
* @param clientId
Indicate the RIL client, 0 ~ (number of client - 1).
* @param callIndex
* Call identifier assigned by the RIL. -1 if no connection
* @param error
* Error from RIL.
*/
void notifyError(in unsigned long clientId,
in long callIndex,
void notifyError(in long callIndex,
in AString error);
/**
* Called when a waiting call comes in CDMA networks.
*
* @param clientId
Indicate the RIL client, 0 ~ (number of client - 1).
* @param number
* Number of the other party.
*/
void notifyCdmaCallWaiting(in unsigned long clientId, in AString number);
void notifyCdmaCallWaiting(in AString number);
};
%{C++
@ -132,7 +118,7 @@ interface nsITelephonyListener : nsISupports
* XPCOM component (in the content process) that provides the telephony
* information.
*/
[scriptable, uuid(4ff3ecb7-b024-4752-9dd6-c3623c6e6b8a)]
[scriptable, uuid(f7680b82-53fc-42a7-9adf-bc0f2726425c)]
interface nsITelephonyProvider : nsISupports
{
const unsigned short CALL_STATE_UNKNOWN = 0;
@ -169,22 +155,22 @@ interface nsITelephonyProvider : nsISupports
/**
* Functionality for making and managing phone calls.
*/
void dial(in unsigned long clientId, in DOMString number,
void dial(in DOMString number,
in boolean isEmergency);
void hangUp(in unsigned long clientId, in unsigned long callIndex);
void hangUp(in unsigned long callIndex);
void startTone(in unsigned long clientId, in DOMString dtmfChar);
void stopTone(in unsigned long clientId);
void startTone(in DOMString dtmfChar);
void stopTone();
void answerCall(in unsigned long clientId, in unsigned long callIndex);
void rejectCall(in unsigned long clientId, in unsigned long callIndex);
void holdCall(in unsigned long clientId, in unsigned long callIndex);
void resumeCall(in unsigned long clientId, in unsigned long callIndex);
void answerCall(in unsigned long callIndex);
void rejectCall(in unsigned long callIndex);
void holdCall(in unsigned long callIndex);
void resumeCall(in unsigned long callIndex);
void conferenceCall(in unsigned long clientId);
void separateCall(in unsigned long clientId, in unsigned long callIndex);
void holdConference(in unsigned long clientId);
void resumeConference(in unsigned long clientId);
void conferenceCall();
void separateCall(in unsigned long callIndex);
void holdConference();
void resumeConference();
attribute bool microphoneMuted;
attribute bool speakerEnabled;

View File

@ -6,31 +6,13 @@
[Pref="dom.telephony.enabled"]
interface Telephony : EventTarget {
/**
* There are multiple telephony services in multi-sim architecture. We use
* |serviceId| to indicate the target telephony service. If not specified,
* the implementation MUST use the default service.
*
* Possible values of |serviceId| are 0 ~ (number of services - 1), which is
* simply the index of a service. Get number of services by acquiring
* |navigator.mozMobileConnections.length|.
*/
[Throws]
TelephonyCall dial(DOMString number, optional unsigned long serviceId);
TelephonyCall dial(DOMString number);
[Throws]
TelephonyCall dialEmergency(DOMString number, optional unsigned long serviceId);
[Throws]
void startTone(DOMString tone, optional unsigned long serviceId);
[Throws]
void stopTone(optional unsigned long serviceId);
TelephonyCall dialEmergency(DOMString number);
[Throws]
attribute boolean muted;
[Throws]
attribute boolean speakerEnabled;
@ -40,6 +22,11 @@ interface Telephony : EventTarget {
readonly attribute CallsList calls;
readonly attribute TelephonyCallGroup conferenceGroup;
[Throws]
void startTone(DOMString tone);
[Throws]
void stopTone();
attribute EventHandler onincoming;
attribute EventHandler oncallschanged;
attribute EventHandler onremoteheld;

View File

@ -6,9 +6,6 @@
[Pref="dom.telephony.enabled"]
interface TelephonyCall : EventTarget {
// Indicate which service the call comes from.
readonly attribute unsigned long serviceId;
readonly attribute DOMString number;
// In CDMA networks, the 2nd waiting call shares the connection with the 1st