Commit Graph

219 Commits

Author SHA1 Message Date
Daichi Hirono
29de7693f4 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
2016-11-08 09:09:18 +09:00
TreeHugger Robot
2cf7c483a8 Merge "Not create document under the device." 2016-11-07 06:21:48 +00:00
Daichi Hirono
35b2ec551f 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
2016-11-07 10:29:09 +09:00
Garfield Tan
f46a463e41 Change findPath() to findDocumentPath() in MtpDocumentsProvider.
Test: It builds.
Change-Id: If474e766b5680d49a7557f0e7ee1c039eb4efae0
2016-11-02 16:18:33 -07:00
Daichi Hirono
b9ffa2a1d2 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
2016-11-02 12:33:45 +09:00
Steve McKay
e5a8a17ed2 Remove the EXTRA_FANCY_FEATURES flag...
Which is no-longer necessary.

Test: build and run.

Change-Id: I515c4a1bf78cbf4d54304bf4ebe1059a596c95a0
2016-10-28 16:55:27 -07:00
Mark Salyzyn
21c2e9e60c Merge "missing includes" am: 78929f3ee0 am: 6a8f0d70b0
am: 6e60ab12e7

Change-Id: I1b5c6f49d2ae565ebd59c6ce8d590512ab306487
2016-10-17 21:38:33 +00:00
Mark Salyzyn
6a8f0d70b0 Merge "missing includes"
am: 78929f3ee0

Change-Id: I3e7a25ded484d516fab453abe434c2e53cf0f27e
2016-10-17 21:25:59 +00:00
Mark Salyzyn
4d6c372eae missing includes
Assumptions are made about header side effects

Test: compile
Bug: 30465923
Change-Id: Icc9415aed5e54b2bc00b70aa0da6df4148f30654
2016-10-17 12:32:54 -07:00
Daichi Hirono
4dd323b2d3 Rename AppFuseTest in perf test package to AppFusePerfTest.
Previously we have two AppFuseTest class in the normal test and the perf
test. The CL renames the one in the perf test to different name.

Bug: 31982374
Test: adb shell am instrument -w com.android.mtp.perftests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I6272d7f78cead0bfeee7cf83ed50c77658caa1c0
2016-10-12 16:09:10 +09:00
Daichi Hirono
bdee9a9ae3 Add read/write performance test for AppFuse.
The perforamnce test read from/write to 10MB data to AppFuse file 100
times.

Test: adb shell am instrument -w com.android.mtp.perftests/android.support.test.runner.AndroidJUnitRunner
Bug: 31982374
Change-Id: I8f78ee43d8078d7f1098249b28491cb43b5f3bef
2016-10-07 12:28:54 +09:00
Bill Yi
7c70713140 Import translations. DO NOT MERGE
Change-Id: Ide9c72117c22c23ba4d8e3faffcc06ff3a777705
Auto-generated-cl: translation import
2016-09-21 21:32:09 -07:00
Daichi Hirono
e88dbc9dc8 Set Root.FLAG_LOCAL_ONLY for MTP roots. am: b7573e93cd
am: d590e3354d

Change-Id: I68df97198ecbd7e7bdbcdb9e678f80266b5eb887
2016-08-23 17:20:43 +00:00
Daichi Hirono
b7573e93cd 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 83c679e722)
2016-08-22 01:24:53 +00:00
Daichi Hirono
83c679e722 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
2016-08-18 16:55:02 +00:00
Daichi Hirono
daa61d45da Fix MtpDatabaseTest#testFormatCodeForMpeg.
ag/1241051 explicitly specified the primary mime type for MTP format
code. And it changes mime type for MtpConstants.FORMAT_MPEG from
video/mp4 to video/mpeg.

FIX=30266226

Change-Id: I362bd7d651140b9928aa76e0d54e4769296d9498
2016-08-10 14:59:18 +09:00
Bill Yi
6e231e5d17 Import translations. DO NOT MERGE
Change-Id: Ibefe0963160a02bc49c36a2511d5c3f72f8078c2
Auto-generated-cl: translation import
2016-07-20 15:23:45 -07:00
Daichi Hirono
28e6112e2f Fix NullPointerException in MtpManager.
BUG=30152892

