Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a2cca66 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Quiet some of the noisiest Log msgs in DEBUG." into nyc-andromeda-dev

parents 7232bf03 c88f83c0
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -33,10 +33,10 @@ import com.android.documentsui.model.DocumentInfo;
import com.android.documentsui.model.RootInfo;
import com.android.documentsui.sorting.SortModel;

import libcore.io.IoUtils;

import java.io.FileNotFoundException;

import libcore.io.IoUtils;

public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> {

    private static final String TAG = "DirectoryLoader";
@@ -45,7 +45,6 @@ public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> {

    private final ForceLoadContentObserver mObserver = new ForceLoadContentObserver();

    private final int mType;
    private final RootInfo mRoot;
    private final Uri mUri;
    private final SortModel mModel;
@@ -55,10 +54,15 @@ public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> {
    private CancellationSignal mSignal;
    private DirectoryResult mResult;

    public DirectoryLoader(Context context, int type, RootInfo root, DocumentInfo doc, Uri uri,
            SortModel model, boolean inSearchMode) {
    public DirectoryLoader(
            Context context,
            RootInfo root,
            DocumentInfo doc,
            Uri uri,
            SortModel model,
            boolean inSearchMode) {

        super(context, ProviderExecutor.forAuthority(root.authority));
        mType = type;
        mRoot = root;
        mUri = uri;
        mModel = model;
+2 −2
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ public class NavigationViewManager {
        if (mState.stack.size() <= 1) {
            mBreadcrumb.show(false);
            String title = mEnv.getCurrentRoot().title;
            if (DEBUG) Log.d(TAG, "New toolbar title is: " + title);
            if (DEBUG) Log.v(TAG, "New toolbar title is: " + title);
            mToolbar.setTitle(title);
        } else {
            mBreadcrumb.show(true);
@@ -106,7 +106,7 @@ public class NavigationViewManager {
            mBreadcrumb.postUpdate();
        }

        if (DEBUG) Log.d(TAG, "Final toolbar title is: " + mToolbar.getTitle());
        if (DEBUG) Log.v(TAG, "Final toolbar title is: " + mToolbar.getTitle());
    }

    // Hamburger if drawer is present, else sad nullness.
+19 −23
Original line number Diff line number Diff line
@@ -113,7 +113,7 @@ public class RootsCache {
                Log.w(TAG, "Received onChange event for null uri. Skipping.");
                return;
            }
            if (DEBUG) Log.d(TAG, "Updating roots due to change at " + uri);
            if (DEBUG) Log.i(TAG, "Updating roots due to change at " + uri);
            updateAuthorityAsync(uri.getAuthority());
        }
    }
@@ -195,7 +195,6 @@ public class RootsCache {
        final ContentResolver resolver = mContext.getContentResolver();
        synchronized (mLock) {
            for (String authority : mStoppedAuthorities) {
                if (DEBUG) Log.d(TAG, "Loading stopped authority " + authority);
                mRoots.putAll(authority, loadRootsForAuthority(resolver, authority, true));
            }
            mStoppedAuthorities.clear();
@@ -212,9 +211,7 @@ public class RootsCache {
            if (!mStoppedAuthorities.contains(authority)) {
                return;
            }
            if (DEBUG) {
                Log.d(TAG, "Loading stopped authority " + authority);
            }
            if (DEBUG) Log.d(TAG, "Loading stopped authority " + authority);
            mRoots.putAll(authority, loadRootsForAuthority(resolver, authority, true));
            mStoppedAuthorities.remove(authority);
        }
@@ -257,8 +254,8 @@ public class RootsCache {
            }

            final long delta = SystemClock.elapsedRealtime() - start;
            if (DEBUG)
                Log.d(TAG, "Update found " + mTaskRoots.size() + " roots in " + delta + "ms");
            if (DEBUG) Log.v(TAG,
                    "Update found " + mTaskRoots.size() + " roots in " + delta + "ms");
            synchronized (mLock) {
                mFirstLoadDone = true;
                if (mBootCompletedResult != null) {
@@ -277,7 +274,7 @@ public class RootsCache {
            // Ignore stopped packages for now; we might query them
            // later during UI interaction.
            if ((info.applicationInfo.flags & ApplicationInfo.FLAG_STOPPED) != 0) {
                if (DEBUG) Log.d(TAG, "Ignoring stopped authority " + info.authority);
                if (DEBUG) Log.v(TAG, "Ignoring stopped authority " + info.authority);
                mTaskStoppedAuthorities.add(info.authority);
                return;
            }
@@ -294,7 +291,7 @@ public class RootsCache {
     */
    private Collection<RootInfo> loadRootsForAuthority(ContentResolver resolver, String authority,
            boolean forceRefresh) {
        if (DEBUG) Log.d(TAG, "Loading roots for " + authority);
        if (DEBUG) Log.v(TAG, "Loading roots for " + authority);

        synchronized (mObservedAuthorities) {
            if (mObservedAuthorities.add(authority)) {
@@ -310,7 +307,7 @@ public class RootsCache {
            // long-lived system process.
            final Bundle systemCache = resolver.getCache(rootsUri);
            if (systemCache != null) {
                if (DEBUG) Log.d(TAG, "System cache hit for " + authority);
                if (DEBUG) Log.v(TAG, "System cache hit for " + authority);
                return systemCache.getParcelableArrayList(TAG);
            }
        }
@@ -457,49 +454,47 @@ public class RootsCache {
        final List<RootInfo> matching = new ArrayList<>();
        for (RootInfo root : roots) {

            if (DEBUG) Log.d(TAG, "Evaluating " + root);

            if (state.action == State.ACTION_CREATE && !root.supportsCreate()) {
                if (DEBUG) Log.d(TAG, "Excluding read-only root because: ACTION_CREATE.");
                if (DEBUG) Log.v(TAG, "Excluding read-only root because: ACTION_CREATE.");
                continue;
            }

            if (state.action == State.ACTION_PICK_COPY_DESTINATION
                    && !root.supportsCreate()) {
                if (DEBUG) Log.d(
                if (DEBUG) 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.d(
                if (DEBUG) Log.v(
                        TAG, "Excluding root !supportsChildren because: ACTION_OPEN_TREE.");
                continue;
            }

            if (!state.showAdvanced && root.isAdvanced()) {
                if (DEBUG) Log.d(TAG, "Excluding root because: unwanted advanced device.");
                if (DEBUG) Log.v(TAG, "Excluding root because: unwanted advanced device.");
                continue;
            }

            if (state.localOnly && !root.isLocalOnly()) {
                if (DEBUG) Log.d(TAG, "Excluding root because: unwanted non-local device.");
                if (DEBUG) Log.v(TAG, "Excluding root because: unwanted non-local device.");
                continue;
            }

            if (state.directoryCopy && root.isDownloads()) {
                if (DEBUG) Log.d(
                if (DEBUG) Log.v(
                        TAG, "Excluding downloads root because: unsupported directory copy.");
                continue;
            }

            if (state.action == State.ACTION_OPEN && root.isEmpty()) {
                if (DEBUG) Log.d(TAG, "Excluding empty root because: ACTION_OPEN.");
                if (DEBUG) Log.v(TAG, "Excluding empty root because: ACTION_OPEN.");
                continue;
            }

            if (state.action == State.ACTION_GET_CONTENT && root.isEmpty()) {
                if (DEBUG) Log.d(TAG, "Excluding empty root because: ACTION_GET_CONTENT.");
                if (DEBUG) Log.v(TAG, "Excluding empty root because: ACTION_GET_CONTENT.");
                continue;
            }

@@ -507,20 +502,21 @@ public class RootsCache {
                    MimePredicate.mimeMatches(root.derivedMimeTypes, state.acceptMimes) ||
                    MimePredicate.mimeMatches(state.acceptMimes, root.derivedMimeTypes);
            if (!overlap) {
                if (DEBUG) Log.d(
                if (DEBUG) Log.v(
                        TAG, "Excluding root because: unsupported content types > "
                        + state.acceptMimes);
                continue;
            }

            if (state.excludedAuthorities.contains(root.authority)) {
                if (DEBUG) Log.d(TAG, "Excluding root because: owned by calling package.");
                if (DEBUG) Log.v(TAG, "Excluding root because: owned by calling package.");
                continue;
            }

            if (DEBUG) Log.d(TAG, "Including " + root);
            matching.add(root);
        }

        if (DEBUG) Log.d(TAG, "Matched roots: " + matching);
        return matching;
    }
}
+7 −6
Original line number Diff line number Diff line
@@ -576,13 +576,12 @@ public class RootsFragment extends Fragment implements ItemDragListener.DragHost
        }

        @Override
        public void finish(DocumentInfo doc) {
        public void finish(@Nullable DocumentInfo doc) {
            if (doc != null) {
                DocumentClipper clipper =
                        DocumentsApplication.getDocumentClipper(mContext);
                DocumentClipper clipper = DocumentsApplication.getDocumentClipper(mContext);
                clipper.copyFromClipData(mDstRoot, doc, mData, mCallback);
            } else {
                Log.e(TAG, "Failed to get doc.");
                Log.e(TAG, "Failed to get drop target document (root): " + mDstRoot.getUri());
            }
        }
    }
@@ -613,10 +612,8 @@ public class RootsFragment extends Fragment implements ItemDragListener.DragHost
                                ((Activity) context).getIntent())) {
                    continue;
                } else if (root.isLibrary()) {
                    if (DEBUG) Log.d(TAG, "Adding " + root + " as library.");
                    libraries.add(item);
                } else {
                    if (DEBUG) Log.d(TAG, "Adding " + root + " as non-library.");
                    others.add(item);
                }
            }
@@ -625,11 +622,14 @@ public class RootsFragment extends Fragment implements ItemDragListener.DragHost
            Collections.sort(libraries, comp);
            Collections.sort(others, comp);

            if (DEBUG) Log.v(TAG, "Adding library roots: " + libraries);
            addAll(libraries);
            // Only add the spacer if it is actually separating something.
            if (!libraries.isEmpty() && !others.isEmpty()) {
                add(new SpacerItem());
            }

            if (DEBUG) Log.v(TAG, "Adding plain roots: " + libraries);
            addAll(others);

            // Include apps that can handle this intent too.
@@ -645,6 +645,7 @@ public class RootsFragment extends Fragment implements ItemDragListener.DragHost
         * special section at bottom).
         */
        private void includeHandlerApps(Context context, Intent handlerAppIntent) {
            if (DEBUG) Log.v(TAG, "Adding handler apps for intent: " + handlerAppIntent);
            final PackageManager pm = context.getPackageManager();
            final List<ResolveInfo> infos = pm.queryIntentActivities(
                    handlerAppIntent, PackageManager.MATCH_DEFAULT_ONLY);
+3 −3
Original line number Diff line number Diff line
@@ -1727,7 +1727,6 @@ public class DirectoryFragment extends Fragment

    @Override
    public Loader<DirectoryResult> onCreateLoader(int id, Bundle args) {
        if (DEBUG) Log.d(TAG, "Creating new loader for: " + DocumentInfo.debugString(mDocument));
        Context context = getActivity();
        State state = getDisplayState();

@@ -1741,9 +1740,10 @@ public class DirectoryFragment extends Fragment
                if (mTuner.managedModeEnabled()) {
                    contentsUri = DocumentsContract.setManageMode(contentsUri);
                }
                if (DEBUG) Log.d(TAG, "Creating new loader for: " + mDocument.derivedUri);
                if (DEBUG) Log.d(TAG, "Creating new directory loader for: "
                        + DocumentInfo.debugString(mDocument));
                return new DirectoryLoader(
                        context, mType, mRoot, mDocument, contentsUri, state.sortModel,
                        context, mRoot, mDocument, contentsUri, state.sortModel,
                        mSearchMode);
            case TYPE_RECENT_OPEN:
                if (DEBUG) Log.d(TAG, "Creating new loader recents.");
Loading