Android 11 每次插入U盘都自动创建了很多文件夹
(Podcast Ringtones Music Alarm Notification Pictures Movies Download DCIM Documents Audiobooks 等)
修改路径 package/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java
diff --git a/MediaProvider/src/com/android/providers/media/MediaProvider.java b/MediaProvider/src/com/android/providers/media/MediaProvider.javaindex 13a17ac..37ef123 100644--- a/MediaProvider/src/com/android/providers/media/MediaProvider.java+++ b/MediaProvider/src/com/android/providers/media/MediaProvider.java@@ -824,7 +824,8 @@ public class MediaProvider extends ContentProvider { if (vol.isPrimary()) { key = "created_default_folders"; } else {- key = "created_default_folders_" + vol.getMediaStoreVolumeName();+ //key = "created_default_folders_" + vol.getMediaStoreVolumeName(); //delete by gyx+ return; } final SharedPreferences prefs = PreferenceManager@@ -856,6 +857,13 @@ public class MediaProvider extends ContentProvider { private void ensureThumbnailsValid(@NonNull String volumeName, @NonNull SQLiteDatabase db) { final String uuidFromDatabase = DatabaseHelper.getOrCreateUuid(db); try {++ //add by gyx+ final File path = getVolumePath(volumeName);+ final StorageVolume vol = mStorageManager.getStorageVolume(path);+ if(!vol.isPrimary())return;+ //end+ for (File dir : getThumbnailDirectories(volumeName)) { if (!dir.exists()) { dir.mkdirs();
来源地址:https://blog.csdn.net/weixin_35649059/article/details/129796179