DocumentsProvider: correctly handle non-default projections
This commit is contained in:
parent
c716a22df8
commit
d5a6ec1008
|
@ -118,7 +118,7 @@ public class CrossProfileDocumentsProvider extends DocumentsProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Cursor queryRoots(String[] projection) {
|
public Cursor queryRoots(String[] projection) {
|
||||||
final MatrixCursor result = new MatrixCursor(DEFAULT_ROOT_PROJECTION);
|
final MatrixCursor result = new MatrixCursor(projection == null ? DEFAULT_ROOT_PROJECTION : projection);
|
||||||
final MatrixCursor.RowBuilder row = result.newRow();
|
final MatrixCursor.RowBuilder row = result.newRow();
|
||||||
row.add(DocumentsContract.Root.COLUMN_ROOT_ID, DUMMY_ROOT);
|
row.add(DocumentsContract.Root.COLUMN_ROOT_ID, DUMMY_ROOT);
|
||||||
row.add(DocumentsContract.Root.COLUMN_DOCUMENT_ID, DUMMY_ROOT);
|
row.add(DocumentsContract.Root.COLUMN_DOCUMENT_ID, DUMMY_ROOT);
|
||||||
|
@ -136,7 +136,7 @@ public class CrossProfileDocumentsProvider extends DocumentsProvider {
|
||||||
@Override
|
@Override
|
||||||
public Cursor queryDocument(String documentId, String[] projection) {
|
public Cursor queryDocument(String documentId, String[] projection) {
|
||||||
ensureServiceBound();
|
ensureServiceBound();
|
||||||
final MatrixCursor result = new MatrixCursor(DEFAULT_DOCUMENT_PROJECTION);
|
final MatrixCursor result = new MatrixCursor(projection == null ? DEFAULT_DOCUMENT_PROJECTION : projection);
|
||||||
Map<String, Object> fileInfo = null;
|
Map<String, Object> fileInfo = null;
|
||||||
try {
|
try {
|
||||||
fileInfo = mService.loadFileMeta(documentId);
|
fileInfo = mService.loadFileMeta(documentId);
|
||||||
|
@ -156,7 +156,7 @@ public class CrossProfileDocumentsProvider extends DocumentsProvider {
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final MatrixCursor result = new MatrixCursor(DEFAULT_DOCUMENT_PROJECTION);
|
final MatrixCursor result = new MatrixCursor(projection == null ? DEFAULT_DOCUMENT_PROJECTION : projection);
|
||||||
// Allow receiving notification on create / delete
|
// Allow receiving notification on create / delete
|
||||||
result.setNotificationUri(getContext().getContentResolver(),
|
result.setNotificationUri(getContext().getContentResolver(),
|
||||||
DocumentsContract.buildDocumentUri(AUTHORITY, parentDocumentId));
|
DocumentsContract.buildDocumentUri(AUTHORITY, parentDocumentId));
|
||||||
|
|
Loading…
Reference in a new issue