зеркало из https://github.com/mozilla/gecko-dev.git
Bug 881174 - part4 - cdma 3way call DOM and IPC. r=vicamo
This commit is contained in:
Родитель
62be8a001c
Коммит
535c668bf1
|
@ -536,7 +536,7 @@ NS_IMETHODIMP
|
|||
Telephony::CallStateChanged(uint32_t aServiceId, uint32_t aCallIndex,
|
||||
uint16_t aCallState, const nsAString& aNumber,
|
||||
bool aIsActive, bool aIsOutgoing, bool aIsEmergency,
|
||||
bool aIsConference)
|
||||
bool aIsConference, bool aIsSwitchable, bool aIsMergeable)
|
||||
{
|
||||
NS_ASSERTION(aCallIndex != kOutgoingPlaceholderCallIndex,
|
||||
"This should never happen!");
|
||||
|
@ -559,6 +559,9 @@ Telephony::CallStateChanged(uint32_t aServiceId, uint32_t aCallIndex,
|
|||
}
|
||||
|
||||
if (modifiedCall) {
|
||||
modifiedCall->UpdateSwitchable(aIsSwitchable);
|
||||
modifiedCall->UpdateMergeable(aIsMergeable);
|
||||
|
||||
if (!aIsConference) {
|
||||
UpdateActiveCall(modifiedCall, aIsActive);
|
||||
}
|
||||
|
@ -599,7 +602,8 @@ Telephony::CallStateChanged(uint32_t aServiceId, uint32_t aCallIndex,
|
|||
// 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);
|
||||
aIsEmergency, aIsConference, aIsSwitchable,
|
||||
aIsMergeable);
|
||||
NS_ASSERTION(call, "This should never fail!");
|
||||
|
||||
NS_ASSERTION(aIsConference ? mGroup->CallsArray().Contains(call) :
|
||||
|
@ -638,7 +642,7 @@ NS_IMETHODIMP
|
|||
Telephony::EnumerateCallState(uint32_t aServiceId, uint32_t aCallIndex,
|
||||
uint16_t aCallState, const nsAString& aNumber,
|
||||
bool aIsActive, bool aIsOutgoing, bool aIsEmergency,
|
||||
bool aIsConference)
|
||||
bool aIsConference, bool aIsSwitchable, bool aIsMergeable)
|
||||
{
|
||||
nsRefPtr<TelephonyCall> call;
|
||||
|
||||
|
@ -654,7 +658,8 @@ Telephony::EnumerateCallState(uint32_t aServiceId, uint32_t aCallIndex,
|
|||
|
||||
// Didn't know anything about this call before now.
|
||||
call = TelephonyCall::Create(this, aServiceId, aNumber, aCallState,
|
||||
aCallIndex, aIsEmergency, aIsConference);
|
||||
aCallIndex, aIsEmergency, aIsConference,
|
||||
aIsSwitchable, aIsMergeable);
|
||||
NS_ASSERTION(call, "This should never fail!");
|
||||
|
||||
NS_ASSERTION(aIsConference ? mGroup->CallsArray().Contains(call) :
|
||||
|
|
|
@ -21,7 +21,8 @@ using mozilla::dom::telephony::kOutgoingPlaceholderCallIndex;
|
|||
already_AddRefed<TelephonyCall>
|
||||
TelephonyCall::Create(Telephony* aTelephony, uint32_t aServiceId,
|
||||
const nsAString& aNumber, uint16_t aCallState,
|
||||
uint32_t aCallIndex, bool aEmergency, bool aIsConference)
|
||||
uint32_t aCallIndex, bool aEmergency, bool aIsConference,
|
||||
bool aSwitchable, bool aMergeable)
|
||||
{
|
||||
NS_ASSERTION(aTelephony, "Null pointer!");
|
||||
NS_ASSERTION(!aNumber.IsEmpty(), "Empty number!");
|
||||
|
@ -36,6 +37,8 @@ TelephonyCall::Create(Telephony* aTelephony, uint32_t aServiceId,
|
|||
call->mError = nullptr;
|
||||
call->mEmergency = aEmergency;
|
||||
call->mGroup = aIsConference ? aTelephony->ConferenceGroup() : nullptr;
|
||||
call->mSwitchable = aSwitchable;
|
||||
call->mMergeable = aMergeable;
|
||||
|
||||
call->ChangeStateInternal(aCallState, false);
|
||||
|
||||
|
@ -255,6 +258,11 @@ TelephonyCall::Hold(ErrorResult& aRv)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!mSwitchable) {
|
||||
NS_WARNING("Hold a non-switchable call ignored!");
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult rv = mTelephony->Provider()->HoldCall(mServiceId, mCallIndex);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
|
@ -284,6 +292,11 @@ TelephonyCall::Resume(ErrorResult& aRv)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!mSwitchable) {
|
||||
NS_WARNING("Resume a non-switchable call ignored!");
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult rv = mTelephony->Provider()->ResumeCall(mServiceId, mCallIndex);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
|
|
|
@ -27,6 +27,8 @@ class TelephonyCall MOZ_FINAL : public nsDOMEventTargetHelper
|
|||
nsString mState;
|
||||
bool mEmergency;
|
||||
nsRefPtr<DOMError> mError;
|
||||
bool mSwitchable;
|
||||
bool mMergeable;
|
||||
|
||||
uint32_t mCallIndex;
|
||||
uint16_t mCallState;
|
||||
|
@ -75,6 +77,18 @@ public:
|
|||
return mEmergency;
|
||||
}
|
||||
|
||||
bool
|
||||
Switchable() const
|
||||
{
|
||||
return mSwitchable;
|
||||
}
|
||||
|
||||
bool
|
||||
Mergeable() const
|
||||
{
|
||||
return mMergeable;
|
||||
}
|
||||
|
||||
already_AddRefed<DOMError>
|
||||
GetError() const;
|
||||
|
||||
|
@ -110,7 +124,8 @@ public:
|
|||
Create(Telephony* aTelephony, uint32_t aServiceId,
|
||||
const nsAString& aNumber, uint16_t aCallState,
|
||||
uint32_t aCallIndex = telephony::kOutgoingPlaceholderCallIndex,
|
||||
bool aEmergency = false, bool aIsConference = false);
|
||||
bool aEmergency = false, bool aIsConference = false,
|
||||
bool aSwitchable = true, bool aMergeable = true);
|
||||
|
||||
void
|
||||
ChangeState(uint16_t aCallState)
|
||||
|
@ -156,6 +171,16 @@ public:
|
|||
mSecondNumber = aNumber;
|
||||
}
|
||||
|
||||
void
|
||||
UpdateSwitchable(bool aSwitchable) {
|
||||
mSwitchable = aSwitchable;
|
||||
}
|
||||
|
||||
void
|
||||
UpdateMergeable(bool aMergeable) {
|
||||
mMergeable = aMergeable;
|
||||
}
|
||||
|
||||
void
|
||||
NotifyError(const nsAString& aError);
|
||||
|
||||
|
|
|
@ -150,6 +150,10 @@ bool
|
|||
TelephonyCallGroup::CanConference(const TelephonyCall& aCall,
|
||||
TelephonyCall* aSecondCall)
|
||||
{
|
||||
if (!aCall.Mergeable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!aSecondCall) {
|
||||
MOZ_ASSERT(!mCalls.IsEmpty());
|
||||
|
||||
|
@ -165,6 +169,10 @@ TelephonyCallGroup::CanConference(const TelephonyCall& aCall,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!aSecondCall->Mergeable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (aCall.CallState() == nsITelephonyProvider::CALL_STATE_CONNECTED &&
|
||||
aSecondCall->CallState() == nsITelephonyProvider::CALL_STATE_HELD) ||
|
||||
(aCall.CallState() == nsITelephonyProvider::CALL_STATE_HELD &&
|
||||
|
|
|
@ -60,7 +60,9 @@ TelephonyChild::RecvNotifyCallStateChanged(const uint32_t& aClientId,
|
|||
aData.isActive(),
|
||||
aData.isOutGoing(),
|
||||
aData.isEmergency(),
|
||||
aData.isConference());
|
||||
aData.isConference(),
|
||||
aData.isSwitchable(),
|
||||
aData.isMergeable());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -152,7 +154,9 @@ TelephonyRequestChild::RecvNotifyEnumerateCallState(const uint32_t& aClientId,
|
|||
aData.isActive(),
|
||||
aData.isOutGoing(),
|
||||
aData.isEmergency(),
|
||||
aData.isConference());
|
||||
aData.isConference(),
|
||||
aData.isSwitchable(),
|
||||
aData.isMergeable());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -258,12 +258,14 @@ TelephonyIPCProvider::CallStateChanged(uint32_t aClientId,
|
|||
bool aIsActive,
|
||||
bool aIsOutgoing,
|
||||
bool aIsEmergency,
|
||||
bool aIsConference)
|
||||
bool aIsConference,
|
||||
bool aIsSwitchable,
|
||||
bool aIsMergeable)
|
||||
{
|
||||
for (uint32_t i = 0; i < mListeners.Length(); i++) {
|
||||
mListeners[i]->CallStateChanged(aClientId, aCallIndex, aCallState, aNumber,
|
||||
aIsActive, aIsOutgoing, aIsEmergency,
|
||||
aIsConference);
|
||||
aIsConference, aIsSwitchable, aIsMergeable);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -291,7 +293,9 @@ TelephonyIPCProvider::EnumerateCallState(uint32_t aClientId,
|
|||
bool aIsActive,
|
||||
bool aIsOutgoing,
|
||||
bool aIsEmergency,
|
||||
bool aIsConference)
|
||||
bool aIsConference,
|
||||
bool aIsSwitchable,
|
||||
bool aIsMergeable)
|
||||
{
|
||||
MOZ_CRASH("Not a EnumerateCalls request!");
|
||||
}
|
||||
|
|
|
@ -286,12 +286,15 @@ TelephonyParent::CallStateChanged(uint32_t aClientId,
|
|||
bool aIsActive,
|
||||
bool aIsOutgoing,
|
||||
bool aIsEmergency,
|
||||
bool aIsConference)
|
||||
bool aIsConference,
|
||||
bool aIsSwitchable,
|
||||
bool aIsMergeable)
|
||||
{
|
||||
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
|
||||
|
||||
IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber),
|
||||
aIsActive, aIsOutgoing, aIsEmergency, aIsConference);
|
||||
aIsActive, aIsOutgoing, aIsEmergency, aIsConference,
|
||||
aIsSwitchable, aIsMergeable);
|
||||
return SendNotifyCallStateChanged(aClientId, data) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -318,7 +321,9 @@ TelephonyParent::EnumerateCallState(uint32_t aClientId,
|
|||
bool aIsActive,
|
||||
bool aIsOutgoing,
|
||||
bool aIsEmergency,
|
||||
bool aIsConference)
|
||||
bool aIsConference,
|
||||
bool aIsSwitchable,
|
||||
bool aIsMergeable)
|
||||
{
|
||||
MOZ_CRASH("Not a EnumerateCalls request!");
|
||||
}
|
||||
|
@ -430,7 +435,9 @@ TelephonyRequestParent::CallStateChanged(uint32_t aClientId,
|
|||
bool aIsActive,
|
||||
bool aIsOutgoing,
|
||||
bool aIsEmergency,
|
||||
bool aIsConference)
|
||||
bool aIsConference,
|
||||
bool aIsSwitchable,
|
||||
bool aIsMergeable)
|
||||
{
|
||||
MOZ_CRASH("Not a TelephonyParent!");
|
||||
}
|
||||
|
@ -457,12 +464,15 @@ TelephonyRequestParent::EnumerateCallState(uint32_t aClientId,
|
|||
bool aIsActive,
|
||||
bool aIsOutgoing,
|
||||
bool aIsEmergency,
|
||||
bool aIsConference)
|
||||
bool aIsConference,
|
||||
bool aIsSwitchable,
|
||||
bool aIsMergeable)
|
||||
{
|
||||
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
|
||||
|
||||
IPCCallStateData data(aCallIndex, aCallState, nsString(aNumber),
|
||||
aIsActive, aIsOutgoing, aIsEmergency, aIsConference);
|
||||
aIsActive, aIsOutgoing, aIsEmergency, aIsConference,
|
||||
aIsSwitchable, aIsMergeable);
|
||||
return SendNotifyEnumerateCallState(aClientId, data) ? NS_OK
|
||||
: NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ struct IPCCallStateData
|
|||
bool isOutGoing;
|
||||
bool isEmergency;
|
||||
bool isConference;
|
||||
bool isSwitchable;
|
||||
bool isMergeable;
|
||||
};
|
||||
|
||||
} /* namespace telephony */
|
||||
|
|
Загрузка…
Ссылка в новой задаче