In preparation for removing junit classes from the Android API
the legacy-test target will be removed from the
TARGET_DEFAULT_JAVA_LIBRARIES. This change adds explicit
dependencies on junit and/or legacy-android-test to ensure that
modules will compile properly once it is removed.
(cherry picked from 6387604f9e672ece85e07c4bcbd7be396867f06f)
Bug: 30188076
Test: make checkbuild
Merged-In: I13e88297731253420e4e5f5291d503f13a39a156
Change-Id: I58446eb8c45d8ac2bcdbc9fa40d1321e811bdd4b
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
(cherry picked from commit 35b2ec551f670562a779925fe152307f20ad67cd)
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
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)
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
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
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
* 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
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
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
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
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
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
The CL adds a handler for FUSE_WRITE command which invokes a Java
handler.
BUG=23093747
Change-Id: I1903fca6b5663e6241ad540a89fe812310ba6810
(cherry picked from commit 35693da25af11583053d4af6a70d4acbf446978d)
Root documents must be added by RootScanner.
Previously DocumentLoader unintentionally tries to load unmapped root
documents, which causes crash.
BUG=27731902
Change-Id: I8674473d80d6e7f758f6636d30148f5d2118bc25
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
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
The error should be regarded as an expected error that failes onCreate,
rather than crash.
BUG=27244513
Change-Id: Icf5164b0cba6cb919077539afe7701ada1e0c247