Bug 822210 - cdma call waiting - part3 - ril impl. r=vicamo
authorHsin-Yi Tsai <htsai@mozilla.com>
Tue, 30 Jul 2013 17:24:43 +0800
changeset 154786 fef9f66d8ae911939c7ce54aafd24bd5201b5bd5
parent 154785 a50e396cb60adad6b6b5bf1a52d21071d2271b9d
child 154787 73f6186de86926730f3418d534be6c233c47d85f
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo
bugs822210
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 822210 - cdma call waiting - part3 - ril impl. r=vicamo
dom/system/gonk/RILContentHelper.js
dom/system/gonk/RadioInterfaceLayer.js
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/RILContentHelper.js
+++ b/dom/system/gonk/RILContentHelper.js
@@ -100,17 +100,18 @@ const RIL_IPC_MSG_NAMES = [
   "RIL:CellBroadcastReceived",
   "RIL:CfStateChanged",
   "RIL:IccOpenChannel",
   "RIL:IccCloseChannel",
   "RIL:IccExchangeAPDU",
   "RIL:ReadIccContacts",
   "RIL:UpdateIccContact",
   "RIL:SetRoamingPreference",
-  "RIL:GetRoamingPreference"
+  "RIL:GetRoamingPreference",
+  "RIL:CdmaCallWaiting"
 ];
 
 XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
                                    "@mozilla.org/childprocessmessagemanager;1",
                                    "nsISyncMessageSender");
 
 XPCOMUtils.defineLazyServiceGetter(this, "gUUIDGenerator",
                                    "@mozilla.org/uuid-generator;1",
@@ -1595,16 +1596,21 @@ RILContentHelper.prototype = {
       }
       case "RIL:SetRoamingPreference":
         this.handleSimpleRequest(msg.json.requestId, msg.json.errorMsg, null);
         break;
       case "RIL:GetRoamingPreference":
         this.handleSimpleRequest(msg.json.requestId, msg.json.errorMsg,
                                  msg.json.mode);
         break;
+      case "RIL:CdmaCallWaiting":
+        this._deliverEvent("_telephonyListeners",
+                           "notifyCdmaCallWaiting",
+                           [msg.json.data]);
+        break;
     }
   },
 
   handleEnumerateCalls: function handleEnumerateCalls(calls) {
     debug("handleEnumerateCalls: " + JSON.stringify(calls));
     let callback = this._enumerateTelephonyCallbacks.shift();
     if (!calls.length) {
       callback.enumerateCallStateComplete();
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -938,16 +938,20 @@ RadioInterface.prototype = {
       case "callStateChange":
         // This one will handle its own notifications.
         this.handleCallStateChange(message.call);
         break;
       case "callDisconnected":
         // This one will handle its own notifications.
         this.handleCallDisconnected(message.call);
         break;
+      case "cdmaCallWaiting":
+        gMessageManager.sendTelephonyMessage("RIL:CdmaCallWaiting",
+                                             this.clientId, message.number);
+        break;
       case "enumerateCalls":
         // This one will handle its own notifications.
         this.handleEnumerateCalls(message);
         break;
       case "callError":
         this.handleCallError(message);
         break;
       case "suppSvcNotification":
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -1950,17 +1950,23 @@ let RIL = {
         Buf.simpleRequest(REQUEST_HANGUP_WAITING_OR_BACKGROUND);
         break;
     }
   },
 
   holdCall: function holdCall(options) {
     let call = this.currentCalls[options.callIndex];
     if (call && call.state == CALL_STATE_ACTIVE) {
-      Buf.simpleRequest(REQUEST_SWITCH_HOLDING_AND_ACTIVE);
+      if (this._isCdma) {
+        Buf.newParcel(REQUEST_CDMA_FLASH);
+        Buf.writeString("");
+        Buf.sendParcel();
+      } else {
+        Buf.simpleRequest(REQUEST_SWITCH_HOLDING_AND_ACTIVE);
+      }
     }
   },
 
   resumeCall: function resumeCall(options) {
     let call = this.currentCalls[options.callIndex];
     if (call && call.state == CALL_STATE_HOLDING) {
       Buf.simpleRequest(REQUEST_SWITCH_HOLDING_AND_ACTIVE);
     }
@@ -6174,17 +6180,29 @@ RIL[UNSOLICITED_RESPONSE_NEW_BROADCAST_S
   }
 
   message.rilMessageType = "cellbroadcast-received";
   this.sendChromeMessage(message);
 };
 RIL[UNSOLICITED_CDMA_RUIM_SMS_STORAGE_FULL] = null;
 RIL[UNSOLICITED_RESTRICTED_STATE_CHANGED] = null;
 RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE] = null;
-RIL[UNSOLICITED_CDMA_CALL_WAITING] = null;
+RIL[UNSOLICITED_CDMA_CALL_WAITING] = function UNSOLICITED_CDMA_CALL_WAITING(length) {
+  let call = {};
+  call.number              = Buf.readString();
+  call.numberPresentation  = Buf.readUint32();
+  call.name                = Buf.readString();
+  call.namePresentation    = Buf.readUint32();
+  call.isPresent           = Buf.readUint32();
+  call.signalType          = Buf.readUint32();
+  call.alertPitch          = Buf.readUint32();
+  call.signal              = Buf.readUint32();
+  this.sendChromeMessage({rilMessageType: "cdmaCallWaiting",
+                          number: call.number});
+};
 RIL[UNSOLICITED_CDMA_OTA_PROVISION_STATUS] = null;
 RIL[UNSOLICITED_CDMA_INFO_REC] = null;
 RIL[UNSOLICITED_OEM_HOOK_RAW] = null;
 RIL[UNSOLICITED_RINGBACK_TONE] = null;
 RIL[UNSOLICITED_RESEND_INCALL_MUTE] = null;
 RIL[UNSOLICITED_RIL_CONNECTED] = function UNSOLICITED_RIL_CONNECTED(length) {
   // Prevent response id collision between UNSOLICITED_RIL_CONNECTED and
   // UNSOLICITED_VOICE_RADIO_TECH_CHANGED for Akami on gingerbread branch.