Bug 997584 - part 1 - remove kPrefClirModePreference. r=vicamo
☠☠ backed out by 8f3bf5e0be90 ☠ ☠
authorHsin-Yi Tsai <htsai@mozilla.com>
Fri, 18 Apr 2014 16:11:40 +0800
changeset 199116 d050c422919ae6c4ba75663a3ce1fbe237556f76
parent 199115 7f19a9a6127e1e6087c6edb558f7eab42338834f
child 199117 8304d89d43008a6217d6d1ffa2cd12090ca1e4e5
push id486
push userasasaki@mozilla.com
push dateMon, 14 Jul 2014 18:39:42 +0000
treeherdermozilla-release@d33428174ff1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo
bugs997584
milestone31.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 997584 - part 1 - remove kPrefClirModePreference. 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
@@ -1388,35 +1388,48 @@ RILContentHelper.prototype = {
   getCallingLineIdRestriction: function(clientId, window) {
     if (window == null) {
       throw Components.Exception("Can't get window object",
                                   Cr.NS_ERROR_UNEXPECTED);
     }
     let request = Services.DOMRequest.createRequest(window);
     let requestId = this.getRequestId(request);
 
+    let radioState = this.rilContexts[clientId].radioState;
+    if (radioState !== RIL.GECKO_DETAILED_RADIOSTATE_ENABLED) {
+      this.dispatchFireRequestError(requestId,
+                                    RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
+      return request;
+    }
+
     cpmm.sendAsyncMessage("RIL:GetCallingLineIdRestriction", {
       clientId: clientId,
       data: {
         requestId: requestId
       }
     });
 
     return request;
   },
 
   setCallingLineIdRestriction: function(clientId, window, clirMode) {
-
     if (window == null) {
       throw Components.Exception("Can't get window object",
                                   Cr.NS_ERROR_UNEXPECTED);
     }
     let request = Services.DOMRequest.createRequest(window);
     let requestId = this.getRequestId(request);
 
+    let radioState = this.rilContexts[clientId].radioState;
+    if (radioState !== RIL.GECKO_DETAILED_RADIOSTATE_ENABLED) {
+      this.dispatchFireRequestError(requestId,
+                                    RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
+      return request;
+    }
+
     cpmm.sendAsyncMessage("RIL:SetCallingLineIdRestriction", {
       clientId: clientId,
       data: {
         requestId: requestId,
         clirMode: clirMode
       }
     });
 
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -87,17 +87,16 @@ const kSettingsCellBroadcastSearchList =
 const kSettingsClockAutoUpdateEnabled = "time.clock.automatic-update.enabled";
 const kSettingsClockAutoUpdateAvailable = "time.clock.automatic-update.available";
 const kSettingsTimezoneAutoUpdateEnabled = "time.timezone.automatic-update.enabled";
 const kSettingsTimezoneAutoUpdateAvailable = "time.timezone.automatic-update.available";
 
 const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
 
 const kPrefCellBroadcastDisabled = "ril.cellbroadcast.disabled";
-const kPrefClirModePreference = "ril.clirMode";
 const kPrefRilNumRadioInterfaces = "ril.numRadioInterfaces";
 
 const DOM_MOBILE_MESSAGE_DELIVERY_RECEIVED = "received";
 const DOM_MOBILE_MESSAGE_DELIVERY_SENDING  = "sending";
 const DOM_MOBILE_MESSAGE_DELIVERY_SENT     = "sent";
 const DOM_MOBILE_MESSAGE_DELIVERY_ERROR    = "error";
 
 const RADIO_POWER_OFF_TIMEOUT = 30000;
@@ -1610,17 +1609,16 @@ WorkerMessenger.prototype = {
 
   // Maps tokens we send out with messages to the message callback.
   tokenCallbackMap: null,
 
   init: function() {
     let options = {
       debug: DEBUG,
       cellBroadcastDisabled: false,
-      clirMode: RIL.CLIR_DEFAULT,
       quirks: {
         callstateExtraUint32:
           libcutils.property_get("ro.moz.ril.callstate_extra_int", "false") === "true",
         v5Legacy:
           libcutils.property_get("ro.moz.ril.v5_legacy", "true") === "true",
         requestUseDialEmergencyCall:
           libcutils.property_get("ro.moz.ril.dial_emergency_call", "false") === "true",
         simAppStateExtraFields:
@@ -1638,20 +1636,16 @@ WorkerMessenger.prototype = {
                            libcutils.property_get("ro.ril.ecclist")
     };
 
     try {
       options.cellBroadcastDisabled =
         Services.prefs.getBoolPref(kPrefCellBroadcastDisabled);
     } catch(e) {}
 
-    try {
-      options.clirMode = Services.prefs.getIntPref(kPrefClirModePreference);
-    } catch(e) {}
-
     this.send(null, "setInitialOptions", options);
   },
 
   debug: function(aClientId, aMessage) {
     // We use the same debug subject with RadioInterface's here.
     dump("-*- RadioInterface[" + aClientId + "]: " + aMessage + "\n");
   },
 
@@ -3484,33 +3478,21 @@ RadioInterface.prototype = {
 
   // Handle phone functions of nsIRILContentHelper
 
   _sendCfStateChanged: function(message) {
     gMessageManager.sendMobileConnectionMessage("RIL:CfStateChanged",
                                                 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._updateCallingLineIdRestrictionPref(response.clirMode);
       }
 
       target.sendAsyncMessage("RIL:SendMMI", {
         clientId: this.clientId,
         data: response
       });
       return false;
     }).bind(this));
@@ -3529,19 +3511,16 @@ RadioInterface.prototype = {
     }).bind(this));
   },
 
   setCallingLineIdRestriction: function(target, message) {
     if (DEBUG) {
       this.debug("setCallingLineIdRestriction: " + JSON.stringify(message));
     }
     this.workerMessenger.send("setCLIR", message, (function(response) {
-      if (response.success) {
-        this._updateCallingLineIdRestrictionPref(response.clirMode);
-      }
       target.sendAsyncMessage("RIL:SetCallingLineIdRestriction", {
         clientId: this.clientId,
         data: response
       });
       return false;
     }).bind(this));
   },
 
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -48,17 +48,16 @@ let GLOBAL = this;
 if (!this.debug) {
   // Debugging stub that goes nowhere.
   this.debug = function debug(message) {
     dump("RIL Worker: " + message + "\n");
   };
 }
 
 let RIL_CELLBROADCAST_DISABLED;
-let RIL_CLIR_MODE;
 let RIL_EMERGENCY_NUMBERS;
 const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"];
 
 // Timeout value for emergency callback mode.
 const EMERGENCY_CB_MODE_TIMEOUT_MS = 300000;  // 5 mins = 300000 ms.
 
 const ICC_MAX_LINEAR_FIXED_RECORDS = 0xfe;
 
@@ -218,17 +217,16 @@ function RilObject(aContext) {
   this.currentDataCalls = {};
   this._pendingSentSmsMap = {};
   this.pendingNetworkType = {};
   this._receivedSmsCbPagesMap = {};
 
   // Init properties that are only initialized once.
   this.v5Legacy = RILQUIRKS_V5_LEGACY;
   this.cellBroadcastDisabled = RIL_CELLBROADCAST_DISABLED;
-  this.clirMode = RIL_CLIR_MODE;
 }
 RilObject.prototype = {
   context: null,
 
   v5Legacy: null,
 
   /**
    * Valid calls.
@@ -262,21 +260,16 @@ RilObject.prototype = {
   pendingNetworkType: null,
 
   /**
    * Global Cell Broadcast switch.
    */
   cellBroadcastDisabled: false,
 
   /**
-   * Global CLIR mode settings.
-   */
-  clirMode: CLIR_DEFAULT,
-
-  /**
    * Parsed Cell Broadcast search lists.
    * cellBroadcastConfigs.MMI should be preserved over rild reset.
    */
   cellBroadcastConfigs: null,
   mergedCellBroadcastConfig: null,
 
   _receivedSmsCbPagesMap: null,
 
@@ -1106,23 +1099,20 @@ RilObject.prototype = {
    * Enables or disables the presentation of the calling line identity (CLI) to
    * the called party when originating a call.
    *
    * @param options.clirMode
    *        Is one of the CLIR_* constants in
    *        nsIDOMMozMobileConnection interface.
    */
   setCLIR: function(options) {
-    if (options) {
-      this.clirMode = options.clirMode;
-    }
     let Buf = this.context.Buf;
     Buf.newParcel(REQUEST_SET_CLIR, options);
     Buf.writeInt32(1);
-    Buf.writeInt32(this.clirMode);
+    Buf.writeInt32(options.clirMode);
     Buf.sendParcel();
   },
 
   /**
    * Set screen state.
    *
    * @param on
    *        Boolean indicating whether the screen should be on or off.
@@ -2459,17 +2449,16 @@ RilObject.prototype = {
             break;
           case MMI_PROCEDURE_DEACTIVATION:
             options.clirMode = CLIR_SUPPRESSION;
             break;
           default:
             _sendMMIError(MMI_ERROR_KS_NOT_SUPPORTED, MMI_KS_SC_CLIR);
             return;
         }
-        options.isSetCLIR = true;
         this.setCLIR(options);
         return;
 
       // Call barring
       case MMI_SC_BAOC:
       case MMI_SC_BAOIC:
       case MMI_SC_BAOICxH:
       case MMI_SC_BAIC:
@@ -6409,17 +6398,16 @@ RilObject.prototype[UNSOLICITED_RESPONSE
       } else {
         this.getIMEI();
         this.getIMEISV();
       }
     }
     this.getBasebandVersion();
     this.updateCellBroadcastConfig();
     this.setPreferredNetworkType();
-    this.setCLIR();
     if (RILQUIRKS_DATA_REGISTRATION_ON_DEMAND && this._attachDataRegistration) {
       this.setDataRegistration({attach: true});
     }
   }
 
   this.radioState = newState;
   this.sendChromeMessage({
     rilMessageType: "radiostatechange",
@@ -14663,17 +14651,16 @@ let ContextPool = {
     }
     method.call(this, aMessage);
   },
 
   setInitialOptions: function(aOptions) {
     DEBUG = DEBUG_WORKER || aOptions.debug;
     RIL_EMERGENCY_NUMBERS = aOptions.rilEmergencyNumbers;
     RIL_CELLBROADCAST_DISABLED = aOptions.cellBroadcastDisabled;
-    RIL_CLIR_MODE = aOptions.clirMode;
 
     let quirks = aOptions.quirks;
     RILQUIRKS_CALLSTATE_EXTRA_UINT32 = quirks.callstateExtraUint32;
     RILQUIRKS_V5_LEGACY = quirks.v5Legacy;
     RILQUIRKS_REQUEST_USE_DIAL_EMERGENCY_CALL = quirks.requestUseDialEmergencyCall;
     RILQUIRKS_SIM_APP_STATE_EXTRA_FIELDS = quirks.simAppStateExtraFields;
     RILQUIRKS_EXTRA_UINT32_2ND_CALL = quirks.extraUint2ndCall;
     RILQUIRKS_HAVE_QUERY_ICC_LOCK_RETRY_COUNT = quirks.haveQueryIccLockRetryCount;