Bug 931722 - Part 1: RIL related code change. r=hsinyi
authorShawn Ku <sku@mozilla.com>
Wed, 27 Nov 2013 15:45:31 +0800
changeset 172931 0815ba262621ab757aebde197c4422dc771fd1b7
parent 172930 cea5ec120ed778acf7eff36135e8dd67cbd25425
child 172932 3117fa37236a7be1f21053d482ebcc15f59d044f
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershsinyi
bugs931722
milestone28.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 931722 - Part 1: RIL related code change. r=hsinyi
dom/system/gonk/RadioInterfaceLayer.js
dom/system/gonk/nsIRadioInterfaceLayer.idl
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -723,16 +723,23 @@ RadioInterfaceLayer.prototype = {
     for (let clientId = 0; clientId < this.numRadioInterfaces; clientId++) {
       let radioInterface = this.radioInterfaces[clientId];
       if (radioInterface.rilContext.iccInfo.iccid == iccId) {
         return clientId;
       }
     }
 
     throw Cr.NS_ERROR_NOT_AVAILABLE;
+  },
+
+  setMicrophoneMuted: function setMicrophoneMuted(muted) {
+    for (let clientId = 0; clientId < this.numRadioInterfaces; clientId++) {
+      let radioInterface = this.radioInterfaces[clientId];
+      radioInterface.workerMessenger.send("setMute", { muted: muted });
+    }
   }
 };
 
 XPCOMUtils.defineLazyGetter(RadioInterfaceLayer.prototype,
                             "numRadioInterfaces", function () {
   try {
     return Services.prefs.getIntPref(kPrefRilNumRadioInterfaces);
   } catch(e) {}
--- a/dom/system/gonk/nsIRadioInterfaceLayer.idl
+++ b/dom/system/gonk/nsIRadioInterfaceLayer.idl
@@ -127,20 +127,22 @@ interface nsIRadioInterface : nsISupport
 
   void sendWorkerMessage(in DOMString type,
               [optional] in jsval message,
               [optional] in nsIRilSendWorkerMessageCallback callback);
 
   void getSmscAddress(in nsIMobileMessageCallback request);
 };
 
-[scriptable, uuid(70d3a18c-4063-11e3-89de-0f9ec19fd803)]
+[scriptable, uuid(86a5c280-5641-11e3-949a-0800200c9a66)]
 interface nsIRadioInterfaceLayer : nsISupports
 {
   readonly attribute unsigned long numRadioInterfaces;
 
   nsIRadioInterface getRadioInterface(in unsigned long clientId);
 
   /**
    * If not available, throws exception; otherwise, a valid number.
    */
   unsigned long getClientIdByIccId(in DOMString iccId);
+
+  void setMicrophoneMuted(in boolean muted);
 };
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -357,21 +357,16 @@ let RIL = {
     this._needRepollNetworkInfo = false;
 
     /**
      * Pending messages to be send in batch from requestNetworkInfo()
      */
     this._pendingNetworkInfo = {rilMessageType: "networkinfochanged"};
 
     /**
-     * Mute or unmute the radio.
-     */
-    this._muted = true;
-
-    /**
      * USSD session flag.
      * Only one USSD session may exist at a time, and the session is assumed
      * to exist until:
      *    a) There's a call to cancelUSSD()
      *    b) The implementation sends a UNSOLICITED_ON_USSD with a type code
      *       of "0" (USSD-Notify/no further action) or "2" (session terminated)
      */
     this._ussdSession = null;
@@ -386,27 +381,16 @@ let RIL = {
      */
     let cbmmi = this.cellBroadcastConfigs && this.cellBroadcastConfigs.MMI;
     this.cellBroadcastConfigs = {
       MMI: cbmmi || null
     };
     this.mergedCellBroadcastConfig = null;
   },
 
-  get muted() {
-    return this._muted;
-  },
-  set muted(val) {
-    val = Boolean(val);
-    if (this._muted != val) {
-      this.setMute(val);
-      this._muted = val;
-    }
-  },
-
   /**
    * Parse an integer from a string, falling back to a default value
    * if the the provided value is not a string or does not contain a valid
    * number.
    *
    * @param string
    *        String to be parsed.
    * @param defaultValue [optional]
@@ -1461,20 +1445,20 @@ let RIL = {
   },
 
   /**
    * Mute or unmute the radio.
    *
    * @param mute
    *        Boolean to indicate whether to mute or unmute the radio.
    */
-  setMute: function setMute(mute) {
+  setMute: function setMute(options) {
     Buf.newParcel(REQUEST_SET_MUTE);
     Buf.writeInt32(1);
-    Buf.writeInt32(mute ? 1 : 0);
+    Buf.writeInt32(options.muted ? 1 : 0);
     Buf.sendParcel();
   },
 
   /**
    * Answer an incoming/waiting call.
    *
    * @param callIndex
    *        Call index of the call to answer.
@@ -3612,20 +3596,16 @@ let RIL = {
     }
 
     if (clearConferenceRequest) {
       this._hasConferenceRequest = false;
     }
     if (conferenceChanged) {
       this._ensureConference();
     }
-
-    // Update our mute status. If there is anything in our currentCalls map then
-    // we know it's a voice call and we should leave audio on.
-    this.muted = (Object.getOwnPropertyNames(this.currentCalls).length === 0);
   },
 
   _ensureConference: function _ensureConference() {
     let oldState = this.currentConference.state;
     let remaining = Object.keys(this.currentConference.participants);
 
     if (remaining.length == 1) {
       // Remove that if only does one remain in a conference call.