Commit Graph

182 Commits

Author SHA1 Message Date
Treehugger Robot
733c4088f0 Merge "MTP: Add thumbnail generation for JPG" am: 5aac2c84ba am: d68b21d215 am: fe8e0b235f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1657579

Change-Id: Ia6f614fe65c560681b2f076046a7e4295a3f3e86
2021-04-01 08:24:14 +00:00
Treehugger Robot
fe8e0b235f Merge "MTP: Add thumbnail generation for JPG" am: 5aac2c84ba am: d68b21d215
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1657579

Change-Id: I9b85e42a66e310666de6d811e2af38d428a86f3d
2021-04-01 07:37:36 +00:00
James Wei
1f1f81e0d1 MTP: Add thumbnail generation for JPG
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
2021-03-30 13:49:27 +08:00
Ray Essick
c03518906f Remove stale method from MtpServer
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
2021-02-23 08:42:49 -08:00
Manish Singh
530d7d9cdb Add unsupported mime types in media capabilities
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
2021-01-20 19:34:56 +00:00
Zim
223e3b5c88 Support transcode via MTP
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
2021-01-15 22:39:58 +00:00
TreeHugger Robot
da4cb98b05 Merge "Fix renaming file and moving file issue in MTP" into rvc-qpr-dev am: d099321312
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13090503

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibdb009f96a2e55bb29dd7189451a7cbf57d6919a
2021-01-12 04:18:20 +00:00
Ivan Chiang
23ed52f971 Fix renaming file and moving file issue in MTP
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 20079f1064)
2021-01-11 10:47:12 +00:00
Treehugger Robot
1557e2bf14 Merge "MTP: Update language to comply with Android's inclusive language 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
2021-01-07 17:54:17 +00:00
James Wei
bbf55a3fcd MTP: Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference


BUG=162536543

Change-Id: Ide3483e78ce66deb9bdda2a0d54feb8f70748832
2020-12-15 01:20:23 +00:00
Jeff Sharkey
7444e309f9 Revert "Temporarily replace "android.com" accounts."
This reverts commit 0ace970e19.

Bug: 174932174, 175111824
Exempt-From-Owner-Approval: refactoring with team leads buy-in
Change-Id: I152186408ecf6da1cb7354d14737de7cce55a34b
2020-12-09 11:06:28 -07:00
Jeff Sharkey
0ace970e19 Temporarily replace "android.com" accounts.
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
2020-12-08 17:54:13 +00:00
Ivan Chiang
20079f1064 Fix renaming file and moving file issue in MTP
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
2020-11-19 00:32:00 +08:00
James Wei
5667f0d272 Merge "use updated mStorage for new MtpObject when copy file between storages" am: 587620cc62 am: 7c7680f261
Original change: undetermined

Change-Id: I55cee281ffbd62bee688831844d3f2b071666e4c
2020-06-02 06:51:36 +00:00
joker.yang
5be80641b7 use updated mStorage for new MtpObject when copy file between storages
copy file from sdcard to internal storage through MTP,
then the file can't be renamed

bug: 147715888

Change-Id: Iffeeeb1372e0ecf305cf0c70edb601a4b2001342
2020-05-30 06:39:25 +00:00
James Wei
f545a3ac9e MTP: media info can not be retrieved via MTP#2
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
2020-05-01 07:52:55 +00:00
James Wei
82062b99eb MTP: Fix MTP SD card issue
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-04-22 11:34:42 +08:00
James Wei
19ded228a3 MTP: Add MtpDatabase unit test
Add Thumbnail feature test cases

Bug: 117863715
Test: atest MtpTests
Change-Id: I5a09efef10df20e382a4c623481e048e7b35ff14
2020-04-22 03:20:02 +00:00
James Wei
fa96ad19c7 Merge "MTP: Add MTP Thumbnail feature" 2020-02-05 02:56:03 +00:00
Andrii Kulian
e57f2dc246 Exempt-From-Owner-Approval: Fix usages of WindowManager.getDefaultDisplay() 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
2020-01-31 01:15:21 +00:00
James Wei
bb3f548234 MTP: Add MTP Thumbnail feature
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
2020-01-22 09:38:59 +00:00
Artur Satayev
53ada2ab28 Use new UnsupportedAppUsage annotation.
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
2020-01-14 15:54:55 +00:00
Artur Satayev
2ebb31c00c Use new UnsupportedAppUsage annotation.
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
2020-01-08 16:06:00 +00:00
Automerger Merge Worker
90dc909c3a Merge "Revert "Use new UnsupportedAppUsage annotation."" am: edf7ce4f38 am: 019286764f am: f6253ef435
Change-Id: Id33f64eb9c8aa7d68cc52f7359b4f0a3d2675d8a
2019-12-19 12:13:32 +00:00
Austin Wang
a63a2c0130 Revert "Use new UnsupportedAppUsage annotation."
This reverts commit a5264903e2.

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-19 06:38:19 +00:00
Automerger Merge Worker
277353090c Merge "Use new UnsupportedAppUsage annotation." am: 1385dca8f6 am: 068a9faf3d am: c7f44bacbe
Change-Id: I30839db2fe99ba4670ec1b39d5e64540fdd15f69
2019-12-18 16:31:41 +00:00
Artur Satayev
a5264903e2 Use new UnsupportedAppUsage annotation.
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-18 12:07:36 +00:00
Jeff Sharkey
04b4ba1e15 Shuffling to prepare for MediaProvider APEX.
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-12-18 01:35:46 +00:00
Jeff Sharkey
8f5cdbb49b Disable support for object references.
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
2019-12-16 14:10:56 -07:00
Marco Nelissen
292fdc1c93 Remove libexif usage from libmedia_jni.so
Test: manual, connect with MTP and PTP
Change-Id: I33128db25b8aae60df7854c61fc2a3873a1bced9
(cherry picked from commit f7ec16802c)
(cherry picked from commit efb865ace2)
(cherry picked from commit 5954d210d3)
2019-07-08 05:29:38 +00:00
Marco Nelissen
f7ec16802c Remove libexif usage from libmedia_jni.so
Test: manual, connect with MTP and PTP
Change-Id: I33128db25b8aae60df7854c61fc2a3873a1bced9
2019-07-02 15:48:17 +00:00
Neil Fuller
ca48dd8182 Switch to HexEncoding from ByteStringUtils
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 8fdca745d6)
2019-06-06 14:01:38 +00:00
Jeff Sharkey
731ca71e07 Merge "Adjust MTP to reference by specific volume name." into qt-dev am: 383d316707
am: 951c617d7d

