Work on issue #2163789: Way too much logging

Dr.No from mcleron.

Change-Id: Iaca2268684f83fe8757e64db0b0e047a19755311
diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java
index fb2608a..be70909 100644
--- a/core/java/android/content/SyncStorageEngine.java
+++ b/core/java/android/content/SyncStorageEngine.java
@@ -1028,7 +1028,7 @@
                     ident++;
                 }
             }
-            Log.d(TAG, "created a new AuthorityInfo for " + accountName
+            if (DEBUG) Log.v(TAG, "created a new AuthorityInfo for " + accountName
                     + ", provider " + authorityName);
             authority = new AuthorityInfo(accountName, authorityName, ident);
             account.authorities.put(authorityName, authority);
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 83e63b9..75ba26f 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -973,8 +973,9 @@
                 return null;
 
             } else {
-                Log.w(TAG, "Bad element under <manifest>: "
-                      + parser.getName());
+                Log.w(TAG, "Unknown element under <manifest>: " + parser.getName()
+                        + " at " + mArchiveSourcePath + " "
+                        + parser.getPositionDescription());
                 XmlUtils.skipCurrentTag(parser);
                 continue;
             }
@@ -1729,8 +1730,9 @@
                     return null;
                 }
                 if (intent.countActions() == 0) {
-                    Log.w(TAG, "Intent filter for activity " + intent
-                            + " defines no actions");
+                    Log.w(TAG, "No actions in intent filter at "
+                            + mArchiveSourcePath + " "
+                            + parser.getPositionDescription());
                 } else {
                     a.intents.add(intent);
                 }
@@ -1877,8 +1879,9 @@
                     return null;
                 }
                 if (intent.countActions() == 0) {
-                    Log.w(TAG, "Intent filter for activity alias " + intent
-                            + " defines no actions");
+                    Log.w(TAG, "No actions in intent filter at "
+                            + mArchiveSourcePath + " "
+                            + parser.getPositionDescription());
                 } else {
                     a.intents.add(intent);
                 }
