methods.
The integrated methods will be used to add device documents as well as
root/child documents.
BUG=26175081
Change-Id: Ibf474cfbc41df402a2958e9efcdd0061f07f5ced
Currently all document roots represent MTP storage, but we will not have
this assumption after starting show MTP devices (not storage) as
document roots.
To distinguish these two types of roots, the CL adds document type
column to the document table in MtpDatabase.
BUG=26120019
Change-Id: I6ee930008aea0b43c1c42b21a198b07eccbd443d
Previously it skips the device permission check by referring package
name. The CL removes the special case and use general MANAGE_USB
system-only permission to skip USB device permission dialog.
BUG=26048722
Change-Id: I3702393a50696209499d1e5f6549dab9fb2cefe4
MtpManagerTest uses real MTP device to test functionallity, but
previously it did not handle Android M's USB client behavior.
BUG=25939006
Change-Id: I53fa8c08c41c3adacf85f24694afdea5ec0781ca
When the provider is created, it reopens MTP devices that are recorded
in the database. It enables the provider to resume MTP session after the
provider process is killed by the system.
BUG=25704854
Change-Id: I58ae80fdb2e02cb0f045c63c4ade8943e2baae06
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