124 Commits

Author SHA1 Message Date
Daichi Hirono
a4d207cf64 Merge "Fix bugs that prevent from using AppFuse." 2016-01-26 07:51:49 +00:00
Daichi Hirono
b36b15586a 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
2016-01-26 16:30:08 +09:00
Daichi Hirono
7d1ca068a2 Merge "Update "accessing files" notification resources." 2016-01-25 08:28:23 +00:00
Daichi Hirono
e6bffff9d9 Update "accessing files" notification resources.
* Replace tentative resources with real ones.
 * Show the notification for each device as per request from UX.

BUG=26625702

Change-Id: Ibcfe7075e4827d5aee216ce5c0007f6dd4572efe
2016-01-25 16:27:19 +09:00
Daichi Hirono
148954a657 Add eventsSupported property to MtpDeviceInfo.
The property provides the set of event code that are supported by
MtpDevice.

BUG=26147375

Change-Id: I54be75e4bb52ddfe9aba8630538ddd32d1a641c8
2016-01-25 10:47:01 +09:00
Daichi Hirono
af6b66529e Ensure to release local reference in AppFuse JNI.
Previously get_object_bytes() leaked local reference of Java buffer
array.

BUG=None

Change-Id: Ic27e57281f984fee4aa285ad21de522ccb0fe4ed
2016-01-21 11:07:48 +09:00
Daichi Hirono
e6054c0ff0 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
2016-01-21 10:51:25 +09:00
Daichi Hirono
f52ef008c7 Start to use app fuse in MtpDocumentsProvider.
BUG=25756419

Change-Id: I050e7cf7523926710291875737602e95c47be088
2016-01-19 11:20:59 +09:00
Daichi Hirono
35fb36b222 Merge "Clean MtpManagerTest code." 2016-01-19 00:48:28 +00:00
Daichi Hirono
3a6212ae55 Clean MtpManagerTest code.
* Use try-with-resource block to ensure close auto-closeable stream.
 * Define local variables just above the place where they are used.

BUG=None

Change-Id: I9d6c952ebac096c51567a4a787b2bc9fff6502de
2016-01-18 10:31:25 +09:00
Daichi Hirono
fab4a97a79 Fix compile error introduced by ag/842950.
BUG=25756419

Change-Id: I8ac270946b3915c02b21a07cf0a9c5b62d69effc
2016-01-15 16:54:24 +09:00
Daichi Hirono
2153e822ee Fix AppFuse JNI.
* Return attributes for all files as well as root.
 * Fix buffer size for reading and add a check for reading size.

BUG=25756419

Change-Id: I572f718bc01d96616ec94f85d800b8b57eedd2ea
2016-01-15 13:45:47 +09:00
Daichi Hirono
d426ed2785 Add a test for createDocument and getPartialObject.
BUG=26482337

Change-Id: Ifda5055b422c3960f7c3c5275a1697f96e36bd06
2016-01-14 14:23:48 +09:00
Daichi Hirono
0ec4312475 Merge "Remove unused lines in MtpDocumentsProvider." 2016-01-12 04:23:07 +00:00
Daichi Hirono
2a9a43369b Reland "Add event parameters to MtpEvent."
The CL was previously reviewed at ag/842930.

> We can obtain detailed information of MtpEvent from devices. e.g. object
> handle of changed object.  The CL adds the detailed information as
> properties of MtpEvent class.
>
> BUG=26480986

Change-Id: I93afad9caf118d74cd0923d70242133c4fb2a648
2016-01-12 12:14:30 +09:00
Daichi Hirono
a12e7d1ba6 Remove unused lines in MtpDocumentsProvider.
Change-Id: I8de1b50441003648547829a3e8dd78153e6f8f31
2016-01-11 17:30:03 +09:00
Daichi Hirono
ab03cb1b46 Clean up TestUtil.
* Integrate two while loops waiting for valid device.
 * Try to open a device just after getting an device ownership so that
   other applicaitons do not steal device ownership before TestUtil
   opens a device.

Change-Id: Ia273cfb2a47fe630efd8c54b22d6ef5823a402b8
2016-01-11 16:32:57 +09:00
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