Don't log verbose stuff by default.
Bug: 32633923
Verbose logging can be enabled using: adb shell setprop log.tag.Documents VERBOSE
Change-Id: I03a5d4dae54a023d8b1b000bc7ea8e34ffe1035f
diff --git a/src/com/android/documentsui/DirectoryReloadLock.java b/src/com/android/documentsui/DirectoryReloadLock.java
index b44a963..4299914 100644
--- a/src/com/android/documentsui/DirectoryReloadLock.java
+++ b/src/com/android/documentsui/DirectoryReloadLock.java
@@ -16,7 +16,7 @@
package com.android.documentsui;
-import static com.android.documentsui.base.Shared.DEBUG;
+import static com.android.documentsui.base.Shared.VERBOSE;
import android.annotation.MainThread;
import android.annotation.Nullable;
@@ -42,7 +42,7 @@
public void block() {
Shared.checkMainLoop();
mPauseCount++;
- if (DEBUG) Log.v(TAG, "Block count increments to " + mPauseCount + ".");
+ if (VERBOSE) Log.v(TAG, "Block count increments to " + mPauseCount + ".");
}
/**
@@ -54,7 +54,7 @@
Shared.checkMainLoop();
assert(mPauseCount > 0);
mPauseCount--;
- if (DEBUG) Log.v(TAG, "Block count decrements to " + mPauseCount + ".");
+ if (VERBOSE) Log.v(TAG, "Block count decrements to " + mPauseCount + ".");
if (mPauseCount == 0 && mCallback != null) {
mCallback.run();
mCallback = null;
@@ -72,4 +72,4 @@
mCallback = update;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/com/android/documentsui/NavigationViewManager.java b/src/com/android/documentsui/NavigationViewManager.java
index 65f9000..07e3824 100644
--- a/src/com/android/documentsui/NavigationViewManager.java
+++ b/src/com/android/documentsui/NavigationViewManager.java
@@ -16,7 +16,7 @@
package com.android.documentsui;
-import static com.android.documentsui.base.Shared.DEBUG;
+import static com.android.documentsui.base.Shared.VERBOSE;
import android.annotation.Nullable;
import android.graphics.drawable.Drawable;
@@ -99,7 +99,7 @@
if (mState.stack.size() <= 1) {
mBreadcrumb.show(false);
String title = mEnv.getCurrentRoot().title;
- if (DEBUG) Log.v(TAG, "New toolbar title is: " + title);
+ if (VERBOSE) Log.v(TAG, "New toolbar title is: " + title);
mToolbar.setTitle(title);
} else {
mBreadcrumb.show(true);
@@ -107,7 +107,7 @@
mBreadcrumb.postUpdate();
}
- if (DEBUG) Log.v(TAG, "Final toolbar title is: " + mToolbar.getTitle());
+ if (VERBOSE) Log.v(TAG, "Final toolbar title is: " + mToolbar.getTitle());
}
// Hamburger if drawer is present, else sad nullness.
diff --git a/src/com/android/documentsui/base/RootInfo.java b/src/com/android/documentsui/base/RootInfo.java
index 50b9603..0b46417 100644
--- a/src/com/android/documentsui/base/RootInfo.java
+++ b/src/com/android/documentsui/base/RootInfo.java
@@ -19,7 +19,7 @@
import static com.android.documentsui.base.DocumentInfo.getCursorInt;
import static com.android.documentsui.base.DocumentInfo.getCursorLong;
import static com.android.documentsui.base.DocumentInfo.getCursorString;
-import static com.android.documentsui.base.Shared.DEBUG;
+import static com.android.documentsui.base.Shared.VERBOSE;
import static com.android.documentsui.base.Shared.compareToIgnoreCaseNullable;
import android.annotation.IntDef;
@@ -233,7 +233,7 @@
derivedType = TYPE_OTHER;
}
- if (DEBUG) Log.v(TAG, "Deriving fields: " + this);
+ if (VERBOSE) Log.v(TAG, "Derived fields: " + this);
}
public Uri getUri() {
diff --git a/src/com/android/documentsui/base/Shared.java b/src/com/android/documentsui/base/Shared.java
index 31a9451..df36cec 100644
--- a/src/com/android/documentsui/base/Shared.java
+++ b/src/com/android/documentsui/base/Shared.java
@@ -47,6 +47,7 @@
public static final String TAG = "Documents";
public static final boolean DEBUG = true;
+ public static final boolean VERBOSE = DEBUG && Log.isLoggable(TAG, Log.VERBOSE);
public static final boolean ENABLE_OMC_API_FEATURES = true;
diff --git a/src/com/android/documentsui/dirlist/DirectoryFragment.java b/src/com/android/documentsui/dirlist/DirectoryFragment.java
index efbbeed..03ed834 100644
--- a/src/com/android/documentsui/dirlist/DirectoryFragment.java
+++ b/src/com/android/documentsui/dirlist/DirectoryFragment.java
@@ -19,6 +19,7 @@
import static com.android.documentsui.base.DocumentInfo.getCursorInt;
import static com.android.documentsui.base.DocumentInfo.getCursorString;
import static com.android.documentsui.base.Shared.DEBUG;
+import static com.android.documentsui.base.Shared.VERBOSE;
import static com.android.documentsui.base.State.MODE_GRID;
import static com.android.documentsui.base.State.MODE_LIST;
@@ -526,14 +527,15 @@
*/
private void scaleLayout(float scale) {
assert(Build.IS_DEBUGGABLE);
- if (DEBUG) Log.v(TAG, "Handling scale event: " + scale + ", existing scale: " + mLiveScale);
+ if (VERBOSE) Log.v(
+ TAG, "Handling scale event: " + scale + ", existing scale: " + mLiveScale);
if (mMode == MODE_GRID) {
float minScale = getFraction(R.fraction.grid_scale_min);
float maxScale = getFraction(R.fraction.grid_scale_max);
float nextScale = mLiveScale * scale;
- if (DEBUG) Log.v(TAG,
+ if (VERBOSE) Log.v(TAG,
"Next scale " + nextScale + ", Min/max scale " + minScale + "/" + maxScale);
if (nextScale > minScale && nextScale < maxScale) {
diff --git a/src/com/android/documentsui/dirlist/IconHelper.java b/src/com/android/documentsui/dirlist/IconHelper.java
index fa1c121..77a6466 100644
--- a/src/com/android/documentsui/dirlist/IconHelper.java
+++ b/src/com/android/documentsui/dirlist/IconHelper.java
@@ -16,7 +16,7 @@
package com.android.documentsui.dirlist;
-import static com.android.documentsui.base.Shared.DEBUG;
+import static com.android.documentsui.base.Shared.VERBOSE;
import static com.android.documentsui.base.State.MODE_GRID;
import static com.android.documentsui.base.State.MODE_LIST;
@@ -160,12 +160,12 @@
mImageAnimator = animator;
mLastModified = lastModified;
mSignal = new CancellationSignal();
- if (DEBUG) Log.v(TAG, "Starting icon loader task for " + mUri);
+ if (VERBOSE) Log.v(TAG, "Starting icon loader task for " + mUri);
}
@Override
public void preempt() {
- if (DEBUG) Log.v(TAG, "Icon loader task for " + mUri + " was cancelled.");
+ if (VERBOSE) Log.v(TAG, "Icon loader task for " + mUri + " was cancelled.");
cancel(false);
mSignal.cancel();
}
@@ -201,7 +201,7 @@
@Override
protected void onPostExecute(Bitmap result) {
- if (DEBUG) Log.v(TAG, "Loader task for " + mUri + " completed");
+ if (VERBOSE) Log.v(TAG, "Loader task for " + mUri + " completed");
if (mIconThumb.getTag() == this && result != null) {
mIconThumb.setTag(null);
@@ -282,7 +282,7 @@
iconThumb.setImageBitmap(cachedThumbnail);
boolean stale = (docLastModified > result.getLastModified());
- if (DEBUG) Log.v(TAG,
+ if (VERBOSE) Log.v(TAG,
String.format("Load thumbnail for %s, got result %d and stale %b.",
uri.toString(), result.getStatus(), stale));
if (!result.isExactHit() || stale) {
diff --git a/src/com/android/documentsui/dirlist/ListeningGestureDetector.java b/src/com/android/documentsui/dirlist/ListeningGestureDetector.java
index 17ac867..d2f6972 100644
--- a/src/com/android/documentsui/dirlist/ListeningGestureDetector.java
+++ b/src/com/android/documentsui/dirlist/ListeningGestureDetector.java
@@ -16,7 +16,7 @@
package com.android.documentsui.dirlist;
-import static com.android.documentsui.base.Shared.DEBUG;
+import static com.android.documentsui.base.Shared.VERBOSE;
import android.annotation.Nullable;
import android.content.Context;
@@ -82,7 +82,7 @@
new ScaleGestureDetector.SimpleOnScaleGestureListener() {
@Override
public boolean onScale(ScaleGestureDetector detector) {
- if (DEBUG) Log.v(TAG,
+ if (VERBOSE) Log.v(TAG,
"Received scale event: " + detector.getScaleFactor());
scaleHandler.accept(detector.getScaleFactor());
return true;
@@ -176,4 +176,4 @@
// Pass events to UserInputHandler.
return onTouchEvent(event);
}
-}
\ No newline at end of file
+}
diff --git a/src/com/android/documentsui/dirlist/Model.java b/src/com/android/documentsui/dirlist/Model.java
index 8bdf079..5094f41 100644
--- a/src/com/android/documentsui/dirlist/Model.java
+++ b/src/com/android/documentsui/dirlist/Model.java
@@ -18,6 +18,7 @@
import static com.android.documentsui.base.DocumentInfo.getCursorString;
import static com.android.documentsui.base.Shared.DEBUG;
+import static com.android.documentsui.base.Shared.VERBOSE;
import android.annotation.IntDef;
import android.database.Cursor;
@@ -241,7 +242,7 @@
if (filter.test(cursor)) {
docs.add(DocumentInfo.fromDirectoryCursor(cursor));
} else {
- if (DEBUG) Log.v(TAG, "Filtered document from results: " + modelId);
+ if (VERBOSE) Log.v(TAG, "Filtered document from results: " + modelId);
}
}
diff --git a/src/com/android/documentsui/dirlist/UserInputHandler.java b/src/com/android/documentsui/dirlist/UserInputHandler.java
index e107c2b..00912cd 100644
--- a/src/com/android/documentsui/dirlist/UserInputHandler.java
+++ b/src/com/android/documentsui/dirlist/UserInputHandler.java
@@ -17,6 +17,7 @@
package com.android.documentsui.dirlist;
import static com.android.documentsui.base.Shared.DEBUG;
+import static com.android.documentsui.base.Shared.VERBOSE;
import android.support.annotation.VisibleForTesting;
import android.util.Log;
@@ -211,18 +212,18 @@
private final class TouchInputDelegate {
boolean onDown(T event) {
- if (DEBUG) Log.v(TTAG, "Delegated onDown event.");
+ if (VERBOSE) Log.v(TTAG, "Delegated onDown event.");
return false;
}
// Don't consume so the RecyclerView will get the event and will get touch-based scrolling
boolean onScroll(T event) {
- if (DEBUG) Log.v(TTAG, "Delegated onScroll event.");
+ if (VERBOSE) Log.v(TTAG, "Delegated onScroll event.");
return false;
}
boolean onSingleTapUp(T event) {
- if (DEBUG) Log.v(TTAG, "Delegated onSingleTapUp event.");
+ if (VERBOSE) Log.v(TTAG, "Delegated onSingleTapUp event.");
if (!event.isOverModelItem()) {
if (DEBUG) Log.d(TTAG, "Tap not associated w/ model item. Clearing selection.");
mSelectionMgr.clearSelection();
@@ -247,17 +248,17 @@
}
boolean onSingleTapConfirmed(T event) {
- if (DEBUG) Log.v(TTAG, "Delegated onSingleTapConfirmed event.");
+ if (VERBOSE) Log.v(TTAG, "Delegated onSingleTapConfirmed event.");
return false;
}
boolean onDoubleTap(T event) {
- if (DEBUG) Log.v(TTAG, "Delegated onDoubleTap event.");
+ if (VERBOSE) Log.v(TTAG, "Delegated onDoubleTap event.");
return false;
}
final void onLongPress(T event) {
- if (DEBUG) Log.v(TTAG, "Delegated onLongPress event.");
+ if (VERBOSE) Log.v(TTAG, "Delegated onLongPress event.");
if (!event.isOverModelItem()) {
if (DEBUG) Log.d(TTAG, "Ignoring LongPress on non-model-backed item.");
return;
@@ -291,7 +292,7 @@
private boolean mHandledOnDown;
boolean onDown(T event) {
- if (DEBUG) Log.v(MTAG, "Delegated onDown event.");
+ if (VERBOSE) Log.v(MTAG, "Delegated onDown event.");
if (event.isSecondaryButtonPressed()
|| (event.isAltKeyDown() && event.isPrimaryButtonPressed())) {
mHandledOnDown = true;
@@ -303,18 +304,18 @@
// Don't scroll content window in response to mouse drag
boolean onScroll(T event) {
- if (DEBUG) Log.v(MTAG, "Delegated onScroll event.");
+ if (VERBOSE) Log.v(MTAG, "Delegated onScroll event.");
return true;
}
boolean onSingleTapUp(T event) {
- if (DEBUG) Log.v(MTAG, "Delegated onSingleTapUp event.");
+ if (VERBOSE) Log.v(MTAG, "Delegated onSingleTapUp event.");
// See b/27377794. Since we don't get a button state back from UP events, we have to
// explicitly save this state to know whether something was previously handled by
// DOWN events or not.
if (mHandledOnDown) {
- if (DEBUG) Log.v(MTAG, "Ignoring onSingleTapUp, previously handled in onDown.");
+ if (VERBOSE) Log.v(MTAG, "Ignoring onSingleTapUp, previously handled in onDown.");
mHandledOnDown = false;
return false;
}
@@ -348,9 +349,9 @@
}
boolean onSingleTapConfirmed(T event) {
- if (DEBUG) Log.v(MTAG, "Delegated onSingleTapConfirmed event.");
+ if (VERBOSE) Log.v(MTAG, "Delegated onSingleTapConfirmed event.");
if (mHandledTapUp) {
- if (DEBUG) Log.v(MTAG, "Ignoring onSingleTapConfirmed, previously handled in onSingleTapUp.");
+ if (VERBOSE) Log.v(MTAG, "Ignoring onSingleTapConfirmed, previously handled in onSingleTapUp.");
mHandledTapUp = false;
return false;
}
@@ -385,7 +386,7 @@
}
boolean onDoubleTap(T event) {
- if (DEBUG) Log.v(MTAG, "Delegated onDoubleTap event.");
+ if (VERBOSE) Log.v(MTAG, "Delegated onDoubleTap event.");
mHandledTapUp = false;
if (!event.isOverModelItem()) {
@@ -403,12 +404,12 @@
}
final void onLongPress(T event) {
- if (DEBUG) Log.v(MTAG, "Delegated onLongPress event.");
+ if (VERBOSE) Log.v(MTAG, "Delegated onLongPress event.");
return;
}
private boolean onRightClick(T event) {
- if (DEBUG) Log.v(MTAG, "Delegated onRightClick event.");
+ if (VERBOSE) Log.v(MTAG, "Delegated onRightClick event.");
if (event.isOverModelItem()) {
DocumentDetails doc = event.getDocumentDetails();
if (!mSelectionMgr.getSelection().contains(doc.getModelId())) {
diff --git a/src/com/android/documentsui/roots/RootsAccess.java b/src/com/android/documentsui/roots/RootsAccess.java
index 784ccfb..e721905 100644
--- a/src/com/android/documentsui/roots/RootsAccess.java
+++ b/src/com/android/documentsui/roots/RootsAccess.java
@@ -17,6 +17,7 @@
package com.android.documentsui.roots;
import static com.android.documentsui.base.Shared.DEBUG;
+import static com.android.documentsui.base.Shared.VERBOSE;
import android.net.Uri;
import android.util.Log;
@@ -63,49 +64,49 @@
final List<RootInfo> matching = new ArrayList<>();
for (RootInfo root : roots) {
- if (DEBUG) Log.v(tag, "Evaluationg root: " + root);
+ if (VERBOSE) Log.v(tag, "Evaluationg root: " + root);
if (state.action == State.ACTION_CREATE && !root.supportsCreate()) {
- if (DEBUG) Log.v(tag, "Excluding read-only root because: ACTION_CREATE.");
+ if (VERBOSE) Log.v(tag, "Excluding read-only root because: ACTION_CREATE.");
continue;
}
if (state.action == State.ACTION_PICK_COPY_DESTINATION
&& !root.supportsCreate()) {
- if (DEBUG) Log.v(
+ if (VERBOSE) Log.v(
tag, "Excluding read-only root because: ACTION_PICK_COPY_DESTINATION.");
continue;
}
if (state.action == State.ACTION_OPEN_TREE && !root.supportsChildren()) {
- if (DEBUG) Log.v(
+ if (VERBOSE) Log.v(
tag, "Excluding root !supportsChildren because: ACTION_OPEN_TREE.");
continue;
}
if (!state.showAdvanced && root.isAdvanced()) {
- if (DEBUG) Log.v(tag, "Excluding root because: unwanted advanced device.");
+ if (VERBOSE) Log.v(tag, "Excluding root because: unwanted advanced device.");
continue;
}
if (state.localOnly && !root.isLocalOnly()) {
- if (DEBUG) Log.v(tag, "Excluding root because: unwanted non-local device.");
+ if (VERBOSE) Log.v(tag, "Excluding root because: unwanted non-local device.");
continue;
}
if (state.directoryCopy && root.isDownloads()) {
- if (DEBUG) Log.v(
+ if (VERBOSE) Log.v(
tag, "Excluding downloads root because: unsupported directory copy.");
continue;
}
if (state.action == State.ACTION_OPEN && root.isEmpty()) {
- if (DEBUG) Log.v(tag, "Excluding empty root because: ACTION_OPEN.");
+ if (VERBOSE) Log.v(tag, "Excluding empty root because: ACTION_OPEN.");
continue;
}
if (state.action == State.ACTION_GET_CONTENT && root.isEmpty()) {
- if (DEBUG) Log.v(tag, "Excluding empty root because: ACTION_GET_CONTENT.");
+ if (VERBOSE) Log.v(tag, "Excluding empty root because: ACTION_GET_CONTENT.");
continue;
}
@@ -113,14 +114,14 @@
MimeTypes.mimeMatches(root.derivedMimeTypes, state.acceptMimes) ||
MimeTypes.mimeMatches(state.acceptMimes, root.derivedMimeTypes);
if (!overlap) {
- if (DEBUG) Log.v(
+ if (VERBOSE) Log.v(
tag, "Excluding root because: unsupported content types > "
+ Arrays.toString(state.acceptMimes));
continue;
}
if (state.excludedAuthorities.contains(root.authority)) {
- if (DEBUG) Log.v(tag, "Excluding root because: owned by calling package.");
+ if (VERBOSE) Log.v(tag, "Excluding root because: owned by calling package.");
continue;
}
diff --git a/src/com/android/documentsui/roots/RootsCache.java b/src/com/android/documentsui/roots/RootsCache.java
index 4111a95..43ef61a 100644
--- a/src/com/android/documentsui/roots/RootsCache.java
+++ b/src/com/android/documentsui/roots/RootsCache.java
@@ -17,6 +17,7 @@
package com.android.documentsui.roots;
import static com.android.documentsui.base.Shared.DEBUG;
+import static com.android.documentsui.base.Shared.VERBOSE;
import android.content.BroadcastReceiver.PendingResult;
import android.content.ContentProviderClient;
@@ -211,7 +212,7 @@
*/
private Collection<RootInfo> loadRootsForAuthority(ContentResolver resolver, String authority,
boolean forceRefresh) {
- if (DEBUG) Log.v(TAG, "Loading roots for " + authority);
+ if (VERBOSE) Log.v(TAG, "Loading roots for " + authority);
synchronized (mObservedAuthorities) {
if (mObservedAuthorities.add(authority)) {
@@ -227,7 +228,7 @@
// long-lived system process.
final Bundle systemCache = resolver.getCache(rootsUri);
if (systemCache != null) {
- if (DEBUG) Log.v(TAG, "System cache hit for " + authority);
+ if (VERBOSE) Log.v(TAG, "System cache hit for " + authority);
return systemCache.getParcelableArrayList(TAG);
}
}
@@ -378,7 +379,7 @@
}
final long delta = SystemClock.elapsedRealtime() - start;
- if (DEBUG) Log.v(TAG,
+ if (VERBOSE) Log.v(TAG,
"Update found " + mTaskRoots.size() + " roots in " + delta + "ms");
synchronized (mLock) {
mFirstLoadDone = true;
@@ -398,7 +399,7 @@
// Ignore stopped packages for now; we might query them
// later during UI interaction.
if ((info.applicationInfo.flags & ApplicationInfo.FLAG_STOPPED) != 0) {
- if (DEBUG) Log.v(TAG, "Ignoring stopped authority " + info.authority);
+ if (VERBOSE) Log.v(TAG, "Ignoring stopped authority " + info.authority);
mTaskStoppedAuthorities.add(info.authority);
return;
}
diff --git a/src/com/android/documentsui/selection/Range.java b/src/com/android/documentsui/selection/Range.java
index cd04f90..c7db84c 100644
--- a/src/com/android/documentsui/selection/Range.java
+++ b/src/com/android/documentsui/selection/Range.java
@@ -16,6 +16,7 @@
package com.android.documentsui.selection;
import static com.android.documentsui.base.Shared.DEBUG;
+import static com.android.documentsui.base.Shared.VERBOSE;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
@@ -71,7 +72,7 @@
assert(mBegin != mEnd);
if (position == mEnd) {
- if (DEBUG) Log.v(SelectionManager.TAG, "Ignoring no-op revision for range: " + this);
+ if (VERBOSE) Log.v(SelectionManager.TAG, "Ignoring no-op revision for range: " + this);
}
if (mEnd > mBegin) {
@@ -148,4 +149,4 @@
interface RangeUpdater {
void updateForRange(int begin, int end, boolean selected, @RangeType int type);
}
-}
\ No newline at end of file
+}
diff --git a/src/com/android/documentsui/sidebar/RootsFragment.java b/src/com/android/documentsui/sidebar/RootsFragment.java
index 88c98a4..242f574 100644
--- a/src/com/android/documentsui/sidebar/RootsFragment.java
+++ b/src/com/android/documentsui/sidebar/RootsFragment.java
@@ -17,6 +17,7 @@
package com.android.documentsui.sidebar;
import static com.android.documentsui.base.Shared.DEBUG;
+import static com.android.documentsui.base.Shared.VERBOSE;
import android.annotation.Nullable;
import android.app.Activity;
@@ -272,14 +273,14 @@
Collections.sort(libraries, comp);
Collections.sort(others, comp);
- if (DEBUG) Log.v(TAG, "Adding library roots: " + libraries);
+ if (VERBOSE) Log.v(TAG, "Adding library roots: " + libraries);
result.addAll(libraries);
// Only add the spacer if it is actually separating something.
if (!libraries.isEmpty() && !others.isEmpty()) {
result.add(new SpacerItem());
}
- if (DEBUG) Log.v(TAG, "Adding plain roots: " + libraries);
+ if (VERBOSE) Log.v(TAG, "Adding plain roots: " + libraries);
result.addAll(others);
// Include apps that can handle this intent too.
@@ -295,7 +296,7 @@
* special section at bottom).
*/
private void includeHandlerApps(Intent handlerAppIntent, List<Item> result) {
- if (DEBUG) Log.v(TAG, "Adding handler apps for intent: " + handlerAppIntent);
+ if (VERBOSE) Log.v(TAG, "Adding handler apps for intent: " + handlerAppIntent);
Context context = getContext();
final PackageManager pm = context.getPackageManager();
final List<ResolveInfo> infos = pm.queryIntentActivities(