summaryrefslogtreecommitdiff
path: root/media/java/android/mtp/MtpStorage.java
AgeCommit message (Collapse)Author
2020-04-22MTP: Fix MTP SD card issueJames Wei
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
2020-01-08Use new UnsupportedAppUsage annotation.Artur Satayev
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
2019-12-19Merge "Revert "Use new UnsupportedAppUsage annotation."" am: edf7ce4f38 am: ↵Automerger Merge Worker
019286764f am: f6253ef435 Change-Id: Id33f64eb9c8aa7d68cc52f7359b4f0a3d2675d8a
2019-12-19Revert "Use new UnsupportedAppUsage annotation."Austin Wang
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
2019-12-18Merge "Use new UnsupportedAppUsage annotation." am: 1385dca8f6 am: ↵Automerger Merge Worker
068a9faf3d am: c7f44bacbe Change-Id: I30839db2fe99ba4670ec1b39d5e64540fdd15f69
2019-12-18Use new UnsupportedAppUsage annotation.Artur Satayev
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
2019-12-18Shuffling to prepare for MediaProvider APEX.Jeff Sharkey
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
2019-04-17Adjust MTP to reference by specific volume name.Jeff Sharkey
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
2018-08-09Add @UnsupportedAppUsage annotationsMathew Inwood
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
2018-05-14Access removable volumes through /mnt/media_rwJerry Zhang
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
2017-12-15Add MtpStorageManager for monitoring filesystem eventsJerry Zhang
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
2015-07-07Generate stable MTP storage IDs.Jeff Sharkey
It ends up that MediaProvider is persisting MTP storage IDs in its database, so we need to make sure we generate stable IDs over time, otherwise we can end up looking into a black hole. Bug: 22256092 Change-Id: I6a75c239aac1b71fd5f6df0df69b24971079a086
2015-04-04Parcelable objects for Disk/Volume.Jeff Sharkey
Will eventually be used by SystemUI and/or Settings. Also fix SettingsProvider NPE. Bug: 19993667, 19909433 Change-Id: Ie326849ac5f43ee35f728d9cc0e332b72292db70
2015-03-30Progress towards dynamic storage support.Jeff Sharkey
Storage devices are no longer hard-coded, and instead bubble up from whatever Disk and VolumeBase that vold uncovered, turning into sibling Java objects in MountService. We now treat vold events as the source-of-truth for state, and synchronize our state by asking vold to "reset" whenever we reconnect. We've now moved to a model where all storage devices are mounted in the root mount namespace (user boundaries protected with GIDs), so we no longer need app-to-vold path translation. This also means that zygote only needs to bind mount the user-specific /mnt/user/n/ path onto /storage/self/ to make legacy paths like /sdcard work. This grealy simplifies a lot of system code. Many parts of the platform depend on a primary storage device always being present, so we hack together a stub StorageVolume when vold doesn't have a volume ready yet. StorageVolume isn't really a volume anymore; it's the user-specific view onto a volume, so MountService now filters and builds them based on the calling user. StorageVolume is now immutable, making it easier to reason about. Environment now builds all of its paths dynamically based on active volumes. Adds utility methods to turn int types and flags into user-readable strings for debugging purposes. Remove UMS sharing support for now, since no current devices support it; MTP is the recommended solution going forward because it offers better multi-user support. Simplify unmount logic, since vold will now gladly trigger EJECTING broadcast and kill stubborn processes. Bug: 19993667 Change-Id: I9842280e61974c91bae15d764e386969aedcd338
2013-01-09Fix possible integer overflow in MtpStorageHenrik Engström
When converting the MB value MtpReserveSpace value to bytes there is a possible integer overflow since 3 integer values are multiplied, even though the result is stored in a long variable. This would be visible when the value is more than 2 GB. This is solved by making the constants longs instead of ints. Change-Id: I799129f7076a6e331cece17b5c05aed210499648
2012-08-07MtpStorage: correct the size of reserve space for MTPbo huang
According to description in frameworks/base/core/res/res/xml/storage_list.xml, "mtpReserve: (integer) number of megabytes of storage MTP should reserve for free storage". Mtpstorage class use it directly and doesn't change it to correct size in megabyes. Mtp initor can not get correct storage information from android. Change-Id: Icf59eb1eb478e67ea5990be96a9decb41aa55504 Signed-off-by: Bo Huang <bo.b.huang@intel.com> Signed-off-by: Jack Ren<jack.ren@intel.com> Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
2012-05-23Fix bug #6522190 MountService should respond to configuration changes ↵Fabrice Di Meglio
("INTERNAL STORAGE" string should be translated dynamically) - use an ID instead of a String for StorageVolume description - use this ID for getting the correct localized version of the description string Change-Id: I30f3080fce2c889be38bfdf9f5121dffcf8a99e8
2011-07-11MTP: Return error if user tries to copy a file >= 4GB to a FAT32 file systemMike Lockwood
Bug: 4561836 Change-Id: I2bffb93b032038f6c220c24c752ccd7ca66c23a0 Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-05-17StorageVolume: Add getStorageId() accessorMike Lockwood
This ID is used for MTP as well as per volume querying in the media provider. Change-Id: Ic4fc986d972bd477730643f7e9450c390c0b3a4b Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-05-16MTP: Have GetStorageInfo command return correct storage type for removable ↵Mike Lockwood
storage Change-Id: I09b548483c12080e7d77970babcae2eef379f2f4 Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-05-03DO NOT MERGE MTP and media provider support for multiple storage devices:Mike Lockwood
- MTP support for multiple storage units - Add storage_id column to media database for MTP storage ID - Add framework resource for defining mount points and user visible descriptions for multiple volumes - Clean up locking in MtpServer JNI code Change-Id: Ide6d47bd9aa1698ed2a13d695613e03f2a9b29e3 Signed-off-by: Mike Lockwood <lockwood@android.com>