Bug 795255 - B2G RIL: improve error handling mechanism for 'setCallWaiting'. r=vicamo
authorHsin-Yi Tsai <htsai@mozilla.com>
Sat, 29 Sep 2012 17:21:28 +0800
changeset 108995 da5df2c1ae16428cd4827ab31b6562a519e7e9d3
parent 108994 c76b04f5a2b5ecf24cc7509ce3b4e501453cecbd
child 108996 a16dfb364f8cc690b36948cc2e628601c59b56a9
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersvicamo
bugs795255
milestone18.0a1
Bug 795255 - B2G RIL: improve error handling mechanism for 'setCallWaiting'. r=vicamo
dom/system/gonk/RadioInterfaceLayer.js
dom/system/gonk/ril_worker.js
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -824,22 +824,21 @@ RadioInterfaceLayer.prototype = {
         !this._radioEnabled) {
       this.setRadioEnabled(false);
     }
   },
 
   handleCallWaitingStatusChange: function handleCallWaitingStatusChange(message) {
     let newStatus = message.enabled;
 
-    // RIL fails in setting call waiting status. Reset "ril.callwaiting.enabled"
-    // in the settings DB.
-    if (!message.success) {
-      newStatus = !newStatus;
+    // RIL fails in setting call waiting status. Set "ril.callwaiting.enabled"
+    // to null and set the error message.
+    if (message.errorMsg) {
       let lock = gSettingsService.createLock();
-      lock.set("ril.callwaiting.enabled", newStatus, null);
+      lock.set("ril.callwaiting.enabled", null, null, message.errorMsg);
       return;
     }
 
     this.callWaitingStatus = newStatus;
   },
 
   setCallWaitingEnabled: function setCallWaitingEnabled(value) {
     debug("Current call waiting status is " + this.callWaitingStatus +
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -4208,17 +4208,17 @@ RIL[REQUEST_CANCEL_USSD] = function REQU
   this.sendDOMMessage(options);
 };
 RIL[REQUEST_GET_CLIR] = null;
 RIL[REQUEST_SET_CLIR] = null;
 RIL[REQUEST_QUERY_CALL_FORWARD_STATUS] = null;
 RIL[REQUEST_SET_CALL_FORWARD] = null;
 RIL[REQUEST_QUERY_CALL_WAITING] = null;
 RIL[REQUEST_SET_CALL_WAITING] = function REQUEST_SET_CALL_WAITING(length, options) {
-  options.success = options.rilRequestError == 0 ? true : false;
+  options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
   this.sendDOMMessage(options);
 };
 RIL[REQUEST_SMS_ACKNOWLEDGE] = null;
 RIL[REQUEST_GET_IMEI] = function REQUEST_GET_IMEI(length, options) {
   if (options.rilRequestError) {
     return;
   }