From f7f608ccc3f820654b603d882b8bae3dd3e09b33 Mon Sep 17 00:00:00 2001 From: James Wei Date: Wed, 15 Aug 2018 22:23:12 +0800 Subject: [PATCH] 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) --- media/java/android/mtp/MtpDatabase.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/media/java/android/mtp/MtpDatabase.java b/media/java/android/mtp/MtpDatabase.java index e67b100d840dd..474b671c0c2b0 100755 --- a/media/java/android/mtp/MtpDatabase.java +++ b/media/java/android/mtp/MtpDatabase.java @@ -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,