Merge "Remove transcode allow list" into sc-dev
diff --git a/apex/Android.bp b/apex/Android.bp
index 2668806..b620fe6 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -42,9 +42,7 @@
 
 sdk {
     name: "mediaprovider-module-sdk",
-    java_sdk_libs: [
-        "framework-mediaprovider",
-    ],
+    bootclasspath_fragments: ["com.android.mediaprovider-bootclasspath-fragment"],
 }
 
 // Encapsulate the contributions made by the com.android.mediaprovider to the bootclasspath.
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index e76bde9..7a1c5d0 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -5710,11 +5710,16 @@
                         extras.getParcelable(MediaStore.EXTRA_FILE_DESCRIPTOR);
                 try {
                     File file = getFileFromFileDescriptor(inputPfd);
-                    boolean isModernFormat = mTranscodeHelper.isModernFormat(file.getPath());
-                    if (!isModernFormat) {
+                    if (!mTranscodeHelper.supportsTranscode(file.getPath())) {
                         // Return an empty bundle instead of throwing an exception in the special
-                        // case where the file is not a modern format. This avoids a misleading
+                        // case where the file does not support transcode. This avoids a misleading
                         // warning in android.database.DatabaseUtils#writeExceptionToParcel
+                        //
+                        // Note that we should be checking if a file is a modern format and not just
+                        // that it supports transcoding, unfortunately, checking modern format
+                        // requires either a db query or media scan which can lead to ANRs if apps
+                        // or the system implicitly call this method as part of a
+                        // MediaPlayer#setDataSource.
                         return new Bundle();
                     }
 
diff --git a/src/com/android/providers/media/TranscodeHelper.java b/src/com/android/providers/media/TranscodeHelper.java
index 9a74ddc..19efa8d 100644
--- a/src/com/android/providers/media/TranscodeHelper.java
+++ b/src/com/android/providers/media/TranscodeHelper.java
@@ -802,18 +802,6 @@
         return isHevc(mimeType) || isHdr10Plus(colorStandard, colorTransfer);
     }
 
-    public boolean isModernFormat(String filePath) {
-        if (supportsTranscode(filePath)) {
-            Pair<Integer, Long> result = getFileFlagsAndDurationMs(filePath);
-            int fileFlags = result.first;
-            if (fileFlags != 0) {
-                // File is HEVC or HDR
-                return true;
-            }
-        }
-        return false;
-    }
-
     public static boolean supportsTranscode(String path) {
         File file = new File(path);
         String name = file.getName();