Home | History | Annotate | Download | only in providers

Lines Matching refs:attachment

56  * of the regular attachment provider.
58 * One major difference is that all attachment info is stored in memory (with the
59 * exception of the attachment raw data which is stored in the cache). When
70 private static final int ATTACHMENT = 1;
86 * Map that contains a mapping from an attachment list uri to a list of uris.
91 * Map that contains a mapping from an attachment uri to an {@link Attachment} object.
93 private Map<Uri, Attachment> mUriAttachmentMap;
105 sUriMatcher.addURI(authority, "attachment/*/*/#", ATTACHMENT);
137 case ATTACHMENT: {
143 // form the attachment lists uri by clipping off the cid from the given uri
151 // find the attachment that contains the given cid
153 final Attachment attachment = mUriAttachmentMap.get(attachmentsUri);
154 if (TextUtils.equals(cid, attachment.partId)) {
155 addRow(cursor, attachment);
174 case ATTACHMENT:
185 // add mapping from uri to attachment
186 if (mUriAttachmentMap.put(uri, new Attachment(values)) == null) {
188 // get list of attachment uris, creating if necessary
226 case ATTACHMENT:
234 * Adds a row to the cursor for the attachment at the specific attachment {@link Uri}
235 * if the attachment's mime type matches one of the query parameters.
242 final Attachment attachment = mUriAttachmentMap.get(uri);
246 if (attachment.getContentType().startsWith(type)) {
247 addRow(cursor, attachment);
252 addRow(cursor, attachment);
257 * Adds a new row to the cursor for the specific attachment.
259 private static void addRow(MatrixCursor cursor, Attachment attachment) {
261 .add(attachment.getName()) // displayName
262 .add(attachment.size) // size
263 .add(attachment.uri) // uri
264 .add(attachment.getContentType()) // contentType
265 .add(attachment.state) // state
266 .add(attachment.destination) // destination
267 .add(attachment.downloadedSize) // downloadedSize
268 .add(attachment.contentUri) // contentUri
269 .add(attachment.thumbnailUri) // thumbnailUri
270 .add(attachment.previewIntentUri) // previewIntentUri
271 .add(attachment.providerData) // providerData
272 .add(attachment.supportsDownloadAgain() ? 1 : 0) // supportsDownloadAgain
273 .add(attachment.type) // type
274 .add(attachment.flags) // flags
275 .add(attachment.partId); // partId (same as RFC822 cid)
279 * Copies an attachment at the specified {@link Uri}
296 final Attachment attachment = mUriAttachmentMap.get(uri);
302 if (!saveToSd || attachment.isSavedToExternal()) {
312 attachment.destination = UIProvider.AttachmentDestination.EXTERNAL;
345 throw new IOException("Timed out copying attachment.");
349 // if the attachment is an APK, change contentUri to be a direct file uri
350 if (MimeType.isInstallable(attachment.getContentType())) {
351 attachment.contentUri = Uri.parse("file://" + newFilePath);
358 final String description = attachment.getName();
359 mDownloadManager.addCompletedDownload(attachment.getName(),
360 description, true, attachment.getContentType(),
420 * Returns an attachment list uri for the specific attachment
432 * Returns an attachment list uri for an eml file at the given uri with the given message id.
443 * Returns an attachment uri for an eml file at the given uri with the given message id.
455 * Returns an attachment uri for an attachment from the given eml file uri with
460 .appendPath("attachment")
468 * Returns the absolute file path for the attachment at the given uri.
471 final Attachment attachment = mUriAttachmentMap.get(uri);
473 attachment.destination == UIProvider.AttachmentDestination.EXTERNAL;
478 // we want the root of the downloads directory if the attachment is
486 return directoryPath + "/" + attachment.getName();
497 * Returns the cache directory for eml attachment files.