Android 每次插入U盘自动创建了不需要的文件夹

04-14 1587阅读

Android 11 每次插入U盘都自动创建了很多文件夹

Android 每次插入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.java
index 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();
VPS购买请点击我

文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

目录[+]