use of android.database.MatrixCursor in project android_frameworks_base by AOSPA.
the class TestDocumentsProvider method queryRoots.
@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
Log.d(TAG, "Someone asked for our roots!");
if (LAG)
lagUntilCanceled(null);
if (ROOTS_WEDGE)
wedgeUntilCanceled(null);
if (ROOTS_CRASH)
System.exit(12);
if (ROOTS_REFRESH) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
SystemClock.sleep(3000);
Log.d(TAG, "Notifying that something changed!!");
final Uri uri = DocumentsContract.buildRootsUri(mAuthority);
getContext().getContentResolver().notifyChange(uri, null, false);
return null;
}
}.execute();
}
final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
final RowBuilder row = result.newRow();
row.add(Root.COLUMN_ROOT_ID, MY_ROOT_ID);
row.add(Root.COLUMN_FLAGS, Root.FLAG_SUPPORTS_RECENTS | Root.FLAG_SUPPORTS_CREATE);
row.add(Root.COLUMN_TITLE, "_Test title which is really long");
row.add(Root.COLUMN_SUMMARY, SystemClock.elapsedRealtime() + " summary which is also super long text");
row.add(Root.COLUMN_DOCUMENT_ID, MY_DOC_ID);
row.add(Root.COLUMN_AVAILABLE_BYTES, 1024);
return result;
}
use of android.database.MatrixCursor in project android_frameworks_base by AOSPA.
the class TestDocumentsProvider method queryDocument.
@Override
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException {
if (LAG)
lagUntilCanceled(null);
if (DOCUMENT_CRASH)
System.exit(12);
final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
includeFile(result, documentId, 0);
return result;
}
use of android.database.MatrixCursor in project android_frameworks_base by AOSPA.
the class ExternalStorageProvider method queryDocument.
@Override
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException {
if (mArchiveHelper.isArchivedDocument(documentId)) {
return mArchiveHelper.queryDocument(documentId, projection);
}
final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
includeFile(result, documentId, null);
return result;
}
use of android.database.MatrixCursor in project android_frameworks_base by AOSPA.
the class ExternalStorageProvider method querySearchDocuments.
@Override
public Cursor querySearchDocuments(String rootId, String query, String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
query = query.toLowerCase();
final File parent;
synchronized (mRootsLock) {
parent = mRoots.get(rootId).path;
}
final LinkedList<File> pending = new LinkedList<File>();
pending.add(parent);
while (!pending.isEmpty() && result.getCount() < 24) {
final File file = pending.removeFirst();
if (file.isDirectory()) {
for (File child : file.listFiles()) {
pending.add(child);
}
}
if (file.getName().toLowerCase().contains(query)) {
includeFile(result, null, file);
}
}
return result;
}
use of android.database.MatrixCursor in project routerkeygenAndroid by routerkeygen.
the class LocalStorageProvider method queryDocument.
@Override
public Cursor queryDocument(final String documentId, final String[] projection) throws FileNotFoundException {
// Create a cursor with either the requested fields, or the default
// projection if "projection" is null.
final MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_DOCUMENT_PROJECTION);
includeFile(result, new File(documentId));
return result;
}
Aggregations