summaryrefslogtreecommitdiff
path: root/media/java/android/mtp
Commit message (Collapse)AuthorAgeFilesLines
* Fix MtpDatabase multithreading NullPointerExceptionkatao2022-11-021-5/+7
| | | | | | | | | | | | | | When MtpDatabase receives BATTERY_CHANGED broadcasting, it calls the sendDevicePropertyChanged of mServer. But in some cases, MtpService will call setServer to set mServer to null. There will be an NullPointerException when these two cases occur at the same time. This bug was reported to Google Issue Tracker. Link:https://issuetracker.google.com/issues/111158105 Test: Set the MTP mode and pull out the USB interface when the battery changes. Change-Id: I961c0f3d805b7df32285f578890f2d9efe8340ff
* Limit transcoding size workaround to windowsKevin Rocard2021-11-263-8/+28
| | | | | | | | | | | Test: Connect android to windows through usbc. Enable mtp, then enable the transcoding option. Copy H265 video from the camera folder to windows' desktop. Transcoded H264 video plays correctly in WMPcorrectly. Bug: 184117074 Bug: 190422448 Change-Id: I17264f0ee3e742315569d4c50817b1da7f3f2eb4
* Workaround to fixup MTP transcode file sizeZim2021-11-261-1/+36
| | | | | | | | | | | | | | | | | | | | Some Windows MTP clients ignore the file size sent from the server while sending MTP objects, and instead rely on the cached MTP metadata containing the size. This causes file corruption when transcoded files are transferred from phone to PC because the file is truncated to the original file size from the cached metadata which is smaller than the transcoded file size. To workaround this, MediaProvider added an ugly workaround to the struct stat st_nlink field to signal when a file requires transcoding. In such cases, the MTP server can double the metadata size, the same heuristic used in the MediaProvider to accommodate the transcoded file size. Test: atest MtpTests Bug: 184117074 Bug: 190422448 Change-Id: I0581978fb346e3dc2d7a5204ffd7c601b61ec749
* MTP: Skip runtime thumbnail generation for Android HostJames Wei2021-06-213-2/+75
| | | | | | | | | | | | | | | Android Host is not capable to deal with the long processing time for runtime thumbnail generation. Skip runtime thumbnail generation for Android Host but keep no impact to other Host Bug: 188752500 Test: atest MtpTests Test: atest MtpServerTest Test: atest MtpServiceTests Test: manual test on Windows 10 File Explorer Test: manual test on Android Host Files App Change-Id: I24ed3bb29c5a6912398a9e00e7748fd406cf6a64
* Merge "MTP: Add thumbnail generation for JPG" am: 5aac2c84ba am: d68b21d215 ↵Treehugger Robot2021-04-011-3/+15
|\ | | | | | | | | | | | | | | am: fe8e0b235f Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1657579 Change-Id: Ia6f614fe65c560681b2f076046a7e4295a3f3e86
| * Merge "MTP: Add thumbnail generation for JPG" am: 5aac2c84ba am: d68b21d215Treehugger Robot2021-04-011-3/+15
| |\ | | | | | | | | | | | | | | | Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1657579 Change-Id: I9b85e42a66e310666de6d811e2af38d428a86f3d
| | * MTP: Add thumbnail generation for JPGJames Wei2021-03-301-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add thumbnail generation support for JPG image format Instead of retrieving thumbnail from EXIF header Bug: 178726106 Test: atest MtpTests Test: manual test on Windows 10 file explorer Test: manual test on Linux nautilus file browser Change-Id: I29ad89835a8a27204a2e6dbd97b994209a813424
| * | Merge "Fix renaming file and moving file issue in MTP" into rvc-qpr-dev am: ↵TreeHugger Robot2021-01-121-96/+24
| |\ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | d099321312 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13090503 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: Ibdb009f96a2e55bb29dd7189451a7cbf57d6919a
| | * Fix renaming file and moving file issue in MTPIvan Chiang2021-01-111-96/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the user renames/moves a file/directory, the database of MediaProvider is not updated. It causes that the file can't be opened via MediaProvider. Use scanFile to instead of MP.update for the file/directory. Handle the .nomedia case for create/copy/move/delete/rename. Scan the parent directory to update the database. Test: atest MtpTests Test: atest --test-mapping packages/providers/MediaProvider Test: manual. 1. Move/rename the file/directory. 2. Open the file in DocumentsUI 3. create/copy/move/delete/rename for .nomedia case Bug: 169300366 Bug: 171538933 Bug: 172029805 Bug: 170798581 Change-Id: Ia37be7a027bfe502e3f7c96babe5a5bbed5f942c Merged-In: Ia37be7a027bfe502e3f7c96babe5a5bbed5f942c (cherry picked from commit 20079f10644e641bbb2c35c250e8a9e0b9f6c1b3)
* | | Remove stale method from MtpServerRay Essick2021-02-231-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | configure() called non-existent native_configure() as only action. No users found, the class is marked @hide so is not part of SDK. Bug: 180915584 Test: build Change-Id: I1c6d6d91482d4c45b8a55dd258332ba2fb69a599
* | | Add unsupported mime types in media capabilitiesManish Singh2021-01-201-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since ApplicationMediaCapabilities now provides the option to add unsupported mime types, we add the unsupported types to the bundle for the case when we want transcoding to happen in MTP. Test: manual BUG=158466651 Change-Id: I1266c0753e43b84ec4f5bd181386f5c6aeb477d3
* | | Support transcode via MTPZim2021-01-151-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a helper method to open files via MediaProvider ContentResolver. Note that we are optimizing for the current default transcode option - B (which is to transcode) and therefore we include the bundle only when we do not want to transcode. Test: Manual Bug: 158466651 Change-Id: I48436ef143feb889b523a9c0e620c2312157ef89
* | | Merge "MTP: Update language to comply with Android's inclusive language ↵Treehugger Robot2021-01-071-3/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | guidance" am: 86b6f66d9f am: 5e5716ef83 am: 27f9f37c0b Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1382396 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: If5df055458ced225b8c6d3046617a7dd620d590e
| * | MTP: Update language to comply with Android's inclusive language guidanceJames Wei2020-12-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | See https://source.android.com/setup/contribute/respectful-code for reference BUG=162536543 Change-Id: Ide3483e78ce66deb9bdda2a0d54feb8f70748832
* | | Revert "Temporarily replace "android.com" accounts."Jeff Sharkey2020-12-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 0ace970e1997c91b1b105eb3e326963bc04164d3. Bug: 174932174, 175111824 Exempt-From-Owner-Approval: refactoring with team leads buy-in Change-Id: I152186408ecf6da1cb7354d14737de7cce55a34b
* | | Temporarily replace "android.com" accounts.Jeff Sharkey2020-12-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're temporarily blocked on internal Gerrit tooling to support relaxed OWNERS validation, so this change temporarily replaces all "android.com" accounts with "google.com" equivalents. Bug: 174932174,175111824 Exempt-From-Owner-Approval: refactoring with team leads buy-in Change-Id: I114f2a40cee1b65e21250da7372e11c18cd73e25
* | | Fix renaming file and moving file issue in MTPIvan Chiang2020-11-191-96/+24
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the user renames/moves a file/directory, the database of MediaProvider is not updated. It causes that the file can't be opened via MediaProvider. Use scanFile to instead of MP.update for the file/directory. Handle the .nomedia case for create/copy/move/delete/rename. Scan the parent directory to update the database. Test: atest MtpTests Test: atest --test-mapping packages/providers/MediaProvider Test: manual. 1. Move/rename the file/directory. 2. Open the file in DocumentsUI 3. create/copy/move/delete/rename for .nomedia case Bug: 169300366 Bug: 171538933 Bug: 172029805 Bug: 170798581 Change-Id: Ia37be7a027bfe502e3f7c96babe5a5bbed5f942c
* | Merge "use updated mStorage for new MtpObject when copy file between ↵James Wei2020-06-021-0/+7
|\ \ | |/ |/| | | | | | | | | | | storages" am: 587620cc62 am: 7c7680f261 Original change: undetermined Change-Id: I55cee281ffbd62bee688831844d3f2b071666e4c
| * use updated mStorage for new MtpObject when copy file between storagesjoker.yang2020-05-301-0/+7
| | | | | | | | | | | | | | | | | | copy file from sdcard to internal storage through MTP, then the file can't be renamed bug: 147715888 Change-Id: Iffeeeb1372e0ecf305cf0c70edb601a4b2001342
| * Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-142-2/+3
| | | | | | | | | | | | | | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv \ git diff HEAD^ HEAD | grep '^[+-][^+-]' | grep -v '.import' Merged-In: I853372f3c6fef905553bb31be4f1bb48df735f7a Change-Id: I853372f3c6fef905553bb31be4f1bb48df735f7a
* | MTP: media info can not be retrieved via MTP#2James Wei2020-05-012-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Under the new MtpStorageManager design, media info like MP3 Track title, album and artist, Genre, etc can not be retrieved via MTP by Windows Media Player, Linux Rhythmbox and Some Car Kits Bug: 112635346 Test: atest MtpTests Test: atest MediaProviderTests Test: Manual test: Windows Media Player Change-Id: I57a947fe6d3a583a0990be5bd2b0678f39d948f2
* | MTP: Fix MTP SD card issueJames Wei2020-04-222-2/+3
| | | | | | | | | | | | | | | | | | | | Modify MTP access path for SD card in accordance with Storage Permission change Bug: 150188237 Test: atest MtpTests Test: Manual test: MTP file browsing / copy on SD card Change-Id: I7da699ca04844514827af18b0318c66d2a3fbc6e
* | MTP: Add MtpDatabase unit testJames Wei2020-04-221-3/+7
| | | | | | | | | | | | | | | | Add Thumbnail feature test cases Bug: 117863715 Test: atest MtpTests Change-Id: I5a09efef10df20e382a4c623481e048e7b35ff14
* | Merge "MTP: Add MTP Thumbnail feature"James Wei2020-02-051-0/+47
|\ \
| * | MTP: Add MTP Thumbnail featureJames Wei2020-01-221-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add thumbnail support for more supported image & video format Bug: 117863715 Test: atest MtpTests Test: manual test on Windows 10 file explorer Test: manual test on Linux nautilus file browser Change-Id: Id973db64683dbdb75f1fe97cae8439bab6cdcb57
* | | Exempt-From-Owner-Approval: Fix usages of WindowManager.getDefaultDisplay() ↵Andrii Kulian2020-01-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in f/b Replace the existing usages of now-deprecated API WindowManager.getDefaultDisplay() with WindowMetrics or Context.getDisplay() in frameworks/base. Bug: 128338354 Test: Build, auto test Change-Id: I02d38a022c5e0e6e9d699f03d35b65d6c8126da9
* | | Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-082-3/+3
|/ / | | | | | | | | | | | | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv \ git diff HEAD^ HEAD | grep '^[+-][^+-]' | grep -v '.import' Change-Id: I853372f3c6fef905553bb31be4f1bb48df735f7a
* | Merge "Revert "Use new UnsupportedAppUsage annotation."" am: edf7ce4f38 am: ↵Automerger Merge Worker2019-12-192-3/+2
|\| | | | | | | | | | | 019286764f am: f6253ef435 Change-Id: Id33f64eb9c8aa7d68cc52f7359b4f0a3d2675d8a
| * Revert "Use new UnsupportedAppUsage annotation."Austin Wang2019-12-192-3/+2
| | | | | | | | | | | | | | | | This reverts commit a5264903e22bc741add895133474ea13a370de4c. Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_master&target=sdk_phone_armv7-sdk&lkgb=6083299&lkbb=6085371&fkbb=6083313, bug b/146533269 Change-Id: Ie5b031d7b277cf0e09b0a9776b26bf74f5f69e70
* | Merge "Use new UnsupportedAppUsage annotation." am: 1385dca8f6 am: ↵Automerger Merge Worker2019-12-182-2/+3
|\| | | | | | | | | | | 068a9faf3d am: c7f44bacbe Change-Id: I30839db2fe99ba4670ec1b39d5e64540fdd15f69
| * Use new UnsupportedAppUsage annotation.Artur Satayev2019-12-182-2/+3
| | | | | | | | | | | | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv \ git diff HEAD^ HEAD | grep '^[+-][^+-]' | grep -v '.import' Change-Id: I087bb1cecbe59f1cf0c2e770c735d7a433722c6f
| * Remove libexif usage from libmedia_jni.soMarco Nelissen2019-07-081-0/+50
| | | | | | | | | | | | | | | | Test: manual, connect with MTP and PTP Change-Id: I33128db25b8aae60df7854c61fc2a3873a1bced9 (cherry picked from commit f7ec16802c0ff22feeaed9d4011c4a18c9d0dd96) (cherry picked from commit efb865ace2885723d37e0ef9e6bae695d6dcabb0) (cherry picked from commit 5954d210d324bd97fc585b6a238a15d1d52e64a1)
| * Switch to HexEncoding from ByteStringUtilsNeil Fuller2019-06-061-4/+5
| | | | | | | | | | | | | | | | | | | | | | Migration in preparation for deletion of ByteStringUtils. Also contains an import ordering change needed for upload. Bug: 124232146 Test: build only Change-Id: I0c71751de9a142a81ce43b4eaea497bf291afcbc (cherry picked from commit 8fdca745d62f2d754d30ebbac95cf1c9f0456287)
* | Shuffling to prepare for MediaProvider APEX.Jeff Sharkey2019-12-182-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An upcoming change will move MediaStore to be within the recently created MediaProvider APEX. This means that MediaStore will need to be fully built against @SystemApi, and so this CL adjusts APIs to support a clean transition: -- Listing of "recent" storage volumes and scan paths for "internal" storage is now handled by StorageManager directly, so that partners retain control over what is deemed recent. -- StorageVolume now returns the MediaStore volume name and the filesystem directory where its contents are presented to apps. -- Conversion of legacy thumbnail "kind" values to dimensions now happens directly inside MediaStore. -- PendingParams and PendingSession are completely removed. -- Contributed media APIs are completely removed. -- Media for demo users is now surfaced as a unique StorageVolume. -- Migrate most MediaStore APIs to accept ContentResolver, which supports easy usage of ContentResolver.wrap(). Bug: 144247087, 137890034 Test: atest --test-mapping packages/providers/MediaProvider Exempt-From-Owner-Approval: in-place refactoring Change-Id: I445528b2779bb37b9f2558e67a3cfc9f60412092
* | Disable support for object references.Jeff Sharkey2019-12-161-64/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MediaProvider has standardized on being an indexed view of files that we discover on disk, so that we can always recover that indexed information in case of user data wipe or corruption. This means that MediaProvider no longer supports abstract "object references". This doesn't prevent future MTP implementations from bringing back object reference support, and the recommended path forward would be to have MtpDatabase convert object references into playlist files that are written to disk. MediaProvider will then gladly scan those playlist files to be visible to users. Shift to directly using the existing Files.getContentUri() API for all MediaProvider interactions. Bug: 137890034 Test: atest --test-mapping packages/providers/MediaProvider Change-Id: I829027bb9fbcf5991c1ddee0aec04ad7e7b240cd
* | Remove libexif usage from libmedia_jni.soMarco Nelissen2019-07-021-0/+50
| | | | | | | | | | Test: manual, connect with MTP and PTP Change-Id: I33128db25b8aae60df7854c61fc2a3873a1bced9
* | Merge "Adjust MTP to reference by specific volume name." into qt-dev am: ↵Jeff Sharkey2019-04-174-44/+56
|\| | | | | | | | | | | | | | | 383d316707 am: 951c617d7d Change-Id: I507f1c1de958ad8b5866eec8334f4a1404c659f2
| * Adjust MTP to reference by specific volume name.Jeff Sharkey2019-04-174-44/+56
| | | | | | | | | | | | | | | | | | | | The MediaStore.VOLUME_EXTERNAL volume is a merged view of all storage devices, and clients working on a specific volume need to focus on the volume they're interested in. Bug: 129840030 Test: atest --test-mapping packages/providers/MediaProvider Change-Id: I91cee6a96d7f9360e6a93a9a3c389b097b6b9967
* | Switch to HexEncoding from ByteStringUtilsNeil Fuller2019-04-111-4/+5
|/ | | | | | | | | | Migration in preparation for deletion of ByteStringUtils. Also contains an import ordering change needed for upload. Bug: 124232146 Test: build only Change-Id: I0c71751de9a142a81ce43b4eaea497bf291afcbc
* Query specific collections for properties.Jeff Sharkey2019-03-242-185/+64
| | | | | | | | | | | | | | | We're now enforcing the public API schema, so clients like MTP need to query specific collections when asking for properties that are specific to those media types. Also refactor MediaScanner calls to go through MediaProvider, so they can be handled by ModernMediaScanner. We no longer directly try inserting items, and instead rely completely on the scanner. Bug: 127625964, 122263824 Test: atest MediaProviderTests Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore* Change-Id: Ic86982766606a619afafe725f9c60013a5671840
* MTP: remove usages of device identifiers with virtual serial numberJames Wei2019-02-202-3/+58
| | | | | | | | | | | | | | | Improving protection of user privacy Use randomly generated virtual serial number that persists until factory reset Bug: 117585389 Test: Open multiple MTP device Check MTP device property uninstall / re-install MTP driver WMP sync with multiple MTP device Enable MTP mode with multi-user Malformed MTP ID file Change-Id: I7ed4ce81d9ca1e1c6605c59c73bcd2d26419a5d3
* MTP: media info can not be retrieved via MTPJames Wei2018-10-221-1/+6
| | | | | | | | | | | | | | Under the new MtpStorageManager design of Android P, media info like MP3 Track title, album and artist, Genre, etc can not be retrieved via MTP by Windows Media Player, Linux Rhythmbox and BMW Car Kit Bug: 112635346 Test: Windows Media Player Test: Linux Rhythmbox Change-Id: Ibbdaff52a24fa36c6090e799323b767dd5692207 (cherry picked from commit 7784da12b9b3394beb791b16befcd33075668270)
* Modify MTP OWNERS file.Raj Mojumder2018-08-271-1/+3
| | | | | | | | Set noparent and correct one entry. Test: no Change-Id: Iea566148c9cddd4d2529f164c2ff2ff78f4dc596
* Add frameworks/base/media/java/android/mtp/OWNERSRaj Mojumder2018-08-271-0/+5
| | | | | | | Differentiated OWNERS for MTP functionality Test: no Change-Id: I477143dc58c65fcc366bb8167f820f91ee009f99
* Merge "MTP: Add support of ObjectInfoChanged Event"TreeHugger Robot2018-08-233-1/+41
|\
| * MTP: Add support of ObjectInfoChanged EventJames2018-07-273-1/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Under MTP mode, new file created at device side shown size zero at PC side due to file information is not updated to PC in time with ObjectAdded event Bug: 77883345 Test: 1. Take screenshot of device under MTP mode with Win10 / Linux 2. file copy, delete, rename between PC and device 3. file copy, delete, rename on device with adb shell command Test: adb shell am instrument -w android.mtp/ android.support.test.runner.AndroidJUnitRunner Change-Id: If428064fb0104b53b8afd5b050a4fab4a09312f0
* | Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-092-0/+6
|/ | | | | | | | | | | | | | | | For packages: android.mtp This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Id97d70dc1003cd7c6ed585d647bf0df0fd7a946a
* Replace streams with Lists in MtpStorageManagerJerry Zhang2018-07-162-50/+53
| | | | | | | | Streams are dispreferred in Android java, so use Lists for all cases instead. Test: Mtp works and MtpStorageManager tests pass Change-Id: I0579013fca690346c6c2561fe3079fd50f215833
* Merge "Call access(2) on all files/dirs modified by Mtp" into pi-devJerry Zhang2018-05-151-0/+10
|\
| * Call access(2) on all files/dirs modified by MtpJerry Zhang2018-05-151-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | External sdcards are accessed through /mnt/media_rw, so access() each touched file for sdcardfs to update its metadata. Java handles single object renames directly so that is the only place where it is needed. Bug: 77849654 Test: use mtp with emulated sdcard Change-Id: Ie460398010f1fe74d8084808a6333b121674362c