Bug 1029721 - Add secondNumber in telephony-call-ended message. r=hsinyi, a=2.0+
authorTamara Hills <thills@mozilla.com>
Thu, 17 Jul 2014 19:18:28 +0800
changeset 209189 7d1d5ae5d8a6f7d66aff54bf144d7a43565ed239
parent 209188 3d6875a84472030603be49f7a7919ff9a62ea38d
child 209190 0f29e8a22f67ab20f5a2c726c626a7e1819f6cf1
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsinyi, 2
bugs1029721
milestone32.0a2
Bug 1029721 - Add secondNumber in telephony-call-ended message. r=hsinyi, a=2.0+
dom/telephony/gonk/TelephonyService.js
--- a/dom/telephony/gonk/TelephonyService.js
+++ b/dom/telephony/gonk/TelephonyService.js
@@ -98,16 +98,18 @@ XPCOMUtils.defineLazyGetter(this, "gPhon
   return ns.PhoneNumberUtils;
 });
 
 function TelephonyService() {
   this._numClients = gRadioInterfaceLayer.numRadioInterfaces;
   this._listeners = [];
   this._currentCalls = {};
 
+  this._cdmaCallWaitingNumber = null;
+
   // _isActiveCall[clientId][callIndex] shows the active status of the call.
   this._isActiveCall = {};
   this._numActiveCall = 0;
 
   this._updateDebugFlag();
   this.defaultServiceId = this._getDefaultServiceId();
 
   Services.prefs.addObserver(kPrefRilDebuggingEnabled, this, false);
@@ -683,16 +685,22 @@ TelephonyService.prototype = {
       new Date().getTime() - aCall.started : 0;
     let data = {
       number: aCall.number,
       serviceId: aClientId,
       emergency: aCall.isEmergency,
       duration: duration,
       direction: aCall.isOutgoing ? "outgoing" : "incoming"
     };
+
+    if(this._cdmaCallWaitingNumber != null) {
+      data.secondNumber = this._cdmaCallWaitingNumber;
+      this._cdmaCallWaitingNumber = null;
+    }
+
     gSystemMessenger.broadcastMessage("telephony-call-ended", data);
 
     let manualConfStateChange = false;
     let childId = this._currentCalls[aClientId][aCall.callIndex].childId;
     if (childId) {
       // Child cannot live without parent.
       let childCall = this._currentCalls[aClientId][childId];
       this.notifyCallDisconnected(aClientId, childCall);
@@ -820,16 +828,19 @@ TelephonyService.prototype = {
     this._acquireCallRingWakeLock();
 
     let call = this._currentCalls[aClientId][CDMA_SECOND_CALL_INDEX];
     if (call) {
       // TODO: Bug 977503 - B2G RIL: [CDMA] update callNumber when a waiting
       // call comes after a 3way call.
       this.notifyCallDisconnected(aClientId, call);
     }
+
+    this._cdmaCallWaitingNumber = aCall.number;
+
     this._notifyAllListeners("notifyCdmaCallWaiting", [aClientId,
                                                        aCall.number,
                                                        aCall.numberPresentation,
                                                        aCall.name,
                                                        aCall.namePresentation]);
   },
 
   notifySupplementaryService: function(aClientId, aCallIndex, aNotification) {