use of android.database.MatrixCursor.RowBuilder in project platform_frameworks_base by android.
the class BugreportStorageProvider method addFileRow.
private void addFileRow(MatrixCursor result, File file) {
String mimeType = getTypeForName(file.getName());
int flags = Document.FLAG_SUPPORTS_DELETE;
if (mArchiveHelper.isSupportedArchiveType(mimeType)) {
flags |= Document.FLAG_ARCHIVE;
}
final RowBuilder row = result.newRow();
row.add(Document.COLUMN_DOCUMENT_ID, getDocIdForFile(file));
row.add(Document.COLUMN_MIME_TYPE, mimeType);
row.add(Document.COLUMN_DISPLAY_NAME, file.getName());
row.add(Document.COLUMN_LAST_MODIFIED, file.lastModified());
row.add(Document.COLUMN_FLAGS, flags);
row.add(Document.COLUMN_SIZE, file.length());
}
use of android.database.MatrixCursor.RowBuilder in project platform_frameworks_base by android.
the class BugreportStorageProvider method queryRoots.
@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
final RowBuilder row = result.newRow();
row.add(Root.COLUMN_ROOT_ID, DOC_ID_ROOT);
row.add(Root.COLUMN_FLAGS, Root.FLAG_LOCAL_ONLY | Root.FLAG_ADVANCED);
row.add(Root.COLUMN_ICON, android.R.mipmap.sym_def_app_icon);
row.add(Root.COLUMN_TITLE, getContext().getString(R.string.bugreport_storage_title));
row.add(Root.COLUMN_DOCUMENT_ID, DOC_ID_ROOT);
return result;
}
use of android.database.MatrixCursor.RowBuilder in project platform_frameworks_base by android.
the class BugreportStorageProvider 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));
if (DOC_ID_ROOT.equals(documentId)) {
final RowBuilder row = result.newRow();
row.add(Document.COLUMN_DOCUMENT_ID, documentId);
row.add(Document.COLUMN_MIME_TYPE, Document.MIME_TYPE_DIR);
row.add(Document.COLUMN_DISPLAY_NAME, mRoot.getName());
row.add(Document.COLUMN_LAST_MODIFIED, mRoot.lastModified());
row.add(Document.COLUMN_FLAGS, Document.FLAG_DIR_PREFERS_LAST_MODIFIED);
} else {
addFileRow(result, getFileForDocId(documentId));
}
return result;
}
use of android.database.MatrixCursor.RowBuilder in project android_frameworks_base by DirtyUnicorns.
the class StubProvider method queryRoots.
@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_ROOT_PROJECTION);
for (Map.Entry<String, RootInfo> entry : mRoots.entrySet()) {
final String id = entry.getKey();
final RootInfo info = entry.getValue();
final RowBuilder row = result.newRow();
row.add(Root.COLUMN_ROOT_ID, id);
row.add(Root.COLUMN_FLAGS, info.flags);
row.add(Root.COLUMN_TITLE, id);
row.add(Root.COLUMN_DOCUMENT_ID, info.document.documentId);
row.add(Root.COLUMN_AVAILABLE_BYTES, info.getRemainingCapacity());
}
return result;
}
use of android.database.MatrixCursor.RowBuilder in project android_frameworks_base by AOSPA.
the class ExternalStorageProvider method queryRoots.
@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(resolveRootProjection(projection));
synchronized (mRootsLock) {
for (RootInfo root : mRoots.values()) {
final RowBuilder row = result.newRow();
row.add(Root.COLUMN_ROOT_ID, root.rootId);
row.add(Root.COLUMN_FLAGS, root.flags);
row.add(Root.COLUMN_TITLE, root.title);
row.add(Root.COLUMN_DOCUMENT_ID, root.docId);
row.add(Root.COLUMN_AVAILABLE_BYTES, root.reportAvailableBytes ? root.path.getFreeSpace() : -1);
}
}
return result;
}
Aggregations