Change-Id: I507f1c1de958ad8b5866eec8334f4a1404c659f2
2019-04-17 15:18:15 -07:00
Jeff Sharkey
42bf6d8a42 Adjust MTP to reference by specific volume name.
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
2019-04-17 11:16:15 -06:00
Neil Fuller
8fdca745d6 Switch to HexEncoding from ByteStringUtils
Migration in preparation for deletion of ByteStringUtils.

Also contains an import ordering change needed for upload.

Bug: 124232146
Test: build only
Change-Id: I0c71751de9a142a81ce43b4eaea497bf291afcbc
2019-04-11 11:31:28 +01:00
Jeff Sharkey
ff200957fd Query specific collections for properties.
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
2019-03-24 14:21:01 -06:00
James Wei
9c968fdb4f MTP: remove usages of device identifiers with virtual serial number
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
2019-02-20 15:12:42 +08:00
James Wei
f7f608ccc3 MTP: media info can not be retrieved via MTP
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)
2018-10-22 02:16:28 +00:00
Raj Mojumder
b570968483 Modify MTP OWNERS file.
Set noparent and correct one entry.

Test: no

Change-Id: Iea566148c9cddd4d2529f164c2ff2ff78f4dc596
2018-08-27 14:11:46 -07:00
Raj Mojumder
22e0a4ab0f Add frameworks/base/media/java/android/mtp/OWNERS
Differentiated OWNERS for MTP functionality

Test: no
Change-Id: I477143dc58c65fcc366bb8167f820f91ee009f99
2018-08-27 10:53:29 -07:00
TreeHugger Robot
29bcb287b6 Merge "MTP: Add support of ObjectInfoChanged Event" 2018-08-23 01:38:39 +00:00
Mathew Inwood
d99b96e0f8 Add @UnsupportedAppUsage annotations
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-08-09 17:22:11 +01:00
James
e4f680e058 MTP: Add support of ObjectInfoChanged Event
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
2018-07-27 11:54:43 +08:00
Jerry Zhang
9a018747be Replace streams with Lists in MtpStorageManager
Streams are dispreferred in Android java, so
use Lists for all cases instead.

Test: Mtp works and MtpStorageManager tests pass
Change-Id: I0579013fca690346c6c2561fe3079fd50f215833
2018-07-16 18:21:47 -07:00
Jerry Zhang
01f41f96fe Merge "Call access(2) on all files/dirs modified by Mtp" into pi-dev 2018-05-15 21:35:43 +00:00
Jerry Zhang
d470a1eca6 Call access(2) on all files/dirs modified by Mtp
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
2018-05-15 12:29:13 -07:00
Jerry Zhang
71938e18ca Access removable volumes through /mnt/media_rw
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
2018-05-14 11:39:12 -07:00
Jerry Zhang
bb54f62d1a Merge "Guard against null server" into pi-dev 2018-03-27 17:54:21 +00:00
Jerry Zhang
2ecbc7acdb Guard against null server
If MtpService stops before MtpServer
shuts down, the server will be null,
so don't attempt to use it in that
case.

Bug: 76433619
Test: no errors
Change-Id: I6744cb78908e6a0663a4b60107d5c9c18dda62bb
2018-03-27 00:01:33 +00:00
Jerry Zhang
63a69fd4f8 Revert "Add additional context to MtpDatabase"
This reverts commit 5f0139d2e8.

Bug: 72877143
Test: Switch users, use MTP
Change-Id: Ide372a9311a4f2647715d052fc0e1d9a04808aa0
2018-03-22 11:35:19 -07:00