History log of /frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDatabaseConstants.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/src/com/android/mtp/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.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/MtpDatabaseConstants.java