ContentProvider is a singleton of the process. So it may live longer
than Service. We could not close database when the service is destroyed.
BUG=25730042
Change-Id: I591250c1a1e7c5705eb2585c71cac2598c0c0fb9
The CLs adds new table to MtpDatabase that contains additional
information to provide DocumentContract.Roots.COLUMN_*. Client code can
obtain these information by using the newly added queryRoots method.
BUG=25162822
Change-Id: Ib6596d38cbb4a42b689c75fffbd73585c0fb524c
The CL extracts common routines for root documents and child documents,
adds new methods for child documents, and let the common routines from
the new methods.
BUG=25162822
Change-Id: Ie6f0092e584ae12c89d43593701debeb76f6f3cb
MTP identifiers like object handle is unstable over MTP sessions. The
CL introduce two methods to MtpDatabase that enables the provider to
remap exisitng document ID with new MTP identifiers when the provider
reopen the MTP session.
* MtpDatabase#clearMtpIdentifier invalidates old MTP identifiers
* MtpDatabase#resolveRootDocuments remaps invalidated documents with
new MTP identifier.
BUG=25162822
Change-Id: Iadb668ae5932da81aba2b2731d0d185da5656f16
We have added device name to storage root by ag/790395.
But the change was not added to MtpDatabase class.
BUG=25162822
Change-Id: I019a9cf770a91c43b4e2f4e81e74b40175fd4872
If the remote MTP device is backed by typical file system, the file name
is unique among files in a directory. However, MTP protocol itself does
not guarantee the uniqueness of name so we cannot use fullpath as ID.
Instead of fullpath, we use artifical ID generated by MtpDatabase
itself. So we don't need to store fullpath in the database.
BUG=25162822
Change-Id: I06598ce631a3221ed72e11734dbdaefef4c6349c
The class stores document information and will be used to remap object
handle with document ID when the process resumes.
BUG=25162822
Change-Id: Ic1a2f60ae0ee90b6c2b77a89a578cef1e0e917f2
Start to use common MeidaFile helper class that can convert major format
code into mime type.
BUG=25096009
Change-Id: I8379cc6f11945c8e2215d36492367e73377fdc26
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
When testing a real MTP device, we cannot obtain test results by using the USB
port because the USB port is occupied by the MTP devcie. The CL adds an activity
to test package that shows test results.
BUG=23536467
Change-Id: I0e53c2de122cb3afd52f22bedd93ece53aaeb525
This patch does not yet allow to upload files, but uploading (creating)
directories already works.
Bug: 22545670
Change-Id: If4d5a53aa26f791475bb1a783e0ac9540d6760c1
The CL introduce DocumentLoader class that has a responsibility for loading
documents on background thread. When the provider is requested documents and the
result is not cached, it returns the cursor containing the first 10 items with
extra loading flag. Then it loads the rest of documents into cache on background
thread and notifies update regularly.
BUG=23067619
Change-Id: I7ac9d919bc3ffee1960ae3e8e7272a792a982ea8