History log of /frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
0f6ab57eef3dcacfc099598dde5390dabc2e6a55 23-Mar-2017 Daichi Hirono <hirono@google.com> Fix doc flag for device having multiple storages

Previously MtpDocumentsProvider#queryDocument returned
FLAG_DIR_SUPPORTS_CREATE for device having multiple storages.

This was wrong because if the device has multiple storages,
MtpDocumentsProvider places the storages under the device document, thus
users cannot create a document just under the device document.

Bug: 35700994
Test: MtpDocumentsProviderTests
Change-Id: Id73a34a2eaf4e10e23be3c2da7488036cea10000
(cherry picked from commit 66fcb4beae9605cd034c9437e510b21260d6f519)
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
98f48479e95b04479b5512c587da6bc9fbd73b7e 02-Apr-2017 Daichi Hirono <hirono@google.com> Use Context#startForegroundService in MTP provider

NotificationManager.startServiceInForeground() was moved to
Context#startForegroundService. MtpDocumentsProvider should use new one.

Bug: 36794559
Test: MtpDocumentsProviderTests
Change-Id: I84723ee8c3f0f8bfe4d5ea8ad035c01c42ce8bab
(cherry picked from commit 203be491ef479deea1f39f8b63f3e1916501a37a)
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
b690b4de06385a821aed3442e10058986c03badc 02-Mar-2017 Garfield Tan <xutan@google.com> Address comments from API council.

Test: Code builds and tests pass. Also some manual tests around ESP.
Bug: 35813037
Bug: 35812990
Change-Id: Ia9d3a3964e9a83d0c1c08e5db4c2e231504aa99a
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
d3c6dd1522dc9b08476b70c4f6923f4debff78ee 26-Jan-2017 Daichi Hirono <hirono@google.com> Start MtpDocumentsService as foreground service.

Prevously MtpDocumentsService was started as background service, then it
turns into a foreground service by calling Service#startForeground.

The workflow did not work until this, because now background activity
cannot launch a background service.

The CL starts using NotificationManager#startForegroundService to launch
MtpDocumentsService so that the service can be started as foreground
service directly.

Bug: 34468813
Test: MtpDocumentsProviderTests
Test: manual testing with connecting MTP device to Android
Change-Id: Ic35d3e92f234881846e5d82ed04d6681a83035f7
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
e80ea38489a7fca0e5a8cf2f663704058c782d63 15-Nov-2016 Daichi Hirono <hirono@google.com> Use public version of AppFuse in MtpDocumentsProvider.

AppFuse is now a public API. The CL removes the private version from
MtpDocuemntsProvider package and switches to the public version.

Bug: 32891253
Test: MtpDocumentsProviderTest
Change-Id: Ibdf67309bc0678e2f70ac2dddb920125d9e0760e
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
29de7693f4fab188e695b9ecda1de0345496bd10 07-Nov-2016 Daichi Hirono <hirono@google.com> Add isChildDocument to MtpDocumentsProvider.

Bug: 32687127
Test: adb shell am instrument -w -e class com.android.mtp.MtpDocumentsProviderTest#testIsChildDocument com.android.mtp.tests/com.android.mtp.TestResultInstrumentation
Change-Id: I44ded3c73443735229a8b3465122f7e10c4da178
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
2cf7c483a8049e2c657d5f4c138132167fa71ae9 07-Nov-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Not create document under the device."
35b2ec551f670562a779925fe152307f20ad67cd 02-Nov-2016 Daichi Hirono <hirono@google.com> Not create document under the device.

The structure of files in MtpDocumentsProvider looks like
/device/storage/files. But MtpDocumentsProvider shows files
just under the device if the device has only single storage.

It causes a problem that MtpDocumentsProvider tries to create a file
under the device. Previously it tries to create a file with storageId =
0, which means MTP device choose a storage to store the file.

Because it only happens when the device has a single storage, the file
is properly written to the device. But the database in
MtpDocumentsProvider goes into the illegal state where the file is
placed just under the device.

Bug: 32561572
Test: adb shell am instrument -w -e class com.android.mtp.MtpDocumentsProviderTest com.android.mtp.tests/com.android.mtp.TestResultInstrumentation
Change-Id: I47a373ceee8a64ba9995934317693e79d2497ee0
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
f46a463e414a9c79db49a272c79320d688494842 03-Nov-2016 Garfield Tan <xutan@google.com> Change findPath() to findDocumentPath() in MtpDocumentsProvider.

Test: It builds.
Change-Id: If474e766b5680d49a7557f0e7ee1c039eb4efae0
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
b9ffa2a1d2cfd0b182629c849a22f2efa832892e 01-Nov-2016 Daichi Hirono <hirono@google.com> Add findPath method to MtpDocumentsProvider.

Bug: 32515515
Test: adb shell am instrument -w -e class com.android.mtp.MtpDocumentsProviderTest com.android.mtp.tests/com.android.mtp.TestResultInstrumentation
Change-Id: Ib87e8f5258de8fd48a099adbf077b3b9ff85773c
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
76be46f4d9314fd7daca0985a0a7e02126d85975 08-Apr-2016 Daichi Hirono <hirono@google.com> Fix crash when deleting multiple files.

When deleting files, MtpDocumentsProvider clears LoadingTask in
DocumentsLoader to update directory contents list. Previously it can
clear ongoing task, and it skips calling Mapper#stopAddingDocuments.
Since Mapper#startAddingDocuments and Mapper#stopAddingDocuments must be
called 1 to 1, it causes precondition check failure at the next call of
Mapper#startAddingDocuments.

Change-Id: I23e2b117da826297e45404be4db4cc29f96e5510
Fix: 28076320
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
f4e7fa80384ac72d0228ca5de6e949a9162cefbf 28-Mar-2016 Daichi Hirono <hirono@google.com> Use AppFuse to write document.

Previously MtpDocumentsProvider used pipes to transfer bytes from an
application to the provider when writing a document. The problem was
application could not ensure that the last chunk of bytes was
successfully written to MTP device, since pipes had been already closed
when the provider transferred bytes to MTP device. Though the provider
encountered an error, the provider could not report the error to an
application.

The CL switches the method to transfer bytes from pipes to AppFuse. Now
application can flush() bytes on the file descriptor, and flush will not
complete until the provider completes writing bytes to MTP device.

Fixed: 23093747
Change-Id: I4e28f8cbf19d6c97e591943349a7535241d768f7
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
77a1c65610618891ba28d7a10e4f107ea27e392e 28-Mar-2016 Daichi Hirono <hirono@google.com> Open 4G+ file by using AppFuse.

To open files by using AppFuse, the provider needs to know the size of
file. Previously we cannot open 4G+ files because we cannot obtain file
size for such large files.

Now MtpDatabase contains correct size for 4GB+ file size. The CL starts
opening files by using AppFuse which obtains partial bytes by using
getObjectPartial64 operation.

FIXED=26840097

Change-Id: I1cb41972175c2b98f4aa76981decc6b3ad35486d
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
1c431625b38480a146ae2bbaf118753e912061a8 28-Mar-2016 Daichi Hirono <hirono@google.com> Merge "Get object size that is more than 4GB." into nyc-dev
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/MtpDocumentsProvider.java
09ece6c68bdaf3a04b517f04dff6a3272b54b2b2 20-Jan-2016 Daichi Hirono <hirono@google.com> Implement FUSE_WRITE command in app fuse.

The CL adds a handler for FUSE_WRITE command which invokes a Java
handler.

BUG=23093747

Change-Id: I1903fca6b5663e6241ad540a89fe812310ba6810
(cherry picked from commit 35693da25af11583053d4af6a70d4acbf446978d)
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
4f04fd358d84f7ea8a9a26bf4c2ef4bef553c732 18-Mar-2016 Daichi Hirono <hirono@google.com> Fix the logic to add suffix when copying.

Previously the logic add '.' even if the extension is empty.

BUG=27729309

Change-Id: I3fa4b09fea977b5c716ec5cbbbc7d9f4ab96db08
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
1360868de8a2eb724bd82bc30858c2e345c83482 17-Mar-2016 Daichi Hirono <hirono@google.com> Merge "Add suffix number when copying a file." into nyc-dev
fc7fb7533f46b53247d1e6e6edca6e6c9ac676fe 15-Mar-2016 Daichi Hirono <hirono@google.com> Add suffix number when copying a file.

If we have an existing file in the destination directory, which has the
same name with the source file, adding suffix number is
DocumentsProvider's responsibility.

Because MTP does not provide a way to check existance of files with
given name, the logic is implemented as try-and error strategy. The CL
lets If we MtpDocumentsProvider assume we have a file that shares the
same name with the source file if it failed to invoke
MtpDevice#sendObjectInfo. In this case MtpDocumentsProvider retry to
invoke sendObjectInfo with new name with suffix number.

BUG=26991190

Change-Id: I223ac5031f079bc91eb27709b0356f621a1ed55b
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
43272832408353e3ff0273ffec5b82a27bb17196 16-Mar-2016 Daichi Hirono <hirono@google.com> Merge "Handle SQLite disk IO error in MtpDocumentsProvider#onCreate." into nyc-dev
5884e1fa87e5116cc7d4ba0935cff3f62ad8de4c 16-Mar-2016 Daichi Hirono <hirono@google.com> Handle SQLite disk IO error in MtpDocumentsProvider#onCreate.

The error should be regarded as an expected error that failes onCreate,
rather than crash.

BUG=27244513

Change-Id: Icf5164b0cba6cb919077539afe7701ada1e0c247
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
acb0e27bb33e373f1c42d6e2ef9344169cae96f0 14-Mar-2016 Daichi Hirono <hirono@google.com> Regard timeout as an error in the MtpDocumentsProvider test.

Previously if DocumentsProvider found timeout when terminatnig
RootScanner's background thread, it just output it in error log. Thus
the timeout is not regarded as an error in MtpDocumentsProviderTest, and
it makes flaky PipeManagerTest which runs just after
MtpDocumentsProviderTest.

The CL

* lets MtpDocumentsProvider throw TimeoutException for timeout.
* removes redundant resumeRootScanner calls to avoid timeout of
RootScanner#pause.

Also the CL did cleanup the logic that pauses RootScanner when we don't
find any devices. Previously the logic was in
MtpDocumentsProvider#closeInternal but it is not efficient because we
invokes RootScanner#resume just after
MtpDocumentsProvider#closeInternal. Now the CL moves the logic to
RootScanner so that it can pause itself automatically.

BUG=27638500

Change-Id: Ic11bca67c099cbb0f46679db2f035988045d67d6
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.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/MtpDocumentsProvider.java
24ab92a5f7492f116ae82f354f406de60a0d912c 04-Mar-2016 Daichi Hirono <hirono@google.com> Ensure to complete background thread of PipeManager.

BUG=27488803

Change-Id: Ib540ab42f6263e1aea4c1bb184a4f88aa1454a14
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
e5b499bcc52a334b49d939867bbe85f77541fbeb 01-Mar-2016 Daichi Hirono <hirono@google.com> Merge "Fix RootScanner to execute scan at least once before cancelling it." into nyc-dev
2e9a57b0d4839b322787dad36bfcb64f211f7ac4 26-Feb-2016 Daichi Hirono <hirono@google.com> Fix RootScanner to execute scan at least once before cancelling it.

Previously RootScanner is implemented by FutureTask, and if it is
cancelled before it starts running in background thread, the scan will
be never executed.

The CL stops using FutureTask and introduces CountDownLatch to control
UpdateRootsRunnable.

BUG=27369585

Change-Id: Ica8799faba0a8e5ca91a6b8be36dc4f5118d6333
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.java
c18f8076ebdb2cda8842cfda2583897aa2c388e1 10-Feb-2016 Daichi Hirono <hirono@google.com> Show specific error message for busy device.

When MTP device is busy (e.g. used by other application),
MtpDocumentsProvider cannot open the device. The CL introduces specific
error message for the case.

BUG=26694828

Change-Id: Iffee2e1c554e4089601186469ff0eac2fd04decd
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.java
19aa93249edc5dac01025456ce3bb1881f1b11d1 04-Feb-2016 Daichi Hirono <hirono@google.com> Fix Identifier.equals method.

Previously the string was compared by ==.

BUG=26970351

Change-Id: If88b74392955388c9bf59002f2d2a186c2dff71a
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
fda7474c5faae1e36a9274d8a5fe83e42ec6503b 01-Feb-2016 Daichi Hirono <hirono@google.com> Open MTP device on demand.

Previously MtpDocumentsProvider opens a device just after device is
connected to Android. But MtpDocumentsProvider should open MTP device on
demand so that other applications can open device if user starts to use
the application before using MtpDocumentsProvider.

BUG=26625708

Change-Id: I6083b8c7cef49ee6e9fb0d15ca4adc129734f3eb
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.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/MtpDocumentsProvider.java
2f310f6d5d352817f42384394b50a660ad6e0bf8 26-Jan-2016 Daichi Hirono <hirono@google.com> Reuse buffer when reading bytes from files.

Previously AppFuse getObjectBytes returns byte array and the array's
length needs to equals to the exact number of bytes the method read.

The CL change the function signature so that it can return the number of
read bytes. And reuse a buffer array instead of slicing the array with
valid length.

BUG=None

Change-Id: I78b714554cac9ae71b895cb8929bc98969f5a8ca
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
b36b15586a5d3d0de590773ce4392fa3a82af66a 25-Jan-2016 Daichi Hirono <hirono@google.com> Fix bugs that prevent from using AppFuse.

* Allow buffer size that is greater than requested read size in JNI,
because we reuse fixed-size buffer among multiple requests.
* Fix condition to check if the file size is greater than 4GB or
not. We need to use 0xffffffffl instead of 0xffffffff because
0xffffffff is int and its value is -1.

BUG=None
Change-Id: I155916e139353b15dc1ab535234faf50d942996d
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
e6054c0ff07005c73bd10a362f039933dc00f8bd 20-Jan-2016 Daichi Hirono <hirono@google.com> Fix race in AppFuseTest.

Previously IllegalStateException is thrown in app fuse main loop, if the
loop thread starts just after closing device FD.

BUG=None

Change-Id: Ia5232857d29f9f324446aa38acf3c062f359d406
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
f52ef008c76566f7118a80bf28f599ba48d7c578 11-Jan-2016 Daichi Hirono <hirono@google.com> Start to use app fuse in MtpDocumentsProvider.

BUG=25756419

Change-Id: I050e7cf7523926710291875737602e95c47be088
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
8e3b9db5448ff3c00e8670ba80105b9304cd7cb0 25-Dec-2015 Daichi Hirono <hirono@google.com> Stop to remove device rows at MtpDocumentsProvider.

Previously MtpDocumentsProvider used to remove device info in the
database when the device is closed. It loses a chance that RootScanner
handles the removal of roots. As a result, notifications for root cursor
does not issued.

The CL stops removing device info at MtpDocumentsProvider, and let
RootScanner remove it.

BUG=26321346

Change-Id: I6aec0cf843a1e5c93e7f67a718cabd26841d9799
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.java
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/MtpDocumentsProvider.java
a57d9ed09003acd8b2beb0494a2bd32f7030cc11 07-Dec-2015 Daichi Hirono <hirono@google.com> Turn MtpDocumentsService foreground when devices are opend.

BUG=26047393

Change-Id: I70f69c5ddec500ed61d1a76fb9e2e296813b2a4e
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.java
e1d57710fb38dae2747aadca0e5b6f98a84a0514 17-Nov-2015 Daichi Hirono <hirono@google.com> Don't close database when all devices have been detached.

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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.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/MtpDocumentsProvider.java
d391813b7076d7bb0fb67a9c946c98de55d9bf20 22-Oct-2015 Daichi Hirono <hirono@google.com> Merge "Support major format code in MtpDocumentsProvider."
3359d45545b9895533cc74e5378b07546659ad64 20-Oct-2015 Daichi Hirono <hirono@google.com> Support major format code in MtpDocumentsProvider.

Start to use common MeidaFile helper class that can convert major format
code into mime type.

BUG=25096009

Change-Id: I8379cc6f11945c8e2215d36492367e73377fdc26
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
17c8d8bcdae4b31d295431fc089db81bf3721c54 12-Oct-2015 Daichi Hirono <hirono@google.com> Add device model name to MtpDocumentsProvider's roots.

BUG=24813180

Change-Id: I548c553978357dd9619cf66622ec9c0f61886f33
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
4c1d3dde05308cb10187269dd9824c9bfdbb27de 02-Sep-2015 Tomasz Mikolajewski <mtomasz@google.com> Create PipeManager and DocumentLoader per device.

Also, reduce MtpManager's synchronization to per device synchronization.

Bug: 23733078
Change-Id: Ieedc7d871f2a4d260ca4287c6fa05d67f54fb4c5
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
81d74743107b372424fb8f7439357bdd608f8caf 01-Sep-2015 Tomasz Mikolajewski <mtomasz@google.com> Refresh directory changes on Mtp when a child is deleted or created.

Change-Id: I0325c60ac142368c2e61fcf9efa751f678f3f3a3
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
df544176b10f536969de1ed143b0ba57123fcb93 31-Aug-2015 Tomasz Mikolajewski <mtomasz@google.com> Fix uploading multiple files via MtpDocumentsProvider.

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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
bb430fa930fa0d0700e46e7b4881de2a252223dd 25-Aug-2015 Tomasz Mikolajewski <mtomasz@google.com> Remove MtpDocument.

Change-Id: Ie4b0e55f6ff2c7b323cf767a5ed3d3c61c12734d
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
b80a3cfd05fc7492dd59b7f8d4337eb5e29088c2 24-Aug-2015 Tomasz Mikolajewski <mtomasz@google.com> Add support for uploading files via MTP.

Change-Id: Id1811ab70cb28be471e0a99999e9ad5380deac49
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
7f2aba0fb9b0c9848af7756fe94a2d15918ce544 21-Aug-2015 Tomasz Mikolajewski <mtomasz@google.com> Merge "Wire uploading to MtpDocumentsProvider."
87763e6a91a54e7995cfda9b7e80162f02ac4cbc 10-Aug-2015 Tomasz Mikolajewski <mtomasz@google.com> Wire uploading to MtpDocumentsProvider.

This patch does not yet allow to upload files, but uploading (creating)
directories already works.

Bug: 22545670
Change-Id: If4d5a53aa26f791475bb1a783e0ac9540d6760c1
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
743d554a07209969ab6b746b5ebd76881ebd99a3 18-Aug-2015 Steve McKay <smckay@google.com> Merge "Add comment to argument in MtpDocumentsProvider#openDocumentThumbnail."
8b9024f0c20b1b79df1f2d0bc2f1a82f726b1176 11-Aug-2015 Daichi Hirono <hirono@google.com> Add RootScanner to MtpDocumentsProvider to handle new/removed MTP storages.

BUG=23169303
Change-Id: I5a73da7f869fed2fcf69e6ab7b039d1a60b883e2
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
6baa16e9109046661fef8dcc25b8754ac68bcdae 12-Aug-2015 Daichi Hirono <hirono@google.com> Let MTPDocumentsProvider load documents in background thread.

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
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
573c1fbc5f98f033681e378ec965136bce49c899 11-Aug-2015 Daichi Hirono <hirono@google.com> Add comment to argument in MtpDocumentsProvider#openDocumentThumbnail.

BUG=20274999

Change-Id: Ibfda61812c0c26f923f939836f483f26b964be0e
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
124d060bc980c7555616ff9d07a4dc3b8f3cd341 11-Aug-2015 Daichi Hirono <hirono@google.com> Implement MtpDocumentsProvider#queryChildDocuemnts.

BUG=20274999

Change-Id: Ib18e0f36aa97add1c4b603fe11e9adedfef157ec
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
3faa43a4a6f270e2e1e2ec55b77508084af16757 05-Aug-2015 Daichi Hirono <hirono@google.com> Implement MtpDocumentsProvider#openDocumentThumbnail.

BUG=20274999
Change-Id: I4ee43d94d92735e07786dfe557eaca69e8bff6c3
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
52652ac7a5f479f7f5e24f78778203bd88c0c4f4 05-Aug-2015 Tomasz Mikolajewski <mtomasz@google.com> Make reading files streamed in MtpDocumentsProvider.

Change-Id: If5ca4fc71cf27a2eccb46865421235790623985a
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
5fecc6cf032bbbc2616dd2342a50656bf2857832 04-Aug-2015 Daichi Hirono <hirono@google.com> Implement MtpDocumentsProvider#deleteDocument.

BUG=20274999

Change-Id: I6d07280ddbb0809d3c1334aec5fcbc0c67c4c2aa
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
8ba419119d50a031160cab54bef6899bd0051ea9 30-Jul-2015 Daichi Hirono <hirono@google.com> Implement MtpDocuments#openDocument.

BUG=20274999

Change-Id: Iebcee84cb47ac521412b15f91903922953cbd3a8
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
e5323b7493f2bc1537d7e6b2d4595d69fd01d72e 29-Jul-2015 Daichi Hirono <hirono@google.com> Implement MtpDocumentsProvider#queryDocument.

BUG=20274999

Change-Id: Id5c81f744ea1e28d0a0d352b52db1c33fd5edcc2
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
50d17aa871d9ca645a8e7af64df8866b85aee245 28-Jul-2015 Daichi Hirono <hirono@google.com> Implement queryRoot method of MtpDocumentsProvider.

BUG=20274999

Change-Id: I27aa8bffe47eab6ea1f4195023dbacb6e2f76548
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
2efe4cac49efd87c5f14f48051a5556f437cedc9 27-Jul-2015 Daichi Hirono <hirono@google.com> Add MtpDocumentsService.

BUG=20274999

Change-Id: I1d60ebcf100767136ac7f78e619021776c6be02f
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
d5152429e11d3a831a7993dc67ddf69f69bd3912 15-Jul-2015 Daichi Hirono <hirono@google.com> Add openDevice and closeDevice methods to MtpDocumentsProvider.

These methods will be called in the following CL from the service that handles
USB attach and detach intent.

BUG=20274999

Change-Id: I7b3c658afc5750d6a2713c07f40c59b26dcd1460
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java
c00d5d4d82620beba271e63875b93ad9cc39523f 28-May-2015 Daichi Hirono <hirono@google.com> Create package directory for MtpDocumentProvider.

BUG=20274999

Change-Id: I7e0727e28b8e0ef2909d86f7ba6eddc2bec8911d
/frameworks/base/packages/MtpDocumentsProvider/src/com/android/mtp/MtpDocumentsProvider.java