Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 833bfd2b authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge "MediaScanner: Fix problem with duplicate directory entries in the database"

parents af20eacc c6eaa713
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -872,10 +872,14 @@ public class MediaScanner
                    values.put(Files.FileColumns.FORMAT, format);
                }
                // new file, insert it
                if (inserter != null) {
                    result = inserter.insert(values);
                } else {
                // We insert directories immediately to ensure they are in the database
                // before the files they contain.
                // Otherwise we can get duplicate directory entries in the database
                // if one of the media FileInserters is flushed before the files table FileInserter
                if (inserter == null || entry.mFormat == MtpConstants.FORMAT_ASSOCIATION) {
                    result = mMediaProvider.insert(tableUri, values);
                } else {
                    result = inserter.insert(values);
                }

                if (result != null) {