diff --git a/core/java/android/net/MobileDataStateTracker.java b/core/java/android/net/MobileDataStateTracker.java
index 709766b..b619fee 100644
--- a/core/java/android/net/MobileDataStateTracker.java
+++ b/core/java/android/net/MobileDataStateTracker.java
@@ -42,7 +42,7 @@
 public class MobileDataStateTracker extends NetworkStateTracker {
 
     private static final String TAG = "MobileDataStateTracker";
-    private static final boolean DBG = true;
+    private static final boolean DBG = false;
 
     private Phone.DataState mMobileDataState;
     private ITelephony mPhoneService;
diff --git a/core/java/com/android/internal/backup/LocalTransport.java b/core/java/com/android/internal/backup/LocalTransport.java
index 4fc3edc..12bc5a8 100644
--- a/core/java/com/android/internal/backup/LocalTransport.java
+++ b/core/java/com/android/internal/backup/LocalTransport.java
@@ -41,7 +41,6 @@
 
 
     public LocalTransport(Context context) {
-        if (DEBUG) Log.v(TAG, "Transport constructed");
         mContext = context;
         mPackageManager = context.getPackageManager();
     }
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 9c64709..6a8d692 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -53,7 +53,7 @@
  */
 public class ConnectivityService extends IConnectivityManager.Stub {
 
-    private static final boolean DBG = true;
+    private static final boolean DBG = false;
     private static final String TAG = "ConnectivityService";
 
     // Event log tags (must be in sync with event-log-tags)
diff --git a/services/java/com/android/server/KeyInputQueue.java b/services/java/com/android/server/KeyInputQueue.java
index d7b8f57..35ed448 100644
--- a/services/java/com/android/server/KeyInputQueue.java
+++ b/services/java/com/android/server/KeyInputQueue.java
@@ -48,6 +48,7 @@
 public abstract class KeyInputQueue {
     static final String TAG = "KeyInputQueue";
 
+    static final boolean DEBUG = false;
     static final boolean DEBUG_VIRTUAL_KEYS = false;
     static final boolean DEBUG_POINTERS = false;
     
@@ -200,7 +201,7 @@
             FileInputStream fis = new FileInputStream(
                     "/sys/board_properties/virtualkeys." + deviceName);
             InputStreamReader isr = new InputStreamReader(fis);
-            BufferedReader br = new BufferedReader(isr);
+            BufferedReader br = new BufferedReader(isr, 2048);
             String str = br.readLine();
             if (str != null) {
                 String[] it = str.split(":");
@@ -257,7 +258,7 @@
                 }
                 String name = parser.getAttributeValue(null, "name");
                 if (name != null) {
-                    Log.d(TAG, "addExcludedDevice " + name);
+                    if (DEBUG) Log.v(TAG, "addExcludedDevice " + name);
                     addExcludedDevice(name);
                 }
             }
@@ -413,7 +414,7 @@
     
     Thread mThread = new Thread("InputDeviceReader") {
         public void run() {
-            Log.d(TAG, "InputDeviceReader.run()");
+            if (DEBUG) Log.v(TAG, "InputDeviceReader.run()");
             android.os.Process.setThreadPriority(
                     android.os.Process.THREAD_PRIORITY_URGENT_DISPLAY);
             
diff --git a/services/java/com/android/server/RandomBlock.java b/services/java/com/android/server/RandomBlock.java
index 4ac1c6e..f7847ec 100644
--- a/services/java/com/android/server/RandomBlock.java
+++ b/services/java/com/android/server/RandomBlock.java
@@ -32,13 +32,14 @@
 class RandomBlock {
 
     private static final String TAG = "RandomBlock";
+    private static final boolean DEBUG = false;
     private static final int BLOCK_SIZE = 4096;
     private byte[] block = new byte[BLOCK_SIZE];
 
     private RandomBlock() { }
 
     static RandomBlock fromFile(String filename) throws IOException {
-        Log.v(TAG, "reading from file " + filename);
+        if (DEBUG) Log.v(TAG, "reading from file " + filename);
         InputStream stream = null;
         try {
             stream = new FileInputStream(filename);
@@ -62,7 +63,7 @@
     }
 
     void toFile(String filename) throws IOException {
-        Log.v(TAG, "writing to file " + filename);
+        if (DEBUG) Log.v(TAG, "writing to file " + filename);
         RandomAccessFile out = null;
         try {
             out = new RandomAccessFile(filename, "rws");
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 20fc1da..cd39d0d 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -9183,7 +9183,7 @@
                     pw.print("      lowMem="); pw.print(proc.reportLowMemory);
                             pw.print(", last gced=");
                             pw.print(now-proc.lastRequestedGc);
-                            pw.print(" ms ago, last lowMwm=");
+                            pw.print(" ms ago, last lowMem=");
                             pw.print(now-proc.lastLowMemory);
                             pw.println(" ms ago");
                     
@@ -12306,8 +12306,10 @@
             // broadcast, then do nothing at this point.  Just in case, we
             // check that the process we're waiting for still exists.
             if (mPendingBroadcast != null) {
-                Log.i(TAG, "processNextBroadcast: waiting for "
-                        + mPendingBroadcast.curApp);
+                if (DEBUG_BROADCAST_LIGHT) {
+                    Log.v(TAG, "processNextBroadcast: waiting for "
+                            + mPendingBroadcast.curApp);
+                }
 
                 boolean isDead;
                 synchronized (mPidsSelfLocked) {
diff --git a/services/java/com/android/server/status/StatusBarIcon.java b/services/java/com/android/server/status/StatusBarIcon.java
index 6d09919..857784b 100644
--- a/services/java/com/android/server/status/StatusBarIcon.java
+++ b/services/java/com/android/server/status/StatusBarIcon.java
@@ -149,6 +149,11 @@
             r = context.getResources();
         }
 
+        if (data.iconId == 0) {
+            Log.w(StatusBarService.TAG, "No icon ID for slot " + data.slot);
+            return null;
+        }
+        
         try {
             return r.getDrawable(data.iconId);
         } catch (RuntimeException e) {
diff --git a/services/java/com/android/server/status/StatusBarPolicy.java b/services/java/com/android/server/status/StatusBarPolicy.java
index 6d54cae..cf63d02 100644
--- a/services/java/com/android/server/status/StatusBarPolicy.java
+++ b/services/java/com/android/server/status/StatusBarPolicy.java
@@ -1180,16 +1180,16 @@
         final String action = intent.getAction();
         final boolean enabled = intent.getBooleanExtra(TtyIntent.TTY_ENABLED, false);
 
-        Log.i(TAG, "updateTTY: enabled: " + enabled);
+        if (false) Log.v(TAG, "updateTTY: enabled: " + enabled);
 
         if (enabled) {
             // TTY is on
-            Log.i(TAG, "updateTTY: set TTY on");
+            if (false) Log.v(TAG, "updateTTY: set TTY on");
             mService.updateIcon(mTTYModeIcon, mTTYModeEnableIconData, null);
             mService.setIconVisibility(mTTYModeIcon, true);
         } else {
             // TTY is off
-            Log.i(TAG, "updateTTY: set TTY off");
+            if (false) Log.v(TAG, "updateTTY: set TTY off");
             mService.setIconVisibility(mTTYModeIcon, false);
         }
     }
@@ -1220,7 +1220,7 @@
         }
 
         if (iconIndex == EriInfo.ROAMING_INDICATOR_OFF) {
-            Log.d(TAG, "Cdma ROAMING_INDICATOR_OFF, removing ERI icon");
+            if (false) Log.v(TAG, "Cdma ROAMING_INDICATOR_OFF, removing ERI icon");
             mService.setIconVisibility(mCdmaRoamingIndicatorIcon, false);
             return;
         }
diff --git a/services/java/com/android/server/status/StatusBarService.java b/services/java/com/android/server/status/StatusBarService.java
index 9929498..fe761ea 100644
--- a/services/java/com/android/server/status/StatusBarService.java
+++ b/services/java/com/android/server/status/StatusBarService.java
@@ -1733,7 +1733,7 @@
         mOngoingTitle.setText(mContext.getText(R.string.status_bar_ongoing_events_title));
         mLatestTitle.setText(mContext.getText(R.string.status_bar_latest_events_title));
         mNoNotificationsTitle.setText(mContext.getText(R.string.status_bar_no_notifications_title));
-        Log.d(TAG, "updateResources");
+        if (false) Log.v(TAG, "updateResources");
     }
 
     //