History log of /frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
64111e08d905525c7f4fe27e69953eb71bd62511 24-Mar-2016 Daichi Hirono <hirono@google.com> 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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
071313e8b55e1ac3349d4f405ffff37b2ae2feb0 18-Mar-2016 Daichi Hirono <hirono@google.com> Don't map root documents in DocumentLoader.

Root documents must be added by RootScanner.
Previously DocumentLoader unintentionally tries to load unmapped root
documents, which causes crash.

BUG=27731902

Change-Id: I8674473d80d6e7f758f6636d30148f5d2118bc25
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
b3383fdac0a6e1419541985f5880f632a0c6bfee 18-Mar-2016 Daichi Hirono <hirono@google.com> Add root flag correctly.

BUG=27369570

Change-Id: I93b9b662667009a374d879c7ab667b10fb7cbf7c
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
497b473b8a6c898b3c05aeb8d3b80c611d7e78b0 14-Mar-2016 Daichi Hirono <hirono@google.com> MtpDocumentsProvider returns mime type from file extension.

File extensions contain more information to determine mime type than MTP
format codes. The CL lets MtpDocumentsProvider return mime type from
file extensions if it's not inconsitent with format code.

BUG=27004954

Change-Id: I08a4a91235b1d3f48e77b70b28c8c5aedf8d601d
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
3bb37e7ff0a7b0a8086007633ad927fec59a6e94 29-Feb-2016 Daichi Hirono <hirono@google.com> Cleans up the metadata in MtpDatabase at the first launch after booting.

When rebooting a device, applicaitons lose temporary URI permissions so
we don't need to keep document ID that are not granted persistent URI
permissions.

1. Check Settings.Global.BOOT_COUNT to find out if it's first time to
launch MtpDocumentsProvider since booting.
2. If so, invokes clean up method of MtpDatabase.

BUG=26212981
Change-Id: Ic9a8ca7e7a9cac1ed91fdfb01e9dce14ce819243
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
61ba923ca0cb5c928a16729d0aa67b6bf4b2f027 25-Feb-2016 Daichi Hirono <hirono@google.com> Set document flag by referring MTP supported operations.

BUG=26147375

Change-Id: I6c4244f1f1153c1bbbf21ea9d608dc1a92ca70cd
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
0f32537e40ee2662d4f0b7b625ee280ca9c02066 21-Feb-2016 Daichi Hirono <hirono@google.com> Stops performing operations that does not supported by MTP device.

MTP devices can return supported operation list. The CL sets root flag
by referring it.

BUG=26147375

Change-Id: I02397821e208cf5a8fcf7457aa279d2818ce24c7
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
4e94b8deaa646f176bad9b80d5924ce64142743e 21-Feb-2016 Daichi Hirono <hirono@google.com> Resolve unmapped document when the device is connected.

Once MTP device is disconnected from Android, the files on MTP device
are marked as 'DISCONNECTED' in metadata database. These metadata will
be back when MtpDocumentsProvider finds the reconnected MTP device and
fetches the files again.

Previously the 'DISCONNECTED' files are not automatically
refetched. User needs to see files in Documents UI again to reuse
document ID of 'DISCONNECTED' files. The CL changes DocumentLoader so
that it automatically refetches disconnected documents.

BUG=26212981

Change-Id: I5cb2cc9c11af72632e481c59a505794f43ed62ea
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
f578fa275a535016f5322c88ad7a92e517d04a12 19-Feb-2016 Daichi Hirono <hirono@google.com> 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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
ebd24051599280443435606cab220de33b9356ad 06-Feb-2016 Daichi Hirono <hirono@google.com> Use device key to map device documents.

The CL introduces MAPPING_KEY column to the database and lets Mapper use
the column to map IDs of devices.

It also removes the concept of mapping mode from Mapper for
simplyfing. Now Mapper just tries to multiple mapping keys (MTP
identifier, display name, and mapping key) to find candidate of ID
mapping.

BUG=26212981

