From 530d7d9cdbad2e2adaec8f1660738392771b48dd Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Tue, 19 Jan 2021 21:30:31 +0000 Subject: [PATCH] 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 --- media/java/android/mtp/MtpDatabase.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/media/java/android/mtp/MtpDatabase.java b/media/java/android/mtp/MtpDatabase.java index 4f27b197273cb..6141b7fc74638 100755 --- a/media/java/android/mtp/MtpDatabase.java +++ b/media/java/android/mtp/MtpDatabase.java @@ -769,10 +769,12 @@ public class MtpDatabase implements AutoCloseable { try { Log.i(TAG, "openFile with transcode support: " + path); - // TODO(b/158466651): Pass the |transcode| variable as flag to openFile - Bundle bundle = null; - if (!transcode) { - bundle = new Bundle(); + Bundle bundle = new Bundle(); + if (transcode) { + bundle.putParcelable(MediaStore.EXTRA_MEDIA_CAPABILITIES, + new ApplicationMediaCapabilities.Builder().addUnsupportedVideoMimeType( + MediaFormat.MIMETYPE_VIDEO_HEVC).build()); + } else { bundle.putParcelable(MediaStore.EXTRA_MEDIA_CAPABILITIES, new ApplicationMediaCapabilities.Builder().addSupportedVideoMimeType( MediaFormat.MIMETYPE_VIDEO_HEVC).build());