Backed out 4 changesets (bug 1147736)

Backed out changeset 80ad8826d772 (bug 1147736)
Backed out changeset 1f69ddad07bb (bug 1147736)
Backed out changeset 34aee78127f5 (bug 1147736)
Backed out changeset 8a8c735fb984 (bug 1147736)
This commit is contained in:
Naoki Hirata 2015-05-13 14:15:57 -07:00
parent 30638677af
commit 9215df432a
14 changed files with 139 additions and 98 deletions

View File

@ -203,23 +203,16 @@ TelephonyListener::HandleCallInfo(nsITelephonyCallInfo* aInfo, bool aSend)
uint32_t callIndex;
uint16_t callState;
nsAutoString number;
nsAutoString disconnectedReason;
bool isOutgoing;
bool isConference;
aInfo->GetCallIndex(&callIndex);
aInfo->GetCallState(&callState);
aInfo->GetNumber(number);
aInfo->GetDisconnectedReason(disconnectedReason);
aInfo->GetIsOutgoing(&isOutgoing);
aInfo->GetIsConference(&isConference);
// The disconnectedReason of a disconnected call must be nonempty no matter
// the call is disconnected for a normal reason or an error.
MOZ_ASSERT((callState != nsITelephonyService::CALL_STATE_DISCONNECTED ||
!disconnectedReason.IsEmpty()),
"disconnectedReason of an disconnected call must be nonempty.");
hfp->HandleCallStateChanged(callIndex, callState, disconnectedReason, number,
hfp->HandleCallStateChanged(callIndex, callState, EmptyString(), number,
isOutgoing, isConference, aSend);
return NS_OK;
}
@ -240,6 +233,30 @@ TelephonyListener::EnumerateCallState(nsITelephonyCallInfo* aInfo)
return HandleCallInfo(aInfo, false);
}
NS_IMETHODIMP
TelephonyListener::NotifyError(uint32_t aServiceId,
int32_t aCallIndex,
const nsAString& aError)
{
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
NS_ENSURE_TRUE(hfp, NS_ERROR_FAILURE);
if (aCallIndex > 0) {
// In order to not miss any related call state transition.
// It's possible that 3G network signal lost for unknown reason.
// If a call is released abnormally, NotifyError() will be called,
// instead of CallStateChanged(). We need to reset the call array state
// via setting CALL_STATE_DISCONNECTED
hfp->HandleCallStateChanged(aCallIndex,
nsITelephonyService::CALL_STATE_DISCONNECTED,
aError, EmptyString(), false, false, true);
BT_WARNING("Reset the call state due to call transition ends abnormally");
}
BT_WARNING(NS_ConvertUTF16toUTF8(aError).get());
return NS_OK;
}
NS_IMETHODIMP
TelephonyListener::ConferenceCallStateChanged(uint16_t aCallState)
{

View File

@ -375,14 +375,10 @@ Telephony::HandleCallInfo(nsITelephonyCallInfo* aInfo)
nsRefPtr<TelephonyCallId> id = call->Id();
id->UpdateNumber(number);
nsAutoString disconnectedReason;
aInfo->GetDisconnectedReason(disconnectedReason);
// State changed.
if (call->CallState() != callState) {
if (callState == nsITelephonyService::CALL_STATE_DISCONNECTED) {
call->UpdateDisconnectedReason(disconnectedReason);
call->ChangeState(nsITelephonyService::CALL_STATE_DISCONNECTED);
call->ChangeStateInternal(callState, true);
return NS_OK;
}
@ -691,6 +687,26 @@ Telephony::SupplementaryServiceNotification(uint32_t aServiceId,
return NS_OK;
}
NS_IMETHODIMP
Telephony::NotifyError(uint32_t aServiceId,
int32_t aCallIndex,
const nsAString& aError)
{
nsRefPtr<TelephonyCall> callToNotify =
GetCallFromEverywhere(aServiceId, aCallIndex);
if (!callToNotify) {
NS_ERROR("Don't call me with a bad call index!");
return NS_ERROR_UNEXPECTED;
}
// Set the call state to 'disconnected' and remove it from the calls list.
callToNotify->UpdateDisconnectedReason(aError);
callToNotify->NotifyError(aError);
callToNotify->ChangeState(nsITelephonyService::CALL_STATE_DISCONNECTED);
return NS_OK;
}
NS_IMETHODIMP
Telephony::NotifyCdmaCallWaiting(uint32_t aServiceId, const nsAString& aNumber,
uint16_t aNumberPresentation,

View File

@ -119,6 +119,7 @@ TelephonyCall::ChangeStateInternal(uint16_t aCallState, bool aFireEvents)
} else {
mTelephony->RemoveCall(this);
}
UpdateDisconnectedReason(NS_LITERAL_STRING("NormalCallClearingError"));
} else if (!mLive) {
mLive = true;
if (mGroup) {
@ -195,23 +196,16 @@ TelephonyCall::NotifyError(const nsAString& aError)
void
TelephonyCall::UpdateDisconnectedReason(const nsAString& aDisconnectedReason)
{
NS_ASSERTION(Substring(aDisconnectedReason,
aDisconnectedReason.Length() - 5).EqualsLiteral("Error"),
NS_ASSERTION(Substring(aDisconnectedReason, aDisconnectedReason.Length() - 5).EqualsLiteral("Error"),
"Disconnected reason should end with 'Error'");
if (!mDisconnectedReason.IsNull()) {
return;
}
// There is no 'Error' suffix in the corresponding enum. We should skip
// that part for comparison.
CONVERT_STRING_TO_NULLABLE_ENUM(
Substring(aDisconnectedReason, 0, aDisconnectedReason.Length() - 5),
TelephonyCallDisconnectedReason,
mDisconnectedReason);
if (!aDisconnectedReason.EqualsLiteral("NormalCallClearingError")) {
NotifyError(aDisconnectedReason);
if (mDisconnectedReason.IsNull()) {
// There is no 'Error' suffix in the corresponding enum. We should skip
// that part for comparison.
CONVERT_STRING_TO_NULLABLE_ENUM(
Substring(aDisconnectedReason, 0, aDisconnectedReason.Length() - 5),
TelephonyCallDisconnectedReason,
mDisconnectedReason);
}
}

View File

@ -15,13 +15,10 @@ NS_IMPL_ISUPPORTS(TelephonyCallInfo, nsITelephonyCallInfo)
TelephonyCallInfo::TelephonyCallInfo(uint32_t aClientId,
uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aDisconnectedReason,
const nsAString& aNumber,
uint16_t aNumberPresentation,
const nsAString& aName,
uint16_t aNamePresentation,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference,
@ -30,13 +27,10 @@ TelephonyCallInfo::TelephonyCallInfo(uint32_t aClientId,
: mClientId(aClientId),
mCallIndex(aCallIndex),
mCallState(aCallState),
mDisconnectedReason(aDisconnectedReason),
mNumber(aNumber),
mNumberPresentation(aNumberPresentation),
mName(aName),
mNamePresentation(aNamePresentation),
mIsOutgoing(aIsOutgoing),
mIsEmergency(aIsEmergency),
mIsConference(aIsConference),
@ -66,13 +60,6 @@ TelephonyCallInfo::GetCallState(uint16_t* aCallState)
return NS_OK;
}
NS_IMETHODIMP
TelephonyCallInfo::GetDisconnectedReason(nsAString& aDisconnectedReason)
{
aDisconnectedReason = mDisconnectedReason;
return NS_OK;
}
NS_IMETHODIMP
TelephonyCallInfo::GetNumber(nsAString& aNumber)
{

View File

@ -21,21 +21,12 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSITELEPHONYCALLINFO
TelephonyCallInfo(uint32_t aClientId,
uint32_t aCallIndex,
uint16_t aCallState,
const nsAString& aDisconnectedReason,
const nsAString& aNumber,
uint16_t aNumberPresentation,
const nsAString& aName,
uint16_t aNamePresentation,
bool aIsOutgoing,
bool aIsEmergency,
bool aIsConference,
bool aIsSwitchable,
bool aIsMergeable);
TelephonyCallInfo(uint32_t aClientId, uint32_t aCallIndex,
uint16_t aCallState, const nsAString& aNumber,
uint16_t aNumberPresentation, const nsAString& aName,
uint16_t aNamePresentation, bool aIsOutgoing,
bool aIsEmergency, bool aIsConference,
bool aIsSwitchable, bool aIsMergeable);
private:
// Don't try to use the default constructor.
@ -46,13 +37,10 @@ private:
uint32_t mClientId;
uint32_t mCallIndex;
uint16_t mCallState;
nsString mDisconnectedReason;
nsString mNumber;
uint16_t mNumberPresentation;
nsString mName;
uint16_t mNamePresentation;
bool mIsOutgoing;
bool mIsEmergency;
bool mIsConference;

View File

@ -124,13 +124,10 @@ function TelephonyCallInfo(aCall) {
this.clientId = aCall.clientId;
this.callIndex = aCall.callIndex;
this.callState = aCall.state;
this.disconnectedReason = aCall.disconnectedReason || "";
this.number = aCall.number;
this.numberPresentation = aCall.numberPresentation;
this.name = aCall.name;
this.namePresentation = aCall.namePresentation;
this.isOutgoing = aCall.isOutgoing;
this.isEmergency = aCall.isEmergency;
this.isConference = aCall.isConference;
@ -151,13 +148,10 @@ TelephonyCallInfo.prototype = {
clientId: 0,
callIndex: 0,
callState: nsITelephonyService.CALL_STATE_UNKNOWN,
disconnectedReason: "",
number: "",
numberPresentation: nsITelephonyService.CALL_PRESENTATION_ALLOWED,
name: "",
namePresentation: nsITelephonyService.CALL_PRESENTATION_ALLOWED,
isOutgoing: true,
isEmergency: false,
isConference: false,
@ -1444,6 +1438,10 @@ TelephonyService.prototype = {
* calls being disconnected as well.
*
* @return Array a list of calls we need to fire callStateChange
*
* TODO: The list currently doesn't contain calls that we fire notifyError
* for them. However, after Bug 1147736, notifyError is replaced by
* callStateChanged and those calls should be included in the list.
*/
_disconnectCalls: function(aClientId, aCalls,
aFailCause = RIL.GECKO_CALL_ERROR_NORMAL_CALL_CLEARING) {
@ -1467,7 +1465,7 @@ TelephonyService.prototype = {
disconnectedCalls.forEach(call => {
call.state = nsITelephonyService.CALL_STATE_DISCONNECTED;
call.disconnectedReason = aFailCause;
call.failCause = aFailCause;
if (call.parentId) {
let parentCall = this._currentCalls[aClientId][call.parentId];
@ -1476,7 +1474,13 @@ TelephonyService.prototype = {
this._notifyCallEnded(call);
callsForStateChanged.push(call);
if (call.hangUpLocal || !call.failCause ||
call.failCause === RIL.GECKO_CALL_ERROR_NORMAL_CALL_CLEARING) {
callsForStateChanged.push(call);
} else {
this._notifyAllListeners("notifyError",
[aClientId, call.callIndex, call.failCause]);
}
delete this._currentCalls[aClientId][call.callIndex];
});

View File

@ -125,6 +125,8 @@ sync protocol PTelephony {
manages PTelephonyRequest;
child:
NotifyCallError(uint32_t aClientId, int32_t aCallIndex, nsString aError);
NotifyCallStateChanged(nsTelephonyCallInfo[] aAllInfo);
NotifyCdmaCallWaiting(uint32_t aClientId, IPCCdmaWaitingCallData aData);

View File

@ -47,6 +47,17 @@ TelephonyChild::DeallocPTelephonyRequestChild(PTelephonyRequestChild* aActor)
return true;
}
bool
TelephonyChild::RecvNotifyCallError(const uint32_t& aClientId,
const int32_t& aCallIndex,
const nsString& aError)
{
MOZ_ASSERT(mService);
mService->NotifyError(aClientId, aCallIndex, aError);
return true;
}
bool
TelephonyChild::RecvNotifyCallStateChanged(nsTArray<nsITelephonyCallInfo*>&& aAllInfo)
{

View File

@ -34,6 +34,10 @@ protected:
virtual bool
DeallocPTelephonyRequestChild(PTelephonyRequestChild* aActor) override;
virtual bool
RecvNotifyCallError(const uint32_t& aClientId, const int32_t& aCallIndex,
const nsString& aError) override;
virtual bool
RecvNotifyCallStateChanged(nsTArray<nsITelephonyCallInfo*>&& aAllInfo) override;

View File

@ -90,13 +90,10 @@ struct ParamTraits<nsITelephonyCallInfo*>
uint32_t clientId;
uint32_t callIndex;
uint16_t callState;
nsString disconnectedReason;
nsString number;
uint16_t numberPresentation;
nsString name;
uint16_t namePresentation;
bool isOutgoing;
bool isEmergency;
bool isConference;
@ -107,13 +104,10 @@ struct ParamTraits<nsITelephonyCallInfo*>
if (!(ReadParam(aMsg, aIter, &clientId) &&
ReadParam(aMsg, aIter, &callIndex) &&
ReadParam(aMsg, aIter, &callState) &&
ReadParam(aMsg, aIter, &disconnectedReason) &&
ReadParam(aMsg, aIter, &number) &&
ReadParam(aMsg, aIter, &numberPresentation) &&
ReadParam(aMsg, aIter, &name) &&
ReadParam(aMsg, aIter, &namePresentation) &&
ReadParam(aMsg, aIter, &isOutgoing) &&
ReadParam(aMsg, aIter, &isEmergency) &&
ReadParam(aMsg, aIter, &isConference) &&
@ -123,21 +117,10 @@ struct ParamTraits<nsITelephonyCallInfo*>
}
nsCOMPtr<nsITelephonyCallInfo> info =
new TelephonyCallInfo(clientId,
callIndex,
callState,
disconnectedReason,
number,
numberPresentation,
name,
namePresentation,
isOutgoing,
isEmergency,
isConference,
isSwitchable,
isMergeable);
new TelephonyCallInfo(clientId, callIndex, callState, number,
numberPresentation, name, namePresentation,
isOutgoing, isEmergency, isConference,
isSwitchable, isMergeable);
info.forget(aResult);

View File

@ -421,6 +421,16 @@ TelephonyIPCService::NotifyConferenceError(const nsAString& aName,
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCService::NotifyError(uint32_t aClientId, int32_t aCallIndex,
const nsAString& aError)
{
for (uint32_t i = 0; i < mListeners.Length(); i++) {
mListeners[i]->NotifyError(aClientId, aCallIndex, aError);
}
return NS_OK;
}
NS_IMETHODIMP
TelephonyIPCService::SupplementaryServiceNotification(uint32_t aClientId,
int32_t aCallIndex,

View File

@ -331,6 +331,17 @@ TelephonyParent::NotifyConferenceError(const nsAString& aName,
: NS_ERROR_FAILURE;
}
NS_IMETHODIMP
TelephonyParent::NotifyError(uint32_t aClientId,
int32_t aCallIndex,
const nsAString& aError)
{
NS_ENSURE_TRUE(!mActorDestroyed, NS_ERROR_FAILURE);
return SendNotifyCallError(aClientId, aCallIndex, nsString(aError))
? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
TelephonyParent::SupplementaryServiceNotification(uint32_t aClientId,
int32_t aCallIndex,
@ -420,6 +431,14 @@ TelephonyRequestParent::NotifyConferenceError(const nsAString& aName,
MOZ_CRASH("Not a TelephonyParent!");
}
NS_IMETHODIMP
TelephonyRequestParent::NotifyError(uint32_t aClientId,
int32_t aCallIndex,
const nsAString& aError)
{
MOZ_CRASH("Not a TelephonyParent!");
}
NS_IMETHODIMP
TelephonyRequestParent::SupplementaryServiceNotification(uint32_t aClientId,
int32_t aCallIndex,

View File

@ -4,7 +4,7 @@
#include "nsISupports.idl"
[scriptable, uuid(e5e1be26-a3d4-49b3-8d9f-c1df5192b364)]
[scriptable, uuid(3ea2d155-8ea2-42be-85d7-bd8ede8afc40)]
interface nsITelephonyCallInfo : nsISupports
{
/**
@ -22,14 +22,6 @@ interface nsITelephonyCallInfo : nsISupports
*/
readonly attribute unsigned short callState;
/**
* The disconnectedReason of a call is defualt to an empty string when the
* call is "not disconnected", but once the call becomes "disconnected" the
* disconnectedReason should be a non-empty string no matter the call is
* disconnected for a noraml reason or an error.
*/
readonly attribute DOMString disconnectedReason;
/**
* Number of the other party.
*/

View File

@ -7,7 +7,7 @@
interface nsIMobileCallForwardingOptions;
interface nsITelephonyCallInfo;
[scriptable, uuid(80faf34e-286b-4487-bd55-135bd92668b9)]
[scriptable, uuid(37fb45bb-ae10-4cfd-b24e-d656a9787a0a)]
interface nsITelephonyListener : nsISupports
{
/**
@ -54,6 +54,20 @@ interface nsITelephonyListener : nsISupports
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,
in AString error);
/**
* Called when a waiting call comes in CDMA networks.
*