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)
This commit is contained in:
James Wei
2018-08-15 22:23:12 +08:00
parent 9aac06cc13
commit f7f608ccc3

View File

@@ -538,8 +538,13 @@ public class MtpDatabase implements AutoCloseable {
MtpPropertyGroup propertyGroup;
for (MtpStorageManager.MtpObject obj : objs) {
if (property == 0xffffffff) {
if (format == 0 && handle != 0 && handle != 0xffffffff) {
// return properties based on the object's format
format = obj.getFormat();
}
// Get all properties supported by this object
propertyGroup = mPropertyGroupsByFormat.get(obj.getFormat());
// format should be the same between get & put
propertyGroup = mPropertyGroupsByFormat.get(format);
if (propertyGroup == null) {
int[] propertyList = getSupportedObjectProperties(format);
propertyGroup = new MtpPropertyGroup(mMediaProvider, mVolumeName,