History log of /frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
b7573e93cde7f229902dda7121dad931279a5ced 18-Aug-2016 Daichi Hirono <hirono@google.com> Set Root.FLAG_LOCAL_ONLY for MTP roots.

The flag indicate whether the root needs network access or not. MTP
should be LOCAL_ONLY root.

Bug: 30867267

Change-Id: Ia272d4a389cc1ca628d7b963caa37f3dbb6747e3
(cherry picked from commit 83c679e7221460fc50e91402a34787e1866d94ef)
/frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.java
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/tests/src/com/android/mtp/MtpDatabaseTest.java
b3383fdac0a6e1419541985f5880f632a0c6bfee 18-Mar-2016 Daichi Hirono <hirono@google.com> Add root flag correctly.

BUG=27369570

Change-Id: I93b9b662667009a374d879c7ab667b10fb7cbf7c
/frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.java
619afdaae1ec7dcbd71bb1f698a0901a1fa290fe 07-Feb-2016 Daichi Hirono <hirono@google.com> Check parent existance when adding/removing documents.

BUG=26212981
Change-Id: I8109e2324c027ec2182c6f521d57f3fe078a8660
(cherry picked from commit df803ec6ebd47ddc7f97ea8ef13aa359ecc7fb95)
/frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.java
9fca541ab8acb06bb390319251526fa9807b846f 07-Feb-2016 Daichi Hirono <hirono@google.com> Relax mapping rule to make the mapping logic simple.

MtpDocumentsProvider remembers the mapping between SAF's ID and MTP's
ID. Sometimes we need to do heuristic to restore the mapping when MTP
device is reconnected.

Previously we do the mapping files that shares the same name more
strictly. For example,

1. Found file name "test.txt". Assign document ID "1".
2. MTP device is disconnected and the MTP ID of "1" is lost.
3. Found two files that have same name "test.txt" in the same directory.

Previously we don't reuse existing document ID "1" for neither of two
"test.txt" because it's not 1-to-1 mapping and we cannot determine which
one should be mapped with existing document ID. It means we need the
complete list of files in a directory to remap IDs. It takes long time
to fetch all file names in a directory when a directory has 100+
files. It's rare that a MTP device has the two files sharing the same
name in the same directory. Also the strict rule makes the mapping code
more complex.

The CL relax the rule of mapping, and it allows to reuse existing
document ID even if it is not 1-to-1 mapping. For the previous example,
it assigns "1" for either of "test.txt".

BUG=27053734
Change-Id: I19406fafc21f13ab94ba99411ce5e7f55ce7f658
(cherry picked from commit acdbc6e740ffbd465488b6eb0cf9388d43ae860a)
/frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.java
148954a657941ea95ef17da5b3ce40b9145f8755 21-Jan-2016 Daichi Hirono <hirono@google.com> Add eventsSupported property to MtpDeviceInfo.

The property provides the set of event code that are supported by
MtpDevice.

BUG=26147375

Change-Id: I54be75e4bb52ddfe9aba8630538ddd32d1a641c8
/frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.java
1d4779c29a95114c89ec353a8899c0cc8eee3ba5 06-Jan-2016 Daichi Hirono <hirono@google.com> Add operationsSupported to device info.

Because not all MTP devices support getPartialObject, we need to check
supported operation of MTP devices. The CL adds operationsSupported
field to MtpDeviceInfo class.

BUG=26147375

Change-Id: Iaad968fb4497a5ad11bf6489097abea99c3cbac7
/frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.java
61e7c647f15ce34d10e1f2b907dfa9be43021fbb 15-Dec-2015 Daichi Hirono <hirono@google.com> Merge "Revert "Revert "Add device document to MtpDatabase."""
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/tests/src/com/android/mtp/MtpDatabaseTest.java
d0be161b89f8d657cfcfdc50943e7960535e39dc 15-Dec-2015 Daichi Hirono <hirono@google.com> Merge "Revert "Add device document to MtpDatabase.""
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/tests/src/com/android/mtp/MtpDatabaseTest.java
b702547e54a68eb9909b13a4f451718192c2ba8a 15-Dec-2015 Daichi Hirono <hirono@google.com> Merge "Add device document to MtpDatabase."
c0ae45be046b1aed005589791e1ee483c399ab1c 14-Dec-2015 Daichi Hirono <hirono@google.com> Add device document to MtpDatabase.

BUG=26175081

Change-Id: Ida91c50f7e33d7b300a32ee318b6f3837edf6606
/frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.java
9984ebd6d3b88866fbffff1b1a58b7690cb415ce 15-Dec-2015 Daichi Hirono <hirono@google.com> Use column name instead of index in MtpDatabaseTest for readability.

BUG=26194040

Change-Id: I58a6e59f4784fcc81988093bb113e721e36e46d0
/frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.java
39795da4c948536c4a9d9ceadece5b03fd395d89 02-Dec-2015 Daichi Hirono <hirono@google.com> Add storage icon for MTP roots.

BUG=22545807

Change-Id: I714b26d52e00b0f9a5c95dea1508be0d617482e3
/frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.java
9e8a4fa78f5b9e3964dca84ad4047210d35c4013 19-Nov-2015 Daichi Hirono <hirono@google.com> Change ID format of MtpDocumentsProvider.

BUG=25704562

Change-Id: I5d9fc167512eee06964650e07206e226173611b2
/frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.java
47eb192b2704e27272ca94a95680cac40b6bff3f 16-Nov-2015 Daichi Hirono <hirono@google.com> Start using MtpDatabase in DocumentLoader.

BUG=25704514

Change-Id: I4d9247c148679ee7e40a1a03443e4c0299b1e44d
/frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.java
dc47344660035b27a564ab6d9c9a9b58ec340347 13-Nov-2015 Daichi Hirono <hirono@google.com> Start to use MtpDatabase in RootScanner.

Change-Id: Id99cb61ad8680529b5ee502ca5bb2b3cdd143235
/frameworks/base/packages/MtpDocumentsProvider/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.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/tests/src/com/android/mtp/MtpDatabaseTest.java