Change-Id: I19f6c7dac146047e9978de4eb33d5076406037ad
(cherry picked from commit 637a2010f4a0c0484b13c4cb87aa2858bdf079b2)
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
0abde68519f62d001aa075235c6da2e594ffc186 12-Feb-2016 Daichi Hirono <hirono@google.com> Merge "Add error message for locked device." into nyc-dev
2965776ba403ef1f6d9a0e870ebf3c44ee5d8373 11-Feb-2016 Daichi Hirono <hirono@google.com> Add error message for locked device.

If the remote MTP device is a smartphone, it does not provide files
until a user unlocks the device. The CL adds specific error message for
the situation.

BUG=26318917

Change-Id: Ic4c34609c55ec9c99b7b8a9143d6dae3835784e3
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
46d537716e00878073a740101f1e1e088f728817 12-Feb-2016 Daichi Hirono <hirono@google.com> Merge "Open the connected device in Files app when tapping notification." into nyc-dev
1e3744441a1e4ead0a3c752644bee930be020698 11-Feb-2016 Daichi Hirono <hirono@google.com> Open the connected device in Files app when tapping notification.

Previously when tapping the MTP devce notification, MtpDocumentsProvider
opens home direcotry in Files app. The CL adds data URI of connected
device to the intent so that MtpDocumentsProvider can open the connected
device's root in Files app.

BUG=26611224
Change-Id: I97ecd6669852cd2fc875294cbcbf5660fbfaa0da
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
ef2feefab704c07a7efd5fd3e6cbe83d0930b4f9 11-Feb-2016 Daichi Hirono <hirono@google.com> Returns "application/octet-stream" for unknown types of MTP files.

According to DocumentsContract mime type field is required.
MtpDocumentsProvider should returns mime type for unknown types of MTP
files as well.

BUG=27148801

Change-Id: I7e4b832f6c00f438cf90190c074f204fdedceef5
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
8e87364a67ada7ce92730182719f7820886c13bd 07-Feb-2016 Daichi Hirono <hirono@google.com> Keep metadata of documents as disconnected status after the device is
disconnected.

To restore Document IDs when the device is reconnected, we need to keep
the metadata in database so that we can use it as hint to remap document
ID with new MTP IDs.

BUG=26212981

Change-Id: Idcc93c41c09d082a709281022c56188dabc80515
(cherry picked from commit 53f5af3f2ba1328d301a0f8a4ae3f574ccc5da65)
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
6213cefbc06170f9463abf40c240322be11047bc 05-Feb-2016 Daichi Hirono <hirono@google.com> Fetch mime type from file name when format code does not help.

MTP spec defines format code as a file type of object, but we don't have
format code for some file types like PDF. This CL adds fallback that
tries to obtain mime type from file name in such case.

BUG=27004957

Change-Id: Id61352bf4726f4e044e57edadcefbf179fe3f882
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
f83ccbd7edd32e728785fb7aad44f11886e79645 04-Feb-2016 Daichi Hirono <hirono@google.com> Drop device name from storage document name.

When device has multiple storages, storage are shown as directory under
the device root. In this case, we would not like to add device name to
storage.

Note that we still use "device name + storage name" for root name if the
device has a single storage because we skip storage directory in this
case and shows storage's contents directly under the device.

BUG=26625708

Change-Id: Ie13b044e71ae9b5131c4a01ee9d605023d05f168
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
6a5ea7eae8a70bced97ceef051c965c27cb642ca 02-Feb-2016 Daichi Hirono <hirono@google.com> Move logic to skip single storage.

The tree structure of MTP model looks like /device/storage/objects. But
almost all MTP device has only single storage, so it's redundant to show
a single storage as a child of device in UI.

MtpDocumentsProvider has a special logic to skip single storage, and
shows storage's object as a children of device in such case. Previously
the logic was applied when MtpDocumentsProvider returned a root
list. The provider returns a storage as a Documents.Root, instead of
device if the device has only one storage.

However the number of root cannot be obtain for closed device. Thus the
previous logic did not work for closed devices that have a single
storage. The CL moves the logic from queryRoot to
queryChildDocuments. Now MtpDocumentsProvider always returns a device as
root, then it returns storage's objects as the device's children, where
we has already opened the device.

