Search in sources :

Example 21 with RootInfo

use of com.android.documentsui.model.RootInfo in project android_frameworks_base by AOSPA.

the class RootsCache method getRootOneshot.

/**
     * Return the requested {@link RootInfo}, but only loading the roots for the
     * requested authority. This is useful when we want to load fast without
     * waiting for all the other roots to come back.
     */
public RootInfo getRootOneshot(String authority, String rootId) {
    synchronized (mLock) {
        RootInfo root = getRootLocked(authority, rootId);
        if (root == null) {
            mRoots.putAll(authority, loadRootsForAuthority(mContext.getContentResolver(), authority, false));
            root = getRootLocked(authority, rootId);
        }
        return root;
    }
}
Also used : RootInfo(com.android.documentsui.model.RootInfo)

Example 22 with RootInfo

use of com.android.documentsui.model.RootInfo in project android_frameworks_base by ResurrectionRemix.

the class BaseActivity method reloadSearch.

private void reloadSearch(String query) {
    FragmentManager fm = getFragmentManager();
    RootInfo root = getCurrentRoot();
    DocumentInfo cwd = getCurrentDirectory();
    DirectoryFragment.reloadSearch(fm, root, cwd, query);
}
Also used : FragmentManager(android.app.FragmentManager) RootInfo(com.android.documentsui.model.RootInfo) DocumentInfo(com.android.documentsui.model.DocumentInfo)

Example 23 with RootInfo

use of com.android.documentsui.model.RootInfo in project android_frameworks_base by ResurrectionRemix.

the class RootsCacheTest method testMatchingRoots_DirectoryCopy.

public void testMatchingRoots_DirectoryCopy() throws Exception {
    RootInfo downloads = buildForMimeTypes("*/*");
    downloads.authority = "com.android.providers.downloads.documents";
    mRoots.add(downloads);
    mState.acceptMimes = new String[] { "*/*" };
    mState.directoryCopy = true;
    // basically we're asserting that the results don't contain downloads
    assertContainsExactly(newArrayList(mNull, mWild, mImages, mAudio, mDocs, mMalformed1, mMalformed2), getMatchingRoots(mRoots, mState));
}
Also used : RootInfo(com.android.documentsui.model.RootInfo)

Example 24 with RootInfo

use of com.android.documentsui.model.RootInfo in project android_frameworks_base by ResurrectionRemix.

the class RootsCacheTest method testExcludedAuthorities.

public void testExcludedAuthorities() throws Exception {
    final List<RootInfo> roots = newArrayList();
    // Set up some roots
    for (int i = 0; i < 5; ++i) {
        RootInfo root = new RootInfo();
        root.authority = "authority" + i;
        roots.add(root);
    }
    // Make some allowed authorities
    List<RootInfo> allowedRoots = newArrayList(roots.get(0), roots.get(2), roots.get(4));
    // Set up the excluded authority list
    for (RootInfo root : roots) {
        if (!allowedRoots.contains(root)) {
            mState.excludedAuthorities.add(root.authority);
        }
    }
    mState.acceptMimes = new String[] { "*/*" };
    assertContainsExactly(allowedRoots, getMatchingRoots(roots, mState));
}
Also used : RootInfo(com.android.documentsui.model.RootInfo)

Example 25 with RootInfo

use of com.android.documentsui.model.RootInfo in project android_frameworks_base by ResurrectionRemix.

the class RootsCacheTest method buildForMimeTypes.

private static RootInfo buildForMimeTypes(String... mimeTypes) {
    final RootInfo root = new RootInfo();
    root.derivedMimeTypes = mimeTypes;
    return root;
}
Also used : RootInfo(com.android.documentsui.model.RootInfo)

Aggregations

RootInfo (com.android.documentsui.model.RootInfo)85 DocumentInfo (com.android.documentsui.model.DocumentInfo)20 FragmentManager (android.app.FragmentManager)15 Bundle (android.os.Bundle)15 ArrayList (java.util.ArrayList)15 Intent (android.content.Intent)10 Cursor (android.database.Cursor)10 ContentProviderClient (android.content.ContentProviderClient)5 Context (android.content.Context)5 Loader (android.content.Loader)5 MatrixCursor (android.database.MatrixCursor)5 MergeCursor (android.database.MergeCursor)5 Uri (android.net.Uri)5 VisibleForTesting (android.support.annotation.VisibleForTesting)5 MenuItem (android.view.MenuItem)5 DirectoryFragment (com.android.documentsui.dirlist.DirectoryFragment)5 IOException (java.io.IOException)5 Collection (java.util.Collection)5 CountDownLatch (java.util.concurrent.CountDownLatch)5 ExecutionException (java.util.concurrent.ExecutionException)5