200 Commits

Author SHA1 Message Date
Baligh Uddin
b1df48d326 Merge remote-tracking branch 'goog/cw-f-dev' into fix_merger
Bug: 32849428

* goog/cw-f-dev: (98 commits)
  Revert "Catch KeyStoreException for setting profile lock"
  Fix createConfirmDeviceCredentialIntent for wear for CTS.
  Fix default dialog background colour for watch devices.
  Catch KeyStoreException for setting profile lock
  Add cross-links between FINE and COARSE location permissions. bug: 25371600
  Fixed a bug with the emergency affordance in multi user
  Zygote: Additional whitelists for runtime overlay / other static resources.
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Zygote : Block SIGCHLD during fork.
  colors: add missing accent_material_{700,50} resources.
  Import translations. DO NOT MERGE
  Import translations. DO NOT MERGE
  Zygote : Block SIGCHLD during fork.
  DO NOT MERGE ANYWHERE Revert "DO NOT MERGE ANYWHERE libhwui: make setSurface asynchronous"
  ...

Change-Id: I63468da5bfa21ed9ac5985bbdbf3a61d4c389aa0
2016-11-22 17:19:45 -08:00
Bill Yi
3bd78c2416 Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 32766034
Change-Id: Iade7d25f2c66d2014fe58640bd66dc953649edf2
2016-11-10 20:43:06 -08:00
Daichi Hirono
0fd96a12ec DO NOT MERGE: Fix NullPointerException in MtpManager. am: 9c8e0f1a54
am: 6e6fdd4779

Change-Id: I83b323e21ea69b8bf51fc0c3896ef159868323ef
2016-10-18 17:48:11 +00:00
Daichi Hirono
9c8e0f1a54 DO NOT MERGE: Fix NullPointerException in MtpManager.
BUG=30152892

Change-Id: I1f4ec361f499510e3ac1635ca5d134b47b6059c3
(cherry picked from commit 28e6112e2f2cef5852b20e53382ea717a5a6cd41)
2016-10-18 14:42:28 +09: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
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 83c679e7221460fc50e91402a34787e1866d94ef)
2016-08-22 01:24:53 +00: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
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
b137b24ccb Import translations. DO NOT MERGE
Auto-generated-cl: translation import

Bug: 29578243
Change-Id: Ibccd468924a986297bb779eef68d4b2ed392b73f
2016-06-24 08:38:58 -07: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
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
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 35693da25af11583053d4af6a70d4acbf446978d)
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
Daichi Hirono
678ed36beb Count error document to complete adding documents to the database.
Previously DocumentLoader#LoaderTask had a counter to count loaded
documents and completes adding documents to the database.  However it
does not count documents where a MTP device returns an error for
getObjectInfo. The CL fixes the problem to ensure we complete documents
loading.

BUG=27729653

Change-Id: I696eac790a6535f1bd7a1855dc2d6f932e32eae5
2016-03-22 13:41:05 +09:00
Daichi Hirono
e80b147cf7 Fix null pointer exception when MTP/PTP device is detached.
FIXED=27743872

Change-Id: I9b754ba7efbc4958a47aafe332f1909bc0d50457
2016-03-22 11:05:22 +09:00
Daichi Hirono
07db6f3969 Merge "Fix the logic to add suffix when copying." into nyc-dev 2016-03-22 01:35:00 +00:00
Daichi Hirono
4f04fd358d Fix the logic to add suffix when copying.
Previously the logic add '.' even if the extension is empty.

BUG=27729309

Change-Id: I3fa4b09fea977b5c716ec5cbbbc7d9f4ab96db08
2016-03-22 10:30:47 +09:00
Daichi Hirono
2917fa9dd5 Change the title of DocumentsUI from "Files" to "Downloads".
BUG=27683277

Change-Id: I429cae8804b8f318f58039fc63d081c2a864fad0
2016-03-18 17:46:57 +09:00
Daichi Hirono
1360868de8 Merge "Add suffix number when copying a file." into nyc-dev 2016-03-17 04:53:35 +00:00
Daichi Hirono
fc7fb7533f 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
2016-03-17 13:52:21 +09:00
Daichi Hirono
4327283240 Merge "Handle SQLite disk IO error in MtpDocumentsProvider#onCreate." into nyc-dev 2016-03-16 07:34:15 +00:00
Daichi Hirono
5884e1fa87 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
2016-03-16 14:36:27 +09:00
Daichi Hirono
aa0fa38432 Merge "Regard timeout as an error in the MtpDocumentsProvider test." into nyc-dev 2016-03-15 02:36:46 +00:00
Daichi Hirono
acb0e27bb3 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
2016-03-15 11:35:34 +09:00
Daichi Hirono
497b473b8a MtpDocumentsProvider returns mime type from file extension.
File extensions contain more information to determine mime type than MTP
format codes. The CL lets MtpDocumentsProvider return mime type from
file extensions if it's not inconsitent with format code.

BUG=27004954

Change-Id: I08a4a91235b1d3f48e77b70b28c8c5aedf8d601d
2016-03-14 15:30:37 +09:00
Daichi Hirono
3bb37e7ff0 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
2016-03-09 12:32:22 +09:00
Daichi Hirono
37a655aac1 Fix null pointer exception in DocumentLoader.
BUG=27489909

Change-Id: I1ebc9953f6db6639241d0c46257d110c5b0eb5b0
2016-03-07 19:41:10 +09:00
Daichi Hirono
24ab92a5f7 Ensure to complete background thread of PipeManager.
BUG=27488803

Change-Id: Ib540ab42f6263e1aea4c1bb184a4f88aa1454a14
2016-03-04 17:53:03 +09:00
Daichi Hirono
e5b499bcc5 Merge "Fix RootScanner to execute scan at least once before cancelling it." into nyc-dev 2016-03-01 07:50:18 +00:00
Daichi Hirono
2e9a57b0d4 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
2016-03-01 13:51:06 +09:00
Daichi Hirono
61ba923ca0 Set document flag by referring MTP supported operations.
BUG=26147375

Change-Id: I6c4244f1f1153c1bbbf21ea9d608dc1a92ca70cd
2016-02-26 16:23:30 +09:00
Daichi Hirono
0f32537e40 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
2016-02-26 16:20:02 +09:00