More robust MTP-to-MIME-type mappings.
Recently in I830717428e72ac37c5ecd1f23d915aa878ef3744, we greatly improved the underlying file-extension-to-MIME-type mappings defined in libcore and used across the OS. Instead of maintaining divergent mappings here in MediaFile, this change delegates all file extension logic down to libcore, and standardizes all MediaScanner internals on using MIME types. To register new file types in the future: 1. Add the MIME-to-extension registration in libcore. 2. Add the MIME-to-MTP mapping here in MediaFile. This change also ensures that unknown MIME types are surfaced across MTP, using constants like FORMAT_UNDEFINED_AUDIO for audio/* until an explicit format is defined. We now surface WMA/WMV file formats, even if the device can't natively play them back, since we still want to offer the ability for users to copy them around, and the user may have a third-party app capable of playing them. Keeps @UnsupportedAppUsage intact for now. Bug: 111268862, 112162449 Test: atest frameworks/base/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaFileTest.java Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore* Change-Id: I2f6a5411bc215f776f00e0f9a4b7d825b10b377d
Loading
Please register or sign in to comment