Log reduction
Robert Greenwalt [Tue, 30 Jun 2015 23:26:05 +0000 (16:26 -0700)]
Found all this while checking out 21957591.  My work there was
a bust, but don't want to lose this logging cleanup.

bug: 22225815
Change-Id: I7a3e932e06d035066d4adbc10c99ecf2a20be5fd

src/java/com/android/internal/telephony/PhoneFactory.java
src/java/com/android/internal/telephony/dataconnection/ApnContext.java
src/java/com/android/internal/telephony/dataconnection/DcTracker.java

index 9877934..6c49c4a 100644 (file)
@@ -53,6 +53,7 @@ public class PhoneFactory {
     static final String LOG_TAG = "PhoneFactory";
     static final int SOCKET_OPEN_RETRY_MILLIS = 2 * 1000;
     static final int SOCKET_OPEN_MAX_RETRY = 3;
+    static final boolean DBG = false;
 
     //***** Class Variables
 
@@ -228,15 +229,18 @@ public class PhoneFactory {
                 throw new IllegalStateException("Default phones haven't been made yet!");
                 // CAF_MSIM FIXME need to introduce default phone id ?
             } else if (phoneId == SubscriptionManager.DEFAULT_PHONE_INDEX) {
-                dbgInfo = "phoneId == DEFAULT_PHONE_ID return sProxyPhone";
+                if (DBG) dbgInfo = "phoneId == DEFAULT_PHONE_ID return sProxyPhone";
                 phone = sProxyPhone;
             } else {
-                dbgInfo = "phoneId != DEFAULT_PHONE_ID return sProxyPhones[phoneId]";
+                if (DBG) dbgInfo = "phoneId != DEFAULT_PHONE_ID return sProxyPhones[phoneId]";
                 phone = (((phoneId >= 0)
                                 && (phoneId < TelephonyManager.getDefault().getPhoneCount()))
                         ? sProxyPhones[phoneId] : null);
             }
-            Rlog.d(LOG_TAG, "getPhone:- " + dbgInfo + " phoneId=" + phoneId + " phone=" + phone);
+            if (DBG) {
+                Rlog.d(LOG_TAG, "getPhone:- " + dbgInfo + " phoneId=" + phoneId +
+                        " phone=" + phone);
+            }
             return phone;
         }
     }
@@ -278,7 +282,7 @@ public class PhoneFactory {
 
         // Update MCC MNC device configuration information
         String defaultMccMnc = TelephonyManager.getDefault().getSimOperatorNumericForPhone(phoneId);
-        Rlog.d(LOG_TAG, "update mccmnc=" + defaultMccMnc);
+        if (DBG) Rlog.d(LOG_TAG, "update mccmnc=" + defaultMccMnc);
         MccTable.updateMccMncConfiguration(sContext, defaultMccMnc, false);
 
         // Broadcast an Intent for default sub change
index 2a1f1c5..38240b2 100644 (file)
@@ -127,12 +127,12 @@ public class ApnContext {
     }
 
     public synchronized ApnSetting getApnSetting() {
-        log("getApnSetting: apnSetting=" + mApnSetting);
+        if (DBG) log("getApnSetting: apnSetting=" + mApnSetting);
         return mApnSetting;
     }
 
     public synchronized void setApnSetting(ApnSetting apnSetting) {
-        log("setApnSetting: apnSetting=" + apnSetting);
+        if (DBG) log("setApnSetting: apnSetting=" + apnSetting);
         mApnSetting = apnSetting;
     }
 
index c6b4708..92c91c2 100644 (file)
@@ -715,7 +715,7 @@ public final class DcTracker extends DcTrackerBase {
         boolean recordsLoaded = false;
         if (r != null) {
             recordsLoaded = r.getRecordsLoaded();
-            if (DBG) log("isDataAllowed getRecordsLoaded=" + recordsLoaded);
+            if (DBG && !recordsLoaded) log("isDataAllowed getRecordsLoaded=" + recordsLoaded);
         }
 
         //FIXME always attach
@@ -1599,7 +1599,6 @@ public final class DcTracker extends DcTrackerBase {
         ApnContext potentialApnCtx = null;
         for (ApnContext curApnCtx : mApnContexts.values()) {
             DcAsyncChannel curDcac = curApnCtx.getDcAc();
-            log("curDcac: " + curDcac);
             if (curDcac != null) {
                 ApnSetting apnSetting = curApnCtx.getApnSetting();
                 log("apnSetting: " + apnSetting);
@@ -2463,10 +2462,9 @@ public final class DcTracker extends DcTrackerBase {
         if (mAllApnSettings != null) {
             if (DBG) log("buildWaitingApns: mAllApnSettings=" + mAllApnSettings);
             for (ApnSetting apn : mAllApnSettings) {
-                if (DBG) log("buildWaitingApns: apn=" + apn);
                 if (apn.canHandleType(requestedApnType)) {
                     if (ServiceState.bitmaskHasTech(apn.bearerBitmask, radioTech)) {
-                        if (DBG) log("buildWaitingApns: adding apn=" + apn.toString());
+                        if (DBG) log("buildWaitingApns: adding apn=" + apn);
                         apnList.add(apn);
                     } else {
                         if (DBG) {
@@ -2474,13 +2472,11 @@ public final class DcTracker extends DcTrackerBase {
                                     "not include radioTech:" + radioTech);
                         }
                     }
-                } else {
-                if (DBG) {
+                } else if (DBG) {
                     log("buildWaitingApns: couldn't handle requesedApnType="
                             + requestedApnType);
                 }
             }
-            }
         } else {
             loge("mAllApnSettings is empty!");
         }