Change-Id: I1f4ec361f499510e3ac1635ca5d134b47b6059c3
2016-07-19 15:48:04 +09:00
Bill Yi
2a824d635a Import translations. DO NOT MERGE
Change-Id: Iecbfb973538722055462e89e730f73c562a649bd
Auto-generated-cl: translation import
2016-07-05 12:58:36 -07:00
Bill Yi
0789113f7f Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 29390361
Change-Id: Ie154b48d77d2bc34ae1e71e1c3813c3ed2959eeb
2016-06-30 18:41:48 -07:00
Bill Yi
f544a4bdcd Import translations. DO NOT MERGE
Change-Id: I9936b6b782ee33e1748960f86eeb765f41024e86
Auto-generated-cl: translation import
2016-06-29 12:36:34 -07:00
Bill Yi
18c27ae9b7 Import translations. DO NOT MERGE
Change-Id: I2dca8e72d9b0325c9127ccfa40432e918334f096
Auto-generated-cl: translation import
2016-06-27 01:29:47 -07:00
Bill Yi
b137b24ccb Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 29578243
Change-Id: Ibccd468924a986297bb779eef68d4b2ed392b73f
2016-06-24 08:38:58 -07:00
Bill Yi
25fb5dc045 Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 29578243
Change-Id: Ib2f11b1824415b6ccbc26e0cd6fbae8dfcea6058
2016-06-24 08:31:09 -07:00
Daichi Hirono
f20e49ecb9 Fix warning from error prone.
BUG=29146585

Change-Id: Ic54caecf1abd74affcd902a9561adcdaa8f10c59
2016-06-08 16:21:06 +09:00
Daichi Hirono
86c1a9bf60 Remove MTP API marked as @removed.
BUG=28146379

Change-Id: I4f0a380941663eac423f8a5633447f1eceb516cb
2016-05-26 16:39:21 +09:00
Steve McKay
935d7d6854 Merge "Don\'t show new-window item in Downloads per Gabe." into nyc-dev am: fec0d188c1 am: 6fdaf2f2cf
am: b8995b7abc

* commit 'b8995b7abc9cbaa1dcb363c68535a63f4e8768a3':
  Don't show new-window item in Downloads per Gabe.

Change-Id: I54d288582f474ed1a0718a3f6327af7f1814be75
2016-05-13 17:42:44 +00:00
Chih-hung Hsieh
51bec5a191 Merge "Fix google-explicit-constructor warnings." 2016-05-12 16:36:34 +00:00
Steve McKay
f570c771f2 Don't show new-window item in Downloads per Gabe.
Also, fix regression...don't show "internal storage" option in Downloads.
All other modes, fix inconsistencies in presentation of
internal-storage/new-windows commands by eliminating launch mode inference.
Update VolumeInfo and MTP provider to send correct launch mode extra.

Bug: 28691735,28695347
Change-Id: Ic480925f4c8f1beee4da104a2259c1ce5f28a6a1
2016-05-10 16:25:58 -07:00
Delphine Martin
355421460b Set jack.assert.policy value to 'always'
The policy value 'enable' does not exist anymore
and was replaced by 'always'

(cherry-picked from 2a6b5c63c0)

Change-Id: I233a555821a84d917e3b3ec923b5baffc18bd2d2
2016-05-10 15:35:06 +00:00
Delphine Martin
2a6b5c63c0 Set jack.assert.policy value to 'always'
The policy value 'enable' does not exist anymore
and was replaced by 'always'

Change-Id: I233a555821a84d917e3b3ec923b5baffc18bd2d2
2016-05-10 14:42:33 +00:00
Chih-Hung Hsieh
4fd1ddf4d2 Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I1b6e9613b7244581485e6440010b96b8114b03d1
2016-05-06 10:16:13 -07:00
Daichi Hirono
0c30bdfe9a Merge "Do not terminate AppFuse message loop when FUSE_FORGET." into nyc-dev 2016-05-03 03:06:15 +00:00
Daichi Hirono
07f48ad0df Do not terminate AppFuse message loop when FUSE_FORGET.
Currently AppFuse tries to terminate its message loop when it receives
FUSE_FORGET. But kernel continues to dispatch messages after FUSE_FORGET
and it should not terminate AppFuse meesage loop.

