summaryrefslogtreecommitdiff
path: root/media/java/android/mtp/MtpStorageManager.java
Commit message (Collapse)AuthorAgeFilesLines
* Limit transcoding size workaround to windowsKevin Rocard2021-11-261-4/+7
| | | | | | | | | | | 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: 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
* 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
* Adjust MTP to reference by specific volume name.Jeff Sharkey2019-04-171-4/+12
| | | | | | | | | | 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
* MTP: Add support of ObjectInfoChanged EventJames2018-07-271-1/+30
| | | | | | | | | | | | | | 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
* Replace streams with Lists in MtpStorageManagerJerry Zhang2018-07-161-32/+28
| | | | | | | | Streams are dispreferred in Android java, so use Lists for all cases instead. Test: Mtp works and MtpStorageManager tests pass Change-Id: I0579013fca690346c6c2561fe3079fd50f215833
* Access removable volumes through /mnt/media_rwJerry Zhang2018-05-141-1/+1
| | | | | | | | | | | | | Due to permissions changes, we now need to access the underlying filesystem of removable devices in order to get write access. Add internalPath to StorageVolume, and have VolumeInfo set the field on creation. Bug: 77849654 Test: Can write to emulated sdcard through MTP Change-Id: I63302ecf2dd2600a1c9f3f6ab106c3695654cbaa
* Add MtpStorageManager for monitoring filesystem eventsJerry Zhang2017-12-151-0/+1210
MtpStorageManager keeps track of file information and send notifications for new files. MtpDatabase now uses this instead of MediaProvider for getting object information, although some operations are still reflected into MP. Since MtpStorageManager handles storage ids, remove that field from StorageVolume and VolumeInfo. Clean up a lot of the jni code for MtpDatabase. Bug: 63143623 Test: Test every MtpOperation in a variety of situations on Linux and Windows. Also use the shell to manipulate files. Verify that the cache is consistent throughout, and the operations behave as expected. Verify files created by the shell appear. Test: adb shell am instrument -w android.mtp /android.support.test.runner.AndroidJUnitRunner Change-Id: Id4ea810047b0c323399cd833047733e5daafb30a