Bug 1000670 - part 4 - ril: _sendClirModeChanged. r=vicamo
authorHsin-Yi Tsai <htsai@mozilla.com>
Thu, 24 Apr 2014 14:46:27 +0800
changeset 180990 02e01aa0c58a3cc4f984db3e772c791f860373dd
parent 180989 c931c07c3232cf8fc1caee425a1a7d311388cf01
child 180991 43df0cb30cae4493b9eef531ab14cc5b7f6dc67a
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersvicamo
bugs1000670
milestone31.0a1
Bug 1000670 - part 4 - ril: _sendClirModeChanged. r=vicamo
dom/system/gonk/RILContentHelper.js
dom/system/gonk/RadioInterfaceLayer.js
--- a/dom/system/gonk/RILContentHelper.js
+++ b/dom/system/gonk/RILContentHelper.js
@@ -103,17 +103,18 @@ const RIL_IPC_MSG_NAMES = [
   "RIL:SetRoamingPreference",
   "RIL:GetRoamingPreference",
   "RIL:ExitEmergencyCbMode",
   "RIL:SetRadioEnabled",
   "RIL:RadioStateChanged",
   "RIL:SetVoicePrivacyMode",
   "RIL:GetVoicePrivacyMode",
   "RIL:OtaStatusChanged",
-  "RIL:MatchMvno"
+  "RIL:MatchMvno",
+  "RIL:ClirModeChanged"
 ];
 
 XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
                                    "@mozilla.org/childprocessmessagemanager;1",
                                    "nsISyncMessageSender");
 
 XPCOMUtils.defineLazyGetter(this, "gNumRadioInterfaces", function() {
   let appInfo = Cc["@mozilla.org/xre/app-info;1"];
@@ -1886,16 +1887,22 @@ RILContentHelper.prototype = {
         break;
       case "RIL:SetVoicePrivacyMode":
         this.handleSimpleRequest(data.requestId, data.errorMsg, null);
         break;
       case "RIL:GetVoicePrivacyMode":
         this.handleSimpleRequest(data.requestId, data.errorMsg,
                                  data.enabled);
         break;
+      case "RIL:ClirModeChanged":
+        this._deliverEvent(clientId,
+                           "_mobileConnectionListeners",
+                           "notifyClirModeChanged",
+                           [data]);
+        break;
     }
   },
 
   handleSimpleRequest: function(requestId, errorMsg, result) {
     if (errorMsg) {
       this.fireRequestError(requestId, errorMsg);
     } else {
       this.fireRequestSuccess(requestId, result);
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -3484,32 +3484,38 @@ RadioInterface.prototype = {
 
   // Handle phone functions of nsIRILContentHelper
 
   _sendCfStateChanged: function(message) {
     gMessageManager.sendMobileConnectionMessage("RIL:CfStateChanged",
                                                 this.clientId, message);
   },
 
+  _sendClirModeChanged: function(message) {
+    gMessageManager.sendMobileConnectionMessage("RIL:ClirModeChanged",
+                                                this.clientId, message);
+  },
+
   _updateCallingLineIdRestrictionPref: function(mode) {
     try {
       Services.prefs.setIntPref(kPrefClirModePreference, mode);
       Services.prefs.savePrefFile(null);
       if (DEBUG) {
         this.debug(kPrefClirModePreference + " pref is now " + mode);
       }
     } catch (e) {}
   },
 
   sendMMI: function(target, message) {
     if (DEBUG) this.debug("SendMMI " + JSON.stringify(message));
     this.workerMessenger.send("sendMMI", message, (function(response) {
       if (response.isSetCallForward) {
         this._sendCfStateChanged(response);
       } else if (response.isSetCLIR && response.success) {
+        this._sendClirModeChanged(response.clirMode);
         this._updateCallingLineIdRestrictionPref(response.clirMode);
       }
 
       target.sendAsyncMessage("RIL:SendMMI", {
         clientId: this.clientId,
         data: response
       });
       return false;
@@ -3530,16 +3536,17 @@ RadioInterface.prototype = {
   },
 
   setCallingLineIdRestriction: function(target, message) {
     if (DEBUG) {
       this.debug("setCallingLineIdRestriction: " + JSON.stringify(message));
     }
     this.workerMessenger.send("setCLIR", message, (function(response) {
       if (response.success) {
+        this._sendClirModeChanged(response.clirMode);
         this._updateCallingLineIdRestrictionPref(response.clirMode);
       }
       target.sendAsyncMessage("RIL:SetCallingLineIdRestriction", {
         clientId: this.clientId,
         data: response
       });
       return false;
     }).bind(this));