Bug 1128823 - Remove hangUpAll. r=hsinyi
authorSzu-Yu Chen [:aknow] <szchen@mozilla.com>
Fri, 13 Feb 2015 10:57:29 +0800
changeset 242737 5f83e77bfb403c1b4b6776cd3fe55c764c705f2e
parent 242736 97b815700a42eca8ea3ee830479726e2632e9cfa
child 242738 fd12875a8a48eba1591c0a70e17a142953161218
child 242765 2e11649df7926d79b679d7a40666c450c3ea1718
push id682
push userjryans@gmail.com
push dateFri, 13 Feb 2015 21:27:38 +0000
reviewershsinyi
bugs1128823
milestone38.0a1
Bug 1128823 - Remove hangUpAll. r=hsinyi
dom/system/gonk/RadioInterfaceLayer.js
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -526,20 +526,30 @@ XPCOMUtils.defineLazyGetter(this, "gRadi
       } else {
         _request = this._setRadioEnabledInternal.bind(this, message);
 
         // In 2G network, modem takes 35+ seconds to process deactivate data
         // call request if device has active voice call (please see bug 964974
         // for more details). Therefore we should hangup all active voice calls
         // first. And considering some DSDS architecture, toggling one radio may
         // toggle both, so we send hangUpAll to all clients.
-        for (let i = 0, N = _ril.numRadioInterfaces; i < N; ++i) {
-          let iface = _ril.getRadioInterface(i);
-          iface.workerMessenger.send("hangUpAll");
-        }
+        let hangUpCallback = {
+          QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyCallback]),
+          notifySuccess: function() {},
+          notifyError: function() {}
+        };
+
+        gTelephonyService.enumerateCalls({
+          QueryInterface: XPCOMUtils.generateQI([Ci.nsITelephonyListener]),
+          enumerateCallState: function(aInfo) {
+            gTelephonyService.hangUpCall(aInfo.clientId, aInfo.callIndex,
+                                         hangUpCallback);
+          },
+          enumerateCallStateComplete: function() {}
+        });
 
         // In some DSDS architecture with only one modem, toggling one radio may
         // toggle both. Therefore, for safely turning off, we should first
         // explicitly deactivate all data calls from all clients.
         this._deactivateDataCalls().then(() => {
           if (DEBUG) debug("RadioControl: deactivation done");
           this._executeRequest();
         });
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -1552,25 +1552,16 @@ RilObject.prototype = {
     let Buf = this.context.Buf;
     options.request = REQUEST_CDMA_FLASH;
     Buf.newParcel(options.request, options);
     Buf.writeString(options.featureStr || "");
     Buf.sendParcel();
   },
 
   /**
-   * Hang up all calls
-   */
-  hangUpAll: function() {
-    for (let callIndex in this.currentCalls) {
-      this.hangUpCall({callIndex: callIndex});
-    }
-  },
-
-  /**
    * Hang up the phone.
    *
    * @param callIndex
    *        Call index (1-based) as reported by REQUEST_GET_CURRENT_CALLS.
    */
   hangUpCall: function(options) {
     let call = this.currentCalls[options.callIndex];
     if (!call) {