BUG=26481574

Change-Id: I25af0fc220410e321a378d67f226798ec4bba19c
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
83983d75cb075be201a53eaf01057931512e2917 29-Jan-2016 Daichi Hirono <hirono@google.com> Return NULL available bytes when the MTP device is closed.

Before MtpDocumentsProvider opens a device, it cannot fetch the storage
size. Currently it says 0 bytes available. But actually it is unknown.

BUG=26866812

Change-Id: I3f24773da8e76fe1092c11f1335aac9703f1b3f9
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
81d48536aef702d301cdc3a339008de767b51f99 16-Dec-2015 Daichi Hirono <hirono@google.com> Show MTP device as root when it has multiple/zero storages.

The CL updates MtpDocumentsProvider#queryRoots so that it fetches
devices from Database as well as storages when we don't have storages
under the device, or when we have multiple storages under the device.

BUG=26120019
Change-Id: Id2b140f00a1d49fa4da7e17d2564dbbaa1795e1e
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
20754c5a112e418c11cc88176283db2c4bf2efd6 15-Dec-2015 Daichi Hirono <hirono@google.com> Store device document even if the device is not opened.

BUG=26197156

Change-Id: I2a80bb3e85310cf63253173b1110a155ee1391ba
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
b3fe72bfb288a509a953e5586264ca1c4460d2df 15-Dec-2015 Daichi Hirono <hirono@google.com> Revert "Revert "Add device document to MtpDatabase.""

I suspected that the commit was conflicted with ag/833494, but actually it wasn't. Let me reland this CL again.

This reverts commit b63e8c6ccc1425d56f8b9c801f4bddf906d694e5.

Change-Id: I4e734422ce10ef93ee7c4ef3b8b72a81beaa769b
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
b63e8c6ccc1425d56f8b9c801f4bddf906d694e5 15-Dec-2015 Daichi Hirono <hirono@google.com> Revert "Add device document to MtpDatabase."

This reverts commit c0ae45be046b1aed005589791e1ee483c399ab1c.

Change-Id: I03337324e768c509bdcf94c89f7abe7ca00c8a18
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
c0ae45be046b1aed005589791e1ee483c399ab1c 14-Dec-2015 Daichi Hirono <hirono@google.com> Add device document to MtpDatabase.

BUG=26175081

Change-Id: Ida91c50f7e33d7b300a32ee318b6f3837edf6606
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
7d0b3cdd70fbba2145321c6104be9b149dc1411e 15-Dec-2015 Daichi Hirono <hirono@google.com> Merge "Stop reopening MTP devices."
be38848969c91ba9bc3ec8eee31017a34905acfc 14-Dec-2015 Daichi Hirono <hirono@google.com> Stop reopening MTP devices.

BUG=26175809

Change-Id: I45a51c0623b349f12e7d3cf787a89b089f230bc1
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
42a5e0e3a4ba13a3c15d74ea0b410ff8667fdfa4 15-Dec-2015 Daichi Hirono <hirono@google.com> Merge "Integerate mapping methods for root/child documents into the same methods."
7a375c407f2759f21fb4ca7215034f056b4ade1c 14-Dec-2015 Daichi Hirono <hirono@google.com> Integerate mapping methods for root/child documents into the same
methods.

The integrated methods will be used to add device documents as well as
root/child documents.

BUG=26175081

Change-Id: Ibf474cfbc41df402a2958e9efcdd0061f07f5ced
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
4b54e036ef958947d6347a0971d32c08774e3495 11-Dec-2015 Daichi Hirono <hirono@google.com> Add document type to MtpDatabase.

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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
ed2f8503303eb17edf332e880a2c603ed5744d81 02-Dec-2015 Daichi Hirono <hirono@google.com> Merge "Add storage icon for MTP roots."
39795da4c948536c4a9d9ceadece5b03fd395d89 02-Dec-2015 Daichi Hirono <hirono@google.com> Add storage icon for MTP roots.

BUG=22545807

