Bug 960961 - Part 2: remove ril logs or wrap them with DEBUG flag. r=vicamo
authorJessica Jong <jjong@mozilla.com>
Thu, 23 Jan 2014 16:44:20 +0800
changeset 164874 356ce1bba95354541adac271e1b6e064e97f55c1
parent 164873 98f0077e1820c92460cfe71847bf6bb4a4d5e74f
child 164875 d32b34edd752da54fe352474408d056498322cbd
push id26065
push userryanvm@gmail.com
push dateThu, 23 Jan 2014 20:39:50 +0000
treeherdermozilla-central@4cd99f870618 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvicamo
bugs960961
milestone29.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 960961 - Part 2: remove ril logs or wrap them with DEBUG flag. r=vicamo
dom/mobileconnection/src/MobileConnection.cpp
dom/system/gonk/RadioInterfaceLayer.js
dom/system/gonk/ril_worker.js
--- a/dom/mobileconnection/src/MobileConnection.cpp
+++ b/dom/mobileconnection/src/MobileConnection.cpp
@@ -102,18 +102,16 @@ MobileConnection::Init(nsPIDOMWindow* aW
 
   mWindow = do_GetWeakReference(aWindow);
   mListener = new Listener(this);
 
   if (CheckPermission("mobileconnection")) {
     DebugOnly<nsresult> rv = mProvider->RegisterMobileConnectionMsg(mClientId, mListener);
     NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
                      "Failed registering mobile connection messages with provider");
-
-    printf_stderr("MobileConnection initialized");
   }
 }
 
 void
 MobileConnection::Shutdown()
 {
   if (mProvider && mListener) {
     mListener->Disconnect();
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -773,17 +773,17 @@ function RadioInterfaceLayer() {
       Services.prefs.getBoolPref(kPrefCellBroadcastDisabled);
   } catch(e) {}
 
   try {
     options.clirMode = Services.prefs.getIntPref(kPrefClirModePreference);
   } catch(e) {}
 
   let numIfaces = this.numRadioInterfaces;
-  debug(numIfaces + " interfaces");
+  if (DEBUG) debug(numIfaces + " interfaces");
   this.radioInterfaces = [];
   for (let clientId = 0; clientId < numIfaces; clientId++) {
     options.clientId = clientId;
     this.radioInterfaces.push(new RadioInterface(options));
   }
 
   // TODO: Move 'ril.data.*' settings handler to DataConnectionManager,
   // see bug 905568.
@@ -1305,17 +1305,17 @@ RadioInterface.prototype = {
    */
   getSupportedNetworkTypes: function() {
     let key = "ro.moz.ril." + this.clientId + ".network_types";
     let supportedNetworkTypes = libcutils.property_get(key, "").split(",");
     for (let type of supportedNetworkTypes) {
       // If the value in system property is not valid, use the default one which
       // is defined in ril_consts.js.
       if (RIL.GECKO_SUPPORTED_NETWORK_TYPES.indexOf(type) < 0) {
-        this.debug("Unknown network type: " + type);
+        if (DEBUG) this.debug("Unknown network type: " + type);
         supportedNetworkTypes =
           RIL.GECKO_SUPPORTED_NETWORK_TYPES_DEFAULT.split(",");
         break;
       }
     }
     if (DEBUG) this.debug("Supported Network Types: " + supportedNetworkTypes);
     return supportedNetworkTypes;
   },
@@ -1951,17 +1951,16 @@ RadioInterface.prototype = {
     let data = this.rilContext.data;
 
     if (this.isInfoChanged(message, operatorInfo)) {
       this.updateInfo(message, operatorInfo);
 
       // Update lastKnownNetwork
       if (message.mcc && message.mnc) {
         this._lastKnownNetwork = message.mcc + "-" + message.mnc;
-        if (DEBUG) this.debug("_lastKnownNetwork: " + this._lastKnownNetwork);
       }
 
       // If the voice is unregistered, no need to send RIL:VoiceInfoChanged.
       if (voice.network && !batch) {
         gMessageManager.sendMobileConnectionMessage("RIL:VoiceInfoChanged",
                                                     this.clientId, voice);
       }
 
@@ -2599,17 +2598,17 @@ RadioInterface.prototype = {
    */
   setClockBySntp: function(offset) {
     // Got the SNTP info.
     this.setClockAutoUpdateAvailable(true);
     if (!this._clockAutoUpdateEnabled) {
       return;
     }
     if (this._lastNitzMessage) {
-      debug("SNTP: NITZ available, discard SNTP");
+      if (DEBUG) debug("SNTP: NITZ available, discard SNTP");
       return;
     }
     gTimeService.set(Date.now() + offset);
   },
 
   handleIccMbdn: function(message) {
     let voicemailInfo = this.voicemailInfo;
 
@@ -2654,17 +2653,16 @@ RadioInterface.prototype = {
         Services.prefs.setCharPref("ril.lastKnownSimMcc",
                                    message.mcc.toString());
       } catch (e) {}
     }
 
     // Update lastKnownHomeNetwork.
     if (message.mcc && message.mnc) {
       this._lastKnownHomeNetwork = message.mcc + "-" + message.mnc;
-      this.debug("_lastKnownHomeNetwork: " + this._lastKnownHomeNetwork);
     }
 
     // If spn becomes available, we should check roaming again.
     if (!oldSpn && message.spn) {
       let voice = this.rilContext.voice;
       let data = this.rilContext.data;
       let voiceRoaming = voice.roaming;
       let dataRoaming = data.roaming;
@@ -2810,17 +2808,19 @@ RadioInterface.prototype = {
   handleSettingsChange: function(aName, aResult, aMessage) {
     // Don't allow any content processes to modify the setting
     // "time.clock.automatic-update.available" except for the chrome process.
     if (aName === kSettingsClockAutoUpdateAvailable &&
         aMessage !== "fromInternalSetting") {
       let isClockAutoUpdateAvailable = this._lastNitzMessage !== null ||
                                        this._sntp.isAvailable();
       if (aResult !== isClockAutoUpdateAvailable) {
-        debug("Content processes cannot modify 'time.clock.automatic-update.available'. Restore!");
+        if (DEBUG) {
+          debug("Content processes cannot modify 'time.clock.automatic-update.available'. Restore!");
+        }
         // Restore the setting to the current value.
         this.setClockAutoUpdateAvailable(isClockAutoUpdateAvailable);
       }
     }
 
     // Don't allow any content processes to modify the setting
     // "time.timezone.automatic-update.available" except for the chrome
     // process.
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -3802,17 +3802,19 @@ let RIL = {
       case DATACALL_ACTIVE_DOWN:
       case DATACALL_ACTIVE_UP:
         datacall.state = GECKO_NETWORK_STATE_CONNECTED;
         break;
     }
   },
 
   _processSuppSvcNotification: function(info) {
-    debug("handle supp svc notification: " + JSON.stringify(info));
+    if (DEBUG) {
+      debug("handle supp svc notification: " + JSON.stringify(info));
+    }
 
     let notification = null;
     let callIndex = -1;
 
     if (info.notificationType === 0) {
       // MO intermediate result code. Refer to code1 defined in 3GPP 27.007
       // 7.17.
     } else if (info.notificationType === 1) {
@@ -6212,22 +6214,19 @@ RIL[UNSOLICITED_ON_USSD] = function UNSO
                           sessionEnded: !this._ussdSession});
 };
 RIL[UNSOLICITED_NITZ_TIME_RECEIVED] = function UNSOLICITED_NITZ_TIME_RECEIVED() {
   let dateString = Buf.readString();
 
   // The data contained in the NITZ message is
   // in the form "yy/mm/dd,hh:mm:ss(+/-)tz,dt"
   // for example: 12/02/16,03:36:08-20,00,310410
-
-  // Always print the NITZ info so we can collection what different providers
-  // send down the pipe (see bug XXX).
-  // TODO once data is collected, add in |if (DEBUG)|
-
-  debug("DateTimeZone string " + dateString);
+  // See also bug 714352 - Listen for NITZ updates from rild.
+
+  if (DEBUG) debug("DateTimeZone string " + dateString);
 
   let now = Date.now();
 
   let year = parseInt(dateString.substr(0, 2), 10);
   let month = parseInt(dateString.substr(3, 2), 10);
   let day = parseInt(dateString.substr(6, 2), 10);
   let hours = parseInt(dateString.substr(9, 2), 10);
   let minutes = parseInt(dateString.substr(12, 2), 10);
@@ -13900,10 +13899,10 @@ function onRILMessage(data) {
   Buf.processIncoming(data);
 }
 
 onmessage = function onmessage(event) {
   RIL.handleChromeMessage(event.data);
 };
 
 onerror = function onerror(event) {
-  debug("RIL Worker error" + event.message + "\n");
-};
+  if (DEBUG) debug("RIL Worker error" + event.message + "\n");
+};