Commit Graph

13 Commits

Author SHA1 Message Date
Daichi Hirono
f4e7fa8038 Use AppFuse to write document.
Previously MtpDocumentsProvider used pipes to transfer bytes from an
application to the provider when writing a document.  The problem was
application could not ensure that the last chunk of bytes was
successfully written to MTP device, since pipes had been already closed
when the provider transferred bytes to MTP device. Though the provider
encountered an error, the provider could not report the error to an
application.

The CL switches the method to transfer bytes from pipes to AppFuse. Now
application can flush() bytes on the file descriptor, and flush will not
complete until the provider completes writing bytes to MTP device.

Fixed: 23093747
Change-Id: I4e28f8cbf19d6c97e591943349a7535241d768f7
2016-03-29 16:27:59 +09:00
Daichi Hirono
64111e08d9 Get object size that is more than 4GB.
MtpObjectInfo contains object size as 32-bit integer and the provider
needs to invoke MtpDevice#getObjectSizeLong hidden API to get 64-bit
object size.

The CL switches to use MtpDevice#getObjectSizeLong hidden API if
MtpObjectInfo#getCompressedSize() returns 0xffffffffL, which means the
object size is more than 4GB.

BUG=27805369

Change-Id: I87ea02c09aa784246cf016def309d1f39ed20e90
2016-03-28 13:34:03 +09:00
Daichi Hirono
24ab92a5f7 Ensure to complete background thread of PipeManager.
BUG=27488803

Change-Id: Ib540ab42f6263e1aea4c1bb184a4f88aa1454a14
2016-03-04 17:53:03 +09:00
Daichi Hirono
61ba923ca0 Set document flag by referring MTP supported operations.
BUG=26147375

Change-Id: I6c4244f1f1153c1bbbf21ea9d608dc1a92ca70cd
2016-02-26 16:23:30 +09:00
Daichi Hirono
f578fa275a Update object info when writing a file.
The MTP spec does not offer a way to update bytes of exisitng files, so
our provider implementation creates a new file with new bytes and
removes old one.

Previously the new file uses new document ID and the exising document ID
is expired. Also the provider does not update the metadata
database. Thus users see the old flie in DocumentsUI but actually the
files is not accessible.

The CL updates the database with exisitng document ID, so that we can
access the new file with exisiting document ID.

BUG=26549400

Change-Id: I629b707a2e662b34625e8b28857ef818d8933996
2016-02-19 18:05:42 +09:00
Daichi Hirono
259ce80132 Extract mapping operations to partial class of MtpDatabase.
Change-Id: I5fda6d5754206528ad5953bcc179a0ffe0b4982d
2015-11-26 15:55:15 +09:00
Tomasz Mikolajewski
4c1d3dde05 Create PipeManager and DocumentLoader per device.
Also, reduce MtpManager's synchronization to per device synchronization.

Bug: 23733078
Change-Id: Ieedc7d871f2a4d260ca4287c6fa05d67f54fb4c5
2015-09-15 09:42:20 +09:00
Tomasz Mikolajewski
df544176b1 Fix uploading multiple files via MtpDocumentsProvider.
Uploading was breaking as SendObject request was not being sent directly
after SendObjectInfo which is assumed by the MTP stack in Android.

Change-Id: I36b94f56682e79dec38add9be5f70f55d07e22e7
2015-09-01 09:25:30 +09:00
Tomasz Mikolajewski
b80a3cfd05 Add support for uploading files via MTP.
Change-Id: Id1811ab70cb28be471e0a99999e9ad5380deac49
2015-08-28 10:50:23 +09:00
Daichi Hirono
2ff024f497 Start to use importFile to file descriptor.
BUG=22908937

Change-Id: Ia4f01099816e7841e364d46c125542d006cd47a6
2015-08-12 17:37:04 +09:00
Daichi Hirono
3faa43a4a6 Implement MtpDocumentsProvider#openDocumentThumbnail.
BUG=20274999
Change-Id: I4ee43d94d92735e07786dfe557eaca69e8bff6c3
2015-08-06 16:03:06 +09:00
Tomasz Mikolajewski
52652ac7a5 Make reading files streamed in MtpDocumentsProvider.
Change-Id: If5ca4fc71cf27a2eccb46865421235790623985a
2015-08-06 13:15:19 +09:00
Daichi Hirono
8ba419119d Implement MtpDocuments#openDocument.
BUG=20274999

Change-Id: Iebcee84cb47ac521412b15f91903922953cbd3a8
2015-08-05 15:21:57 +09:00