From 97f256f2edd688759e2c6638945242fe850a069b Mon Sep 17 00:00:00 2001 From: Hsin-Yi Tsai Date: Thu, 12 Sep 2013 21:00:18 +0800 Subject: [PATCH] Bug 915638 - part1 - B2G RIL: telephonyCallGroup.onstatechange isn't fired when a conference call is becoming empty. r=vicamo --- dom/system/gonk/ril_consts.js | 1 + dom/system/gonk/ril_worker.js | 6 +++--- dom/telephony/gonk/TelephonyProvider.js | 5 +++-- dom/telephony/nsIGonkTelephonyProvider.idl | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dom/system/gonk/ril_consts.js b/dom/system/gonk/ril_consts.js index 7e53ddbaf63d..9de2b842b65d 100644 --- a/dom/system/gonk/ril_consts.js +++ b/dom/system/gonk/ril_consts.js @@ -450,6 +450,7 @@ this.NETWORK_CREG_TECH_LTE = 14; this.NETWORK_CREG_TECH_HSPAP = 15; this.NETWORK_CREG_TECH_GSM = 16; +this.CALL_STATE_UNKNOWN = -1; this.CALL_STATE_ACTIVE = 0; this.CALL_STATE_HOLDING = 1; this.CALL_STATE_DIALING = 2; diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index c7cecec7b455..ed95a46e4075 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -3629,12 +3629,12 @@ let RIL = { delete this.currentConference.cache; // Update the conference call's state. - let state = null; + let state = CALL_STATE_UNKNOWN; for each (let call in this.currentConference.participants) { - if (state && state != call.state) { + if (state != CALL_STATE_UNKNOWN && state != call.state) { // Each participant should have the same state, otherwise something // wrong happens. - state = null; + state = CALL_STATE_UNKNOWN; break; } state = call.state; diff --git a/dom/telephony/gonk/TelephonyProvider.js b/dom/telephony/gonk/TelephonyProvider.js index f1014d12f3c6..b16566152d85 100644 --- a/dom/telephony/gonk/TelephonyProvider.js +++ b/dom/telephony/gonk/TelephonyProvider.js @@ -216,6 +216,8 @@ TelephonyProvider.prototype = { _convertRILCallState: function _convertRILCallState(aState) { switch (aState) { + case RIL.CALL_STATE_UNKNOWN: + return nsITelephonyProvider.CALL_STATE_UNKNOWN; case RIL.CALL_STATE_ACTIVE: return nsITelephonyProvider.CALL_STATE_CONNECTED; case RIL.CALL_STATE_HOLDING: @@ -492,8 +494,7 @@ TelephonyProvider.prototype = { notifyConferenceCallStateChanged: function notifyConferenceCallStateChanged(aState) { if (DEBUG) debug("handleConferenceCallStateChanged: " + aState); - aState = aState != null ? this._convertRILCallState(aState) : - nsITelephonyProvider.CALL_STATE_UNKNOWN; + aState = this._convertRILCallState(aState); this._updateCallAudioState(null, aState); this._notifyAllListeners("conferenceCallStateChanged", [aState]); diff --git a/dom/telephony/nsIGonkTelephonyProvider.idl b/dom/telephony/nsIGonkTelephonyProvider.idl index 934f57d25c26..43f18581a8e1 100644 --- a/dom/telephony/nsIGonkTelephonyProvider.idl +++ b/dom/telephony/nsIGonkTelephonyProvider.idl @@ -10,7 +10,7 @@ "@mozilla.org/telephony/gonktelephonyprovider;1" %} -[scriptable, uuid(0d106c7e-ba47-48ee-ba48-c92002d401b6)] +[scriptable, uuid(f072f334-e4ea-4754-9929-533da30444a8)] interface nsIGonkTelephonyProvider : nsITelephonyProvider { void notifyCallDisconnected(in jsval call); @@ -27,5 +27,5 @@ interface nsIGonkTelephonyProvider : nsITelephonyProvider void notifySupplementaryService(in long callIndex, in AString notification); - void notifyConferenceCallStateChanged(in unsigned short state); + void notifyConferenceCallStateChanged(in short state); };