MCPcopy Create free account
hub / github.com/XCSoar/XCSoar / query

Method query

android/src/FileProvider.java:53–85  ·  view source on GitHub ↗
(Uri uri, String[] projection, String selection,
                      String[] selectionArgs, String sortOrder)

Source from the content-addressed store, hash-verified

51 }
52
53 @Override
54 public Cursor query(Uri uri, String[] projection, String selection,
55 String[] selectionArgs, String sortOrder) {
56 final File file = getFileForUri(uri);
57 if (file == null)
58 throw new IllegalArgumentException("File not found");
59
60 String displayName = uri.getQueryParameter(DISPLAYNAME_FIELD);
61
62 if (projection == null) {
63 projection = COLUMNS;
64 }
65
66 String[] cols = new String[projection.length];
67 Object[] values = new Object[projection.length];
68 int i = 0;
69 for (String col : projection) {
70 if (OpenableColumns.DISPLAY_NAME.equals(col)) {
71 cols[i] = OpenableColumns.DISPLAY_NAME;
72 values[i++] = (displayName == null) ? file.getName() : displayName;
73 } else if (OpenableColumns.SIZE.equals(col)) {
74 cols[i] = OpenableColumns.SIZE;
75 values[i++] = file.length();
76 }
77 }
78
79 cols = copyOf(cols, i);
80 values = copyOf(values, i);
81
82 final MatrixCursor cursor = new MatrixCursor(cols, 1);
83 cursor.addRow(values);
84 return cursor;
85 }
86
87 @Override
88 public String getType(Uri uri) {

Callers 3

enumerateMethod · 0.80
findUriMethod · 0.80
checkCompleteMethod · 0.80

Calls 3

getFileForUriMethod · 0.95
copyOfMethod · 0.95
equalsMethod · 0.80

Tested by

no test coverage detected