DocsUI: Disable debug logging by default.

Per the platform team, we shouldn't enable debug logging automatically
in debug builds because it increases log-spam.  Just disable the flag
and enable it manually when needed.

Add some ifs to make sure all our debug logging is properly removed.

BUG=27380154

Change-Id: I8338f226c07affdb65970c7cb14f1e6aae036934
diff --git a/src/com/android/documentsui/DocumentsActivity.java b/src/com/android/documentsui/DocumentsActivity.java
index 770e35d..805d877 100644
--- a/src/com/android/documentsui/DocumentsActivity.java
+++ b/src/com/android/documentsui/DocumentsActivity.java
@@ -190,7 +190,7 @@
 
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        Log.d(TAG, "onActivityResult() code=" + resultCode);
+        if (DEBUG) Log.d(TAG, "onActivityResult() code=" + resultCode);
 
         // Only relay back results when not canceled; otherwise stick around to
         // let the user pick another app/backend.
@@ -414,7 +414,7 @@
 
     @Override
     void onTaskFinished(Uri... uris) {
-        Log.d(TAG, "onFinished() " + Arrays.toString(uris));
+        if (DEBUG) Log.d(TAG, "onFinished() " + Arrays.toString(uris));
 
         final Intent intent = new Intent();
         if (uris.length == 1) {
diff --git a/src/com/android/documentsui/FilesActivity.java b/src/com/android/documentsui/FilesActivity.java
index fe2dc8e..a6eba41 100644
--- a/src/com/android/documentsui/FilesActivity.java
+++ b/src/com/android/documentsui/FilesActivity.java
@@ -414,7 +414,7 @@
 
     @Override
     void onTaskFinished(Uri... uris) {
-        Log.d(TAG, "onFinished() " + Arrays.toString(uris));
+        if (DEBUG) Log.d(TAG, "onFinished() " + Arrays.toString(uris));
 
         final Intent intent = new Intent();
         if (uris.length == 1) {
diff --git a/src/com/android/documentsui/OpenExternalDirectoryActivity.java b/src/com/android/documentsui/OpenExternalDirectoryActivity.java
index 2b6f396..ab45af1 100644
--- a/src/com/android/documentsui/OpenExternalDirectoryActivity.java
+++ b/src/com/android/documentsui/OpenExternalDirectoryActivity.java
@@ -282,7 +282,7 @@
             logInvalidScopedAccessRequest(context, SCOPED_DIRECTORY_ACCESS_ERROR);
             return null;
         }
-        Log.d(TAG, "doc id for " + file + ": " + docId);
+        if (DEBUG) Log.d(TAG, "doc id for " + file + ": " + docId);
 
         final Uri uri = DocumentsContract.buildTreeDocumentUri(EXTERNAL_STORAGE_AUTH, docId);
         if (uri == null) {
diff --git a/src/com/android/documentsui/RecentsProvider.java b/src/com/android/documentsui/RecentsProvider.java
index e1b1c09..6ef9154 100644
--- a/src/com/android/documentsui/RecentsProvider.java
+++ b/src/com/android/documentsui/RecentsProvider.java
@@ -16,6 +16,7 @@
 
 package com.android.documentsui;
 
+import static com.android.documentsui.Shared.DEBUG;
 import static com.android.documentsui.model.DocumentInfo.getCursorString;
 
 import android.content.ContentProvider;
@@ -338,7 +339,7 @@
                 if (predicate.apply(authority)) {
                     db.delete(TABLE_STATE, StateColumns.AUTHORITY + "=?", new String[] {
                             authority });
-                    Log.d(TAG, "Purged state for " + authority);
+                    if (DEBUG) Log.d(TAG, "Purged state for " + authority);
                 }
             }
         } finally {
diff --git a/src/com/android/documentsui/SearchViewManager.java b/src/com/android/documentsui/SearchViewManager.java
index 63dc2ee..4d0ba4b 100644
--- a/src/com/android/documentsui/SearchViewManager.java
+++ b/src/com/android/documentsui/SearchViewManager.java
@@ -16,6 +16,8 @@
 
 package com.android.documentsui;
 
+import static com.android.documentsui.Shared.DEBUG;
+
 import android.annotation.Nullable;
 import android.os.Bundle;
 import android.provider.DocumentsContract.Root;
@@ -80,7 +82,7 @@
      */
     void update(RootInfo root) {
         if (mMenu == null) {
-            Log.d(TAG, "update called before Search MenuItem installed.");
+            if (DEBUG) Log.d(TAG, "update called before Search MenuItem installed.");
             return;
         }
 
@@ -108,7 +110,7 @@
 
     void showMenu(boolean visible) {
         if (mMenu == null) {
-            Log.d(TAG, "showMenu called before Search MenuItem installed.");
+            if (DEBUG) Log.d(TAG, "showMenu called before Search MenuItem installed.");
             return;
         }
 
diff --git a/src/com/android/documentsui/Shared.java b/src/com/android/documentsui/Shared.java
index 6f1863e..11c5933 100644
--- a/src/com/android/documentsui/Shared.java
+++ b/src/com/android/documentsui/Shared.java
@@ -33,7 +33,7 @@
 
     public static final String TAG = "Documents";
 
-    public static final boolean DEBUG = true;
+    public static final boolean DEBUG = false;
 
     /** Intent action name to pick a copy destination. */
     public static final String ACTION_PICK_COPY_DESTINATION =