Change-Id: I070a71c35a8d80bcaaf7603305d219e65be97bc9
Fixes: 28508169
2016-05-02 12:55:35 +09:00
Daichi Hirono
59688a5883 Remove "don't disconnect the device" description.
Previously MTP notification shows a message "don't disconnect the
device". But there is no unmount button for MTP. Because it's safe to
disconnect MTP device after completing file operations, we remove the
message from MTP notification.

Change-Id: I78b7649e3a9982c02b0312d221d395e9ac799318
Fixes: 28194216
2016-04-27 14:49:06 +09:00
Daichi Hirono
f7e0799fc1 Handle error result returned from MTP API correctly.
* Check null result for all MTP APIs that can return null.
 * Don't regard valid parent handles that are more than 0x80000000 as
   error.
 * Check boolean result from importFile.

Change-Id: I262511ac3c935ebb54e52c03eaefd3535a3e2f29
Fix: 28155538
2016-04-13 13:59:54 +09:00
Daichi Hirono
6b34b31059 Merge "Fix flakiness DocumentLoader#testCancelTask." into nyc-dev 2016-04-12 03:54:59 +00:00
Daichi Hirono
3edcde2953 Fix flakiness DocumentLoader#testCancelTask.
For testing, we use blockDocument and unblockDocument test mehtods to
control flow of DocumentLoader's background thread.
Previously testCancelTask may exit before the background thread goes
back from blocking, which causes InterruptedException.

Fixes: 28125289
Change-Id: Id03826733c5b6f1da66b9280838eb1d2897ed5fc
2016-04-12 12:38:03 +09:00
Daichi Hirono
df839271e3 Merge "Fix crash when deleting multiple files." into nyc-dev 2016-04-11 07:52:03 +00:00
Daichi Hirono
76be46f4d9 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
2016-04-11 14:32:03 +09:00
Daichi Hirono
d0ef1394d2 Remove LOG_NDEBUG 0 from AppFuse JNI.
"LOG_NDEBUG 0" enforces to output verbose log even for release build.

Change-Id: I9ab2f5b86065d360222cbabc8d6be2431b06d785
Fix: 28055420
2016-04-08 10:07:01 +09:00
Daichi Hirono
f4e7fa8038 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
2016-03-29 16:27:59 +09:00
Daichi Hirono
77a1c65610 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
2016-03-28 14:57:23 +09:00
Daichi Hirono
1c431625b3 Merge "Get object size that is more than 4GB." into nyc-dev 2016-03-28 04:36:01 +00:00
Daichi Hirono
64111e08d9 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
2016-03-28 13:34:03 +09:00
Daichi Hirono
09ece6c68b 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 35693da25a)
2016-03-25 11:18:44 +09:00
Daichi Hirono
01e236b984 Update an icon for MtpDocumentsProvider.
BUG=27135431

Change-Id: Ic8619a533bdf2426fdf0d3691a883606fa027fb1
2016-03-23 11:07:29 +09:00
Daichi Hirono
f416030277 Merge "Fix null pointer exception when MTP/PTP device is detached." into nyc-dev 2016-03-22 08:56:00 +00:00
Daichi Hirono
071313e8b5 Don't map root documents in DocumentLoader.
Root documents must be added by RootScanner.
Previously DocumentLoader unintentionally tries to load unmapped root
documents, which causes crash.

BUG=27731902

Change-Id: I8674473d80d6e7f758f6636d30148f5d2118bc25
2016-03-22 13:46:52 +09:00
Daichi Hirono
b3383fdac0 Add root flag correctly.
BUG=27369570

Change-Id: I93b9b662667009a374d879c7ab667b10fb7cbf7c
2016-03-22 13:42:21 +09:00