Change-Id: I714b26d52e00b0f9a5c95dea1508be0d617482e3
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
e0282dd7d409dce7738173162e766ce9317ef804 26-Nov-2015 Daichi Hirono <hirono@google.com> Reopen MTP devices when the provider is created.

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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
259ce80132d55774fe599c60b53a9d9dfc1efa65 20-Nov-2015 Daichi Hirono <hirono@google.com> Extract mapping operations to partial class of MtpDatabase.

Change-Id: I5fda6d5754206528ad5953bcc179a0ffe0b4982d
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
9e8a4fa78f5b9e3964dca84ad4047210d35c4013 19-Nov-2015 Daichi Hirono <hirono@google.com> Change ID format of MtpDocumentsProvider.

BUG=25704562

Change-Id: I5d9fc167512eee06964650e07206e226173611b2
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
49f920fbde1dce6f789c2d0ad2df014c12e7e3ac 19-Nov-2015 Daichi Hirono <hirono@google.com> Add new methods to MtpDatabase.

* deleteDocument
* getParentId
* queryDocument
* putNewDocument

BUG=25756881

Change-Id: Ie223b37e04586b3e2b0448d09e14562fedbb652a
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
47eb192b2704e27272ca94a95680cac40b6bff3f 16-Nov-2015 Daichi Hirono <hirono@google.com> Start using MtpDatabase in DocumentLoader.

BUG=25704514

Change-Id: I4d9247c148679ee7e40a1a03443e4c0299b1e44d
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
4604b74603ea951c0f0d0fc2d9b6bd46ae54e245 11-Nov-2015 Daichi Hirono <hirono@google.com> Prepare for adding MtpDocumentsProvider tests to APCT.

BUG=25093356

Change-Id: I0c194e6bf3abeb632171e9be49471b9d94a0cb4c
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
dc47344660035b27a564ab6d9c9a9b58ec340347 13-Nov-2015 Daichi Hirono <hirono@google.com> Start to use MtpDatabase in RootScanner.

Change-Id: Id99cb61ad8680529b5ee502ca5bb2b3cdd143235
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
18d70d5b7c46d2a35f66a6a76ba319eacf62e6c6 13-Nov-2015 Daichi Hirono <hirono@google.com> Split MtpDatabase class into three classes.

BUG=25162822

Change-Id: Id64b6d9fa11a3214bb855ea8e1344af45fb415ff
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
cfcb0c007dea5f5798b7b4bd13b206ef12e8db6c 09-Nov-2015 Daichi Hirono <hirono@google.com> Adds new method to update existing documents in MtpDatabase.

BUG=25162822

Change-Id: I7aa63fc272aa7b57d6a9672565f842774e898a00
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
0378da48c42387b5e6d04a5d89e95a366873ad4a 05-Nov-2015 Daichi Hirono <hirono@google.com> Add root information to MtpDatabase.

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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
a8a3722e7ac80e68df532ee024ce97a07d4fe7c2 26-Oct-2015 Daichi Hirono <hirono@google.com> Extends MtpDatabase so that it can handle child documents.

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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
6de8a0e51f0cf8c52a4de672d4b2d8f2d78d143e 27-Oct-2015 Daichi Hirono <hirono@google.com> Implement ID mapping for root documents.

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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
59686f6c352fd70fec5ce8c7a2a867d6ecf15ff0 28-Oct-2015 Daichi Hirono <hirono@google.com> Update JavaDoc in MtpDatabase.

BUG=25162822

Change-Id: Icfd9391daa01846f5ec12d5ea7448ebc7444a05c
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
85a808bf96d57589bbce720a242e87f4610cc665 27-Oct-2015 Daichi Hirono <hirono@google.com> Let MtpDatabase add device name to storage root.

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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
88d2f781f0597129f5003d3768023c19cf6a3676 27-Oct-2015 Daichi Hirono <hirono@google.com> Remove fullpath from MtpDatabase.

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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java
9678f60633e19579736c3e59787326a8e82fae0f 21-Oct-2015 Daichi Hirono <hirono@google.com> Add MtpDatabase class.

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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabase.java