107 Commits

Author SHA1 Message Date
Daichi Hirono
1d4779c29a 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
2016-01-08 16:58:24 +09:00
Daichi Hirono
af5ea38b8c RealDeviceTest for MTP does not need to ask device permission.
MtpDocumentsProvider can obtain permission itself now because it's
system component.

BUG=26415299

Change-Id: Ia2cd275e57cffadbaefd0f1bf3cb99cde12e5e33
2016-01-07 18:24:59 +09:00
Daichi Hirono
fff12cd70a Merge "Implement FUSE operations in AppFuse JNI." 2016-01-07 01:21:07 +00:00
Daichi Hirono
b596175d80 Merge "Stop to remove device rows at MtpDocumentsProvider." 2015-12-25 07:09:38 +00:00
Daichi Hirono
8e3b9db544 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
2015-12-25 15:59:47 +09:00
Daichi Hirono
4c4061210e Fix flakiness MtpManagerTest test.
The test for readEvent cancelling was flakiness because it can
successfully receives an event before the test tries to cancel it.

Change-Id: Ie7625dff53e07b8bc9888da03e78155e683a6d46
2015-12-24 12:45:03 +09:00
Daichi Hirono
cc9a7d78d5 Implement FUSE operations in AppFuse JNI.
The CL adds the following operations.

 * FUSE_LOOKUP
 * FUSE_OPEN
 * FUSE_READ
 * FUSE_RELEASE
 * FUSE_FLUSH

BUG=25756145

Change-Id: Ib57d7d0ade3343a604a1c40e4b2c2a2d089f3715
2015-12-24 11:11:27 +09:00
Daichi Hirono
e442872eaa Merge "Unmount appfuse when the device FD is closed." 2015-12-22 05:31:57 +00:00
Daichi Hirono
91e3b50636 Unmount appfuse when the device FD is closed.
The CL lets MountService to observe device FD, and request unmount to
vold when the device FD was closed, or remote application providing
appfuse is crashed.

BUG=25756420

Change-Id: I7990694d32affa7f89e3f40badb25098d74d744d
2015-12-22 13:41:33 +09:00
Daichi Hirono
bdb5a45f8d Merge "Break while loop when the thread interuppted." 2015-12-22 04:03:27 +00:00
Daichi Hirono
2bdb388d8f Break while loop when the thread interuppted.
Previously the while loop condition refers to Thread.interrupted()
wrongly. The Thread.interrupted() flag is cleared when the
InterupptedException is thrown.

BUG=26297698

Change-Id: I113d5c88389d54a4a6e29af2cf9515b1693b59dc
2015-12-22 12:57:47 +09:00
Daichi Hirono
492253fb89 Merge "Fix compiler error on com_android_mtp_AppFuse.cpp." 2015-12-21 04:32:36 +00:00
Daichi Hirono
01cf378e04 Fix compiler error on com_android_mtp_AppFuse.cpp.
The CL adds explicit assigning for reply_size to prevent 'unused'
compiler error.

Change-Id: I307758debb23b5bf56ddf71d54813b8cd81d8f49
2015-12-21 13:13:57 +09:00
Daichi Hirono
6348654ab0 Merge "Add AppFuse class and its JNI module." 2015-12-21 03:10:37 +00:00
Daichi Hirono
bee50c0543 Add AppFuse class and its JNI module.
BUG=25756145

Change-Id: I10597e3377cf860412e006a118cd979b6f108af3
2015-12-21 12:07:13 +09:00
Daichi Hirono
81d48536ae 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
2015-12-18 14:12:35 +09:00
Daichi Hirono
20754c5a11 Store device document even if the device is not opened.
BUG=26197156

Change-Id: I2a80bb3e85310cf63253173b1110a155ee1391ba
2015-12-16 09:52:56 +09:00
Daichi Hirono
61e7c647f1 Merge "Revert "Revert "Add device document to MtpDatabase.""" 2015-12-15 08:19:29 +00:00
Daichi Hirono
b3fe72bfb2 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
2015-12-15 07:45:06 +00:00
Daichi Hirono
d0be161b89 Merge "Revert "Add device document to MtpDatabase."" 2015-12-15 07:34:53 +00:00
Daichi Hirono
b63e8c6ccc Revert "Add device document to MtpDatabase."
This reverts commit c0ae45be046b1aed005589791e1ee483c399ab1c.

Change-Id: I03337324e768c509bdcf94c89f7abe7ca00c8a18
2015-12-15 07:34:26 +00:00
Daichi Hirono
b702547e54 Merge "Add device document to MtpDatabase." 2015-12-15 07:27:19 +00:00
Daichi Hirono
c0ae45be04 Add device document to MtpDatabase.
BUG=26175081

Change-Id: Ida91c50f7e33d7b300a32ee318b6f3837edf6606
2015-12-15 16:16:50 +09:00
Daichi Hirono
9984ebd6d3 Use column name instead of index in MtpDatabaseTest for readability.
BUG=26194040

Change-Id: I58a6e59f4784fcc81988093bb113e721e36e46d0
2015-12-15 16:02:27 +09:00
Daichi Hirono
7d0b3cdd70 Merge "Stop reopening MTP devices." 2015-12-15 02:12:31 +00:00
Daichi Hirono
be38848969 Stop reopening MTP devices.
BUG=26175809

Change-Id: I45a51c0623b349f12e7d3cf787a89b089f230bc1
2015-12-15 11:10:37 +09:00
Daichi Hirono
42a5e0e3a4 Merge "Integerate mapping methods for root/child documents into the same methods." 2015-12-15 02:08:50 +00:00
Daichi Hirono
7a375c407f 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
2015-12-15 11:06:20 +09:00
Daichi Hirono
4b54e036ef 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
2015-12-11 17:13:53 +09:00
Daichi Hirono
dc89e079ce Merge "Grant USB device permission by using system permission." 2015-12-09 04:04:47 +00:00
Daichi Hirono
b863990a01 Enable MtpDocumentsProvider by default.
BUG=20274999

Change-Id: I35941df66fea4ab703f8f1de3c69b6f4dd2be9a0
2015-12-09 11:18:32 +09:00
Daichi Hirono
4751880a4d Grant USB device permission by using system permission.
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
2015-12-09 11:15:25 +09:00
Daichi Hirono
a57d9ed090 Turn MtpDocumentsService foreground when devices are opend.
BUG=26047393

Change-Id: I70f69c5ddec500ed61d1a76fb9e2e296813b2a4e
2015-12-08 17:27:04 +09:00
Daichi Hirono
99b58052f8 Polish MtpManagerTest.
Change-Id: Ibadd209ee1cb752f0e55694d0f1f631c558f1370
2015-12-04 12:32:41 +09:00
Daichi Hirono
56e086f5da Merge "Extract test utility class." 2015-12-02 03:53:46 +00:00
Daichi Hirono
ed2f850330 Merge "Add storage icon for MTP roots." 2015-12-02 03:53:08 +00:00
Daichi Hirono
b255f58904 Extract test utility class.
Change-Id: I8505ab13ceccf32e7a9b6817f84a66766098b09e
2015-12-02 12:38:49 +09:00
Daichi Hirono
39795da4c9 Add storage icon for MTP roots.
BUG=22545807

Change-Id: I714b26d52e00b0f9a5c95dea1508be0d617482e3
2015-12-02 11:08:40 +09:00
Daichi Hirono
1b8f619480 Merge "Handle Android M as a MTP device in MtpManagerTest." 2015-12-01 07:42:12 +00:00
Daichi Hirono
f26af124e3 Handle Android M as a MTP device in MtpManagerTest.
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
2015-12-01 15:58:29 +09:00
Daichi Hirono
e0282dd7d4 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
2015-11-30 10:06:56 +09:00
Daichi Hirono
259ce80132 Extract mapping operations to partial class of MtpDatabase.
Change-Id: I5fda6d5754206528ad5953bcc179a0ffe0b4982d
2015-11-26 15:55:15 +09:00
Daichi Hirono
9e8a4fa78f Change ID format of MtpDocumentsProvider.
BUG=25704562

Change-Id: I5d9fc167512eee06964650e07206e226173611b2
2015-11-26 11:09:46 +09:00
Daichi Hirono
49f920fbde Add new methods to MtpDatabase.
* deleteDocument
 * getParentId
 * queryDocument
 * putNewDocument

BUG=25756881

Change-Id: Ie223b37e04586b3e2b0448d09e14562fedbb652a
2015-11-19 16:00:10 +09:00
Daichi Hirono
e1d57710fb 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
2015-11-19 14:16:42 +09:00
Daichi Hirono
47eb192b27 Start using MtpDatabase in DocumentLoader.
BUG=25704514

Change-Id: I4d9247c148679ee7e40a1a03443e4c0299b1e44d
2015-11-17 15:46:40 +09:00
Daichi Hirono
4604b74603 Prepare for adding MtpDocumentsProvider tests to APCT.
BUG=25093356

Change-Id: I0c194e6bf3abeb632171e9be49471b9d94a0cb4c
2015-11-17 08:30:41 +09:00
Daichi Hirono
dc47344660 Start to use MtpDatabase in RootScanner.
Change-Id: Id99cb61ad8680529b5ee502ca5bb2b3cdd143235
2015-11-16 17:49:20 +09:00
Daichi Hirono
18d70d5b7c Split MtpDatabase class into three classes.
BUG=25162822

Change-Id: Id64b6d9fa11a3214bb855ea8e1344af45fb415ff
2015-11-13 16:42:50 +09:00
Daichi Hirono
cfcb0c007d Adds new method to update existing documents in MtpDatabase.
BUG=25162822

Change-Id: I7aa63fc272aa7b57d6a9672565f842774e898a00
2015-11-13 14:50